3

In Ethereum, for each account, transactions are mined in FIFO order. Each transaction has a transaction ID associated with it called a nonce and miners can only mine transactions with lower nonces first.

Is there any rule or ordering for EOS transactions? I just want to make sure if transaction a has to come before b, and I send a then b to say an API endpoint, then it will be the case that a gets mined before b.

3

You are right, this is the case in EOS as well. The transactions are ordered First In First Out (FIFO) and this is how the block producers order the transactions by the ID's and the hashes.

One possible exception to this would be if there was a microfork, such that transaction A goes to block producer 1 as his last block, and transaction B goes to block producer 2 as his first block. There is a small chance that block producer 1 is on a microfork, and therefore transaction A will be reversed, but transaction B will not be reversed.

If you are relying on this being in order for a smart contract, then you should either check that transaction A succeeded before accepting transaction B within the smart contract, or you should insist that both actions be part of the same transaction.

If this is just for executing actions using a wallet or cleos, then you should pack the two actions into a single transaction. This will then guarantee that should A fail because of a microfork, then B would also fail. It also guarantees that A is executed before B.

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.