I have seen a couple articles saying that "all the nodes in the Ethereum network run the code for a smart contract". I was curious about rewards for nodes in the network, specially about the matter of "If all nodes execute a smart contract, why does only one get the gas?" - in which I (partly) found the answer here:

If all nodes execute smart contracts, why do only block creators get the gas fee?

The answers do not talk about nodes running the code, but verifying/validating the block. I can see that verifying a block is computationally much cheaper than actually running code (correct me if I'm wrong, but in my understanding this process would be only peer 2 peer upload/download and verifying the hash), which brings me to the question:

Do all miners actually run a smart contract code or just sync to the new data state without actually running the instructions?

1 Answer 1


If I handed you a cheque that I wrote for a trillion dollars and I signed it, etc., you could verify the signature and the provenance of it and say “this is a real cheque”. Let’s suppose you tried to deposit this cheque. And then let’s suppose one of my friends told you that you are now a trillion dollars richer and I am a trillion dollars poorer. Would you have any reason to believe my friend? What if you didn’t know it was my friend? And what if my friend was a bank teller? What would it take for you to have absolute certainty that the deposit was successful.

I’m guessing if you could see the internal workings of the bank’s records and knew that it was the real thing and immutable retroactively, you’d be satisfied. That’s what you get from a blockchain. And so if you saw that not only was the cheque real in the sense that I signed it, but also that my account had sufficient money in it AND it was transferred to you (and that everyone else agrees), then you could be satisfied.

The last part about verifying final balances requires you to execute the contract. The computer (specifically, the Ethereum virtual machine) blindly and unintelligently follows instructions. If I wrote and called a convoluted function and said “this function transfers 1 ether from me to you”, the easiest way to verify that is to run the function and see what side effects take place. Even if I told you truthfully what the result was, you might want to check for yourself.

Now, this means that miners who do not wished to be duped into forking the blockchain by building the next block on top of an invalid state means that those miners will want to verify. This means miners should want to check that their current state is legitimate. Miners could, I suppose, skip that and act like a light client and not verify past blocks. However, the miners do need to generate the next block’s state (that is in their job description!) in order to produce the next block. In order to do so, miners must execute incoming transactions in order to mine. Since miners, in general, do not know in advance who will produce a particular block, they all perform the computations in the hopes that it will be them.

  • "Since miners, in general, do not know in advance who will produce a particular block, they all perform the computations in the hopes that it will be them." Great explanation! (:
    – sigmaxf
    May 9, 2018 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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