If I understand correctly, the state of a smart contract (its data storage and associated events) can only be changed via transactions.

The transactions are stored in blocks and as such in a public chain, due to the nature of the PoW consensus algorithm, may get reversed.

A common practice with currency transactions is to wait for a few "confirmations" in order to ensure the transaction has been "finalized".

Do I have to do the same with smart contract calls? Can I trust a state change in a smart contract immediately or should I wait for a few "confirmations"? Or is it handled already by the implementation?

3 Answers 3


You should treat contract transactions with the same caution that you would treat fund transfers, for the same reasons. In practice, proportionate the value of the transaction.

In all probability, a single confirmation will indicate that a transaction was accepted by the network but it would be misleading to suggest that a single confirmation is the last word.

Confirmations mitigate that doubt by the same method. More confirmations == reduced probability of reversal. Thankfully, confirmations tend to arrive reasonably quickly on Ethereum.

For clients that listen to event emitters, there is a new feature. You may receive events with a removed property set to true to let the listener know that a previously emitted event talked about something that is no longer part of the longest chain.

That can help the listener put its house in order and underscores that hopefully, nothing irreversible unfolded on the basis of a previously emitted event. While it is possible to "listen" to pending events, it's more common to listen to confirmed transactions, meaning the events arrive with the first confirmation. Depending on the stakes, one confirmation might not be sufficient strength of proof to move to the next step.

Hope it helps.

  • With events it's clear. But if I wait for a few confirmations, the state of the contract may have changed again due to more recent transactions. How can I "go back in time" a few blocks or otherwise "fix" the state in time to get a hold of the state of the contract that I do trust?
    – rustyx
    Apr 16, 2018 at 9:33
  • This is hard to decipher without understanding the use-case. The important thing with contract state is that it's always the best current state that can be known. It is internally consistent including all steps in all transactions that are part of the chain, and none of the steps in any transactions that aren't. You only need to be concerned with transaction confirmations if you are trading something valuable off-chain based on transactions. Apr 16, 2018 at 12:46

as far as your question is concerned, currency transactions and smart contract calls are the same thing, they both modify the underlying machine state. So just like currency transactions, state changes in the storage of a contract can be reversed or made invalid if another branch of the blockchain becomes longer than the one it was mined in.


As the manager of a contract, you can send transactions to it to update variables, etc. Those transactions are treated the same as all transactions - e.g., requires gas to send, requires consensus to commit. Thus, when the block has completed mining (a hash winner!) and consensus is achieved is when you can "trust" that your transaction is complete and immutable.

Your Answer

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

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