I have the following contract:

contract Contract{
  address minter;
  uint gid;


  function Contract(){
  function kill(){
    if (msg.sender == minter){

  function createAgreement(string name){
      //blah, blah

      gid++;   //what happens here?!

What happens if 100 users all call createAgreement(...) at the same time (i.e. on the same eth.blockNumber)? Do EVM nodes compete with each other?

I need gid to be unique for each of these 100 users!

Will gid be unique? Or do I need to do something different?

  • I did some testing and it appears that gid is being incremented correctly?! Can someone more knowledgeable on blockchains please explain this to me? I guess this is the wonder of blockchain, right?
    – Eamorr
    Feb 14, 2016 at 14:04

1 Answer 1


All comptutations that end up on the block chain are done by the lucky miner that mines a block. So there are no competing nodes on the same block. And I believe transactions are being handled one at a time synchronously so you don't have to worry about any race conditions.

All 100 user will have a unique gid with this code.


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.