6

If execution is performed by every node on the network, how do you not end up with thousands of transactions transferring money (say a wager contract) multiple times? How does the network go from ALL running the code to only having it execute once?

Looking to understand the concept and not the detailed technicals at this point.

  • All the nodes on the network do not process the transactions. They just verify them. – Rado Apr 22 '16 at 3:11
3

This is simplified to try conveying the concept as requested.

A transaction is an entry in the ledger. Everyone has the same copy of the ledger. When I send you 1 ETH, I broadcast a transaction to everyone and it is a proposal for a new entry in the ledger. If everyone accepts that it is valid (I have at least 1 ETH to send to you), then everyone updates their ledger. So everyone has accepted and processed the transaction, and everyone updated their ledger, but there's only 1 transaction and entry in the ledger.

2

This is the magic of the blockchain.

The reason only one copy ends up on the chain is that when you sign a transaction and broadcast it over the network, it is picked up by miners who verify the signature and nonce.

A nonce is a number that essentially represents which number transaction of an account this is (first, second, third, etc.). In order for a transaction to be valid, it must have a nonce that is exactly 1 more than the last transaction sent by that account in the blockchain.

The miners each arrange all of the valid transactions they receive, making sure that nonces are strictly increasing. This is why the transaction is not included over and over, because two transactions from the same account cannot share the same nonce.

The miners then compete to solve a difficult problem, proving that they contributed a certain amount of work, and the one who finishes first gets to publish the block and claim a reward.

Once the block is published, each node verifies it themselves, to make sure that the miner was honest.

1

Although the same transaction execution is replicated thousands of times on different nodes, the change of state of the Ethereum blockchain resulting from that transaction occurs only once -- when the block is published.

Every time a transaction runs, on separate nodes, the same input state is used and the same output state results.

For example, in the case of a simple ether transfer between Externally Owned Accounts, the input state will always be the state of the participating accounts prior to the transfer and the output state will always be the same output state reflecting the transfer as recorded in the published/proposed block.

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.