Post
Topic
Board Project Development
Re: how do miners fill merkle_root field when mining?
by
Meni Rosenfeld
on 01/06/2011, 18:28:35 UTC
The Bitcoin server, after deciding which transactions to include in the block, builds a Merkle tree of the transactions, probably using some standard library. The hash at the root is the merkle root.

Then after a transaction, the new merkle root generated and replace the old one
since the block header has changed, how can we verify the block?
You can't, this is the point, you can't add a new transaction to an already solved block. That's what guarantees their integrity.
If you're still trying to solve a block, when you add a new transaction, you start hashing the new block header with the new merkle root.