As we known, if a transaction fails, the results of all actions in the transaction must be rolled back.

For example, account user1 (only has 80 EOS) submit a transaction that do following tasks:

  1. Modify multi index table in contract.
  2. Transfer 50 EOS from user1 to user2.
  3. Transfer 50 EOS from user1 to user3.

This transaction would fail as the balance of user1 is not enough.

How eos rollback the changes for multi index table?

In link https://developers.eos.io/eosio-cpp/docs/communication-model, I find there is a concept of “Current Transaction Data”, but there is no detailed information.

Could someone tell me the technical details about how to make transaction atomic in EOS?


1 Answer 1


Transactions are atomic on EOS and this is done behind the scenes for you. If this wasn't enforced for all transactions on the blockchain, the token would be useless.

The code of the EOSIO copies the values of the needed variables to a temporary area and runs the tasks in the transaction. If any validation fails, e.g. not enough funds in an account, the whole transaction fails and no new data is saved to the main blockchain state.

  • In github.com/EOSIO/eos/issues/353 , Daniel Larimer said: We cannot use the traditional approach to "backup data before modifying it" because that would be a sequential process (multiple transactions attempting to do this at the same time would be a mess).
    – lemon
    Aug 24, 2018 at 2:10

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.