0

Although this question is asked and answered several times, I'm still confused about who executes the ethereum transaction and when? I want to know the right answer (if possible with proof from the official papers):

1) the sender executes it first and send it to all the network in order to verify it and finally include it in a new block?

2) the sender creates a new transaction broadcast it to the network until it reaches the miner that 1) verifies it, 2) includes it in a new block, 3) executes the transactions of the new block, and 4) finally sends the block to the rest of the network which verifies it and executes its transactions (also, I want to know here if the "rest of the network" executes the transactions of the new block or simply update their states).

Is there anyone that can give the right answer.

1 Answer 1

2

2) the sender creates a new transaction broadcast it to the network until it reaches the miner...

Yes. (It reaches the transaction pools of all the miners.)

..that 1) verifies it,

Yes. The transaction must equate to a valid state transition.

2) includes it in a new block

Yes. They put it into a candidate block, then race to solve the proof of work for that block. If they are the first miner to solve the PoW, then their block will be accepted as canonical by the rest of the network. (We've jumped ahead of ourselves a bit here... )

3) executes the transactions of the new block,

They essentially already have, by checking the state transitions are valid and solving the PoW before anyone else. (Jump to the last part for a clearer explanation.)

and 4) finally sends the block to the rest of the network which verifies it and executes its transactions

Once a miner solves the PoW for the block, they propagate it to the network, yes. Everyone else then verifies the state transitions are valid, and the PoW for the block is indeed correct.

In verifying that the transactions equate to valid state transitions, they have, in effect, executed the transactions.

(also, I want to know here if the "rest of the network" executes the transactions of the new block or simply update their states).

I think the thing to get your head around is that "execute the transactions" and "simply update their states" is essentially the same thing. There's no distinction between "Okay, I've verified these transitions are good by applying them to my previous state..." with "... and now I'm going to actually 'execute' the transactions".

So the miner proposes to the rest of the network a set of valid state transitions around which the network can agree and form consensus on. Once everyone agrees that the state transitions are good, then the transactions have effectively been executed by everyone. The result of the transactions is the updated state.

2
  • thx Richard for the detailed answer. So, to be sure, the sender itself will execute the transaction after reaching the consensus? I want to know also if this process is generic for all the blockchain (bitcoin for example)?
    – A.Gh
    Commented Jan 31, 2019 at 19:42
  • 1
    The client which sent the transaction will itself validate the block (containing its own transaction) when it receives it from the winning miner, yes. The same basic flow is the same for Bitcoin and any other blockchains based on similar PoW infrastructures. (I'm sure there are other blockchain/DLT platforms where this doesn't hold true though.) Commented Feb 1, 2019 at 10:04

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.