2

Let me explain myself a bit ;)

I am new around blockchain biz but not in tech. Somehow I missed the bus so far.

So what I gather is a transaction is sent out and whoever gets there first creates a recorded block for good to seal the transaction and this process can take anywhere from few seconds to 10 mins. Please correct me if I am wrong. I am mostly from web / app world so I am trying to figure out how such a delayed transaction recording mechanism be useful for say user authentication during a login process.

Am I missing something ?

after bit of reading around I did find this https://medium.com/@mvmurthy/full-stack-hello-world-voting-ethereum-dapp-tutorial-part-1-40d2d0d807c2 which clarifies quite few things.

But my question is is there a way to make blockchain transactions real time so that a website user can perform it without any delays. What are the best practices / approaches to achieve this ?

1 Answer 1

2

I don't know what the best practices are, but I don't think you can actually perform on-chain transactions, but you can potentially do them off-chain.

If you're doing a login system and want to do it all on-chain, you could potentially use an escrow system with either tokens or actual ether, if your backend is designed in a way to support the following: suppose you want to let someone log in near-instantaneously but they are charged per-login. You can have them buy, say, 10 tokens (or fractions of an ether, whatever) and keep them in escrow. Then, at each login, they broadcast a transaction that calls a function to transfer one of the tokens and transfers them to you. Your backend then stores the broadcast transaction and internally tracks the number of tokens they would have. So if someone logs in once, even before the transaction is sealed into the blockchain, you can deduct one from their line of credit. They can do this 9 more times before a single transaction is sealed in. Before they can do an 11th transaction, they need to have an on-chain transaction to buy more tokens. You can be assured of no replays since your backend is keeping a copy of all the signed transactions, which you can ensure is rebroadcast onto the network. You would want to ensure that the gas price is high enough that the transaction will probably eventually get included.

2
  • the escrow you talk about .. you mean the money in their wallet or is it a escrow in my app backend that the user subscribes to ? Also when you say they broadcast a transaction that calls a function .. you mean a solidity contract deployed on live blockchain ? So do I need to integrate with a wallet app or is the wallet app a part of my web app ?
    – Gautam
    Jun 29, 2017 at 15:39
  • For the escrow, I'm thinking of a smart contract that either uses tokens or ether. For the broadcast transaction, yes, I mean calling one of the methods of the smart contract to use up a token/ether. You would watch for these transactions in your web application's backend (it should propagate through the network fairly quickly) and cache a copy so that you can play it back onto the network if need be (see ethereum.stackexchange.com/questions/18736/…). I don't know about the logistics for wallets; there are browser plug-ins tho
    – lungj
    Jun 29, 2017 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.