0

This question already has an answer here:

If there are three nodes, and the contract is like that

contract IncentiveMechanism{
    uint public money;
    function setMoney(uint m){
        money = money+m;
    }
}

if three nodes call the function setMoney to set the value of money at the same time, can blockchain get the sum of these three operation?

marked as duplicate by Achala Dissanayake, Briomkez, Lauri Peltonen, shane, Richard Horrocks Apr 2 at 8:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    The value of money will become the sum of all 3 inputs if and only if all 3 transactions complete successfully AND no arithmetic overflow occurs in either one of them. – goodvibration Apr 1 at 12:21
  • three different nodes will also get the sum of all 3 inputs? They don't need to mine and get one of the value? like information in this page ethereum.stackexchange.com/questions/62160/… – Lance li Apr 1 at 12:46
  • There is no concurrency. The blockchain serializes transactions and executes them in sequence. The state will evolve in an orderly fashion. – Rob Hitchens - B9lab Apr 1 at 13:51
1

It is not nodes who call functions on smart contracts. It is private key owners and other smart contracts who do this.

Ethereum transaction is "executed" when it is included into block. All function invocations within one transactions are strictly ordered according to transaction order of execution. All transactions within block are strictly ordered and are executed in this order. All blocks are strictly ordered as well, so there is no concurrency in Ethereum world, thus no concurrency issues.

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