0

For each block of transactions, miners use computers to repeatedly and very quickly guess answers to a puzzle until one of them wins. [1]

[Q] In parallel to solving this puzzle, also does all the miners on the blockchain compute the output of the deployed transactions into them? or when the winners are decided, will only the winners compute the deployed transactions and generate their outputs?

Thank you for your valuable time and help.

[1] https://www.coindesk.com/information/ethereum-mining-works/

1

In parallel to solving this puzzle, also does all the miners on the blockchain compute the output of the deployed transactions into them?

Yes. But... When attempting to mine a new block, each miner can put whatever transactions they like into that block, as long as the output is valid. Generally the vanilla mining/client implementations prioritise transactions with a higher gas price, but miners don't have to follow this.

(See: What is the default ordering of transactions during mining, in e.g. geth?)

So each miner, working away on solving PoW, might be working on a block that contains completely different (though valid) transactions.

or when the winners are decided, will only the winners compute the deployed transactions and generate their outputs?

The winner's block is accepted by the rest of the miners, who then confirm that the state changes performed by the transactions in the winner's block are valid.

  • What does vanilla mining/client mean? As I understand all miners first compute their own transactions, and winner block is accepted by the rest of the miners and rest of the miners re-compute state changes in order to validate performed transactions by the winner block ? @Richard Horrocks – alper Nov 25 '17 at 13:46
  • 1
    A miner takes the pending transactions from the mining/transaction pool, which are transactions that belong to everyone on the network. The miner himself might also have submitted transactions to the network as well. If he prioritises his own transactions in the block he is trying to mine, then I think that counts as frontrunning. There's nothing to stop them doing this, but you could claim it's unethical, especially if a big powerful miner uses it to, for example, buy ICO tokens ahead of everyone else. – Richard Horrocks Nov 25 '17 at 13:59
  • 1
    The Geth code is the vanilla client code. (As long as you haven't changed the code yourself.) This code is used by the miners. (Either that, or one of the mining packages, like Ethminer?) In this code, the transactions with the highest gas price is taken from the transaction pool first. There's nothing in the code that would allow a miner to put their own transactions in a block ahead of other transactions. (Though I'm sure there are other implementations out there that would let them do this.) – Richard Horrocks Nov 25 '17 at 14:02
  • 1
    Yes, miners select transactions from the pool. When the winner mines a block, his selection has to be accepted by the whole network. The blocks that the other miners were trying to mine are discarded. Their discarded blocks may or may not have contained the same transactions as the winner's block, depending on how they had selected the transactions. – Richard Horrocks Nov 25 '17 at 15:23
  • 1
    Good question. I don't think it actually runs all the transactions again, but I think it makes sure the state data is consistent with itself. (I'm not sure of the underlying mechanism it uses to do that.) So yes, it validates the state data, but I don't think it has to re-run all the transactions to do that. – Richard Horrocks Nov 25 '17 at 20:32
1

All nodes on the network compute the state using all mined transactions to verify blocks

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.