0

This question already has an answer here:

I read here -- On which node smart contract get executed taht once your smart contract gets incorporated into the Ethereum network, every node on the network will execute that contract (done to prevent someone from cheating and claiming it required more gas than it did). However if everyone is executing the contract, who is receiving the transaction fees? Please let me know what fundamental things I'm missing here.

marked as duplicate by Richard Horrocks, lungj, Achala Dissanayake, Зелёный, Ismael Feb 26 '18 at 3:50

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.

  • The miner that finds the block collects the fees. See also ethereum.stackexchange.com/questions/38992/… , ethereum.stackexchange.com/questions/36686/… , and ethereum.stackexchange.com/questions/13201/… – lungj Feb 25 '18 at 21:23
  • @lungj, I'm not asking about who mines the block but rather why do all nodes in the Ethereum network have to execute the smart contract? It seems like a waste of resources. If I ran a node and I wasn't getting paid for executing a smart contract, why would I want to waste power and money doing it? – Dave Feb 26 '18 at 23:52
  • @Dave - If you were running a full node, why do you think you would be running it? Presumably you have a reason to do so, otherwise you'd be relying on someone else's node for access to the network. If you have a reason for running it, then you also have a reason for ensuring the blocks you receive are valid. If you were working with invalid blocks, then any assumptions you make about the data integrity on your node are also invalid. So you need to execute the transactions to ensure they equate to valid state transitions. – Richard Horrocks Feb 28 '18 at 19:44
0

The miner who successfully mines the block collects the transaction fees.

  • Guess I'm still new at this and trying to figure stuff out but if only the miner who mines teh block collects fees what is the incentive for everyone to execute the smart contracst on their node if they're not even getting paid? – Dave Feb 26 '18 at 19:54
  • They do this to make sure the block that was mined is valid. If they don't do this, then they run the risk of working on an invalid blockchain. (Executing the code is a fairly trivial amount of computation.) – user19510 Feb 26 '18 at 20:03
0

All the miners execute the contracts and all the transactions also, creating a new block with a deterministic new state for the blockchain with a small difference: every miner set his own address as the receiving address of the fees and the block reward.

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