I am trying to set up a smart contract by which two parties need to agree upon a state. For that, for security, I require one party to say the state and the second to also say it, and see if they both agree.

I was wondering, is it possible that both parties are recognised as the first party to say the state? (this would completely break my smart contract).


  • No. Txs are ordered in a block. One tx always happens before the other. Nov 13 '17 at 17:58

No, there's no way for your contract to be run in parallel. The second transaction will always be run after the first one finishes.

What can happen is that they are not run in the order the users called them. If user A executes the function and 1 milisecond afterwards user B executes the function, it might happen that user B goes first, depending in the order the transactions are mined, which can be manipulated to some extent by the miners.

Also, you should note for your case that the content that you send and store to the blockchain can be inspected by miners or users looking at the transactions, so unless you do some encryption of the state being sent, user B could know what state user A sent and match it.

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.