0

some newbie question's in here: To solve the miner's problem in PoW (on both Bitcoin's and Ethereum's blockchains), miners should generate a hash that meets some of the conditions (for example, starts with 0000) and contains the previous hash and all the transactions information in the block. If a miner finds a solution to a problem, how would he put all the transaction info in the block? Or with each transaction that appears, he's required to search for critical conditions with previous hash and updated transactions all over again? So, with each new transaction, nonce would be different?

Sorry for such a wordy question, and thanks in advance.

1 Answer 1

0

The order is different :

  1. A miner selects a set of pending transactions and bundle them into a blank new block (that I will call block_n).

  2. block_n reference to the previous bock hash is set to the hash of block_n-1, thus linking block_n to block_n-1.

  3. block_n nonce is initialized (in go ethereum it is initialized from a random seed)

  4. The hash of block_n (containing : transactions, previous block hash and nonce) is computed.

  5. If the hash matches the difficulty it can be broadcast, otherwise go back to 3) and update the nonce.

The order must be that way because with yours, I could pre mine lots of blocks and add the transactions after. With the order that I described to you, you must first add transactions and then compute a hash for this specific block. That is for the block_n referencing block_n-1 hash AND containing this specific set of transactions.

While step 1) and 2) could be reversed, 3) 4) and 5) must be in that order. In short, transaction selection is, and must be before hash computation.

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.