1

I would like to know issue like:

  1. When I make a web3 call, how can I know my transaction is succeeded or failed?

  2. When my Smart Contract is executed without any problem, is that mean my transaction is succeeded? Or can it failed again later when double spending is detected? If yes, then what can I do?

  3. How can I make sure the ETH that I have received is already confirmed?

Without a complete and simplified flow, I am having a hard time to figure out what to do next.

Thanks in advance

1

The flow is roughly something like this:

  1. Send the transaction
  2. Wait for the transaction receipt - at this point you know that someone has mined your tx and that it has been included into a block, but you don't know if it will stay like this (-> chain forks/reorgs)
  3. Check the status field in the receipt - here you can check if revert has been triggered at some point in your code, or if you ran out of gas. If status = 01 -> success. See "What is the exact meaning of a transaction's new receipt 'status' field?".
  4. Wait for 12 more blocks. Now you can be relatively sure that your transaction will stay in the blockchain. See "What number of confirmations is considered secure in Ethereum?". However, you will never have 100% certainity. See "How is the Two Generals Problem solved with proof of work?".
  • ivicca, I am assuming your answer is in the web3 client point of view. Do I need to do the same for Smart Contract? – s k Mar 8 '18 at 9:40
  • I am not sure what you mean? Only Transactions can change the state in the blockchain. No matter if contract call or ether transfer. What exactyl do you mean with "same for Smart Contract"? – ivicaa Mar 8 '18 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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