I know that when somebody wants to run a function in a contract, she sends a transaction; and then a miner needs to run that function based on the function input received from the user, adding the contract output to a newly proposed block. The block is then propagated to every full-node to be verified, but

1- How can every full-node verify that every contract transaction is executed correctly by miners? Does the verifier receive the output of every contract in that block in addition to user input of the function; and then she has to run every contract and compare the result with the miner result? if so,

2- Verifying process is as expensive as mining, but why is still free (verifiers do not get any ether, unlike miners).

Simply, could anyone explain to me the mechanism in detail of verifying a block with contract transactions? What needs to be verified? how long does it take compared to mining a block?


1 Answer 1


1) Miners verify blocks. The blocks are 'correct' because the miners agree through the consensus algorithm that the result is correct. If at least 51% of miners say it's correct, then it's correct. You mistakenly seem to think that the 'verifier' and the miner are different. Miners are verifiers. Yes. They run every function on every smart contract.

2) There are two potential sources of income: block reward and transaction fees (or gas). Both are given to the miner who first finds the block. All the other miners are competing to win the block. The incentive to win is what keeps miners honest. And, again, you're mistaken belief that verifiers and miners are different is at the heart of your misunderstanding. Miners are the verifiers. The one miner who first finds the block gets the reward.

Nodes that are participating but not mining (like mine) also run all the functions on all the smart contracts, but because they are not mining, they have no hope of winning the reward and gas. I run my node, because I want the local data. My non-mining node will add blocks if more than 51% of the network agrees that it's a valid block.

I'm pretty sure the verification of the transactions is minimal compared to the work finding the block hash, but perhaps someone else will answer that.

  • 1
    Thanks a lot.. I meant the underlaying concept of verification is not clear for me. I looked on the internet and all explannations are high level without details to answer my questions especially question 2.
    – MWH
    Commented May 1, 2017 at 0:20
  • Nodes that are "verifying" without mining do so to keep their own local copies of the ledger up to date. Miners take the extra step (after verifying) of expending tons of electricity trying to find the hash in the hopes of winning the block reward. Commented May 1, 2017 at 4:50
  • By the way, I don't know if "verifying" is the exact right word. Commented May 1, 2017 at 4:51
  • IIUC the miner runs the smart contract before creating a block. If the smart contracts runs for a long time, does the miner has to wait till it completes to create the block - and how does it affect the block time? Commented Jul 9, 2017 at 12:51

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.