2

This question already has an answer here:

One question about the inner working of the mining process: I know there isn't such a thing as a block 30% or 99% mined, or a mine is blocked or it isn't, I get it. The thing is: how do the transactions that belong to a block (that dole out transaction fees) get incorporated into the block after it has been found. Are these transactions being processed along with the mining and that's what the mining process is all about?

marked as duplicate by Stephen Gornick, dchapes, cdecker, Nick ODell, David Ogren Jul 9 '13 at 20:20

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.

3

The transactions are already there when you are mining. You are hashing the block header which contains a merkle tree root that connects the list of transactions and block header together.

After you hash a valid block header you can't add any transactions as it would change the merkle root and the hash would not be below the current target anymore, so the block becomes invalid. This is also the reason why you can't mine in a pool and take the coins yourself if you find a valid block. That would require changing the generation transaction, which changes the merkle root, and the block is then invalid.

Mining is both about generating new coins (they must come from somewhere) and processing transactions (we need a ledger that everyone can agree is the one true ledger).

  • so each share is a "branch" of this merkle tree that is always growing and joining the block header until the time someone hashes a valid block and then the process starts again with another Merkle tree? – Thiago Jul 4 '13 at 14:26
  • In pooled mining a share is a block which hash is below the target the server gave you. If a block is found/created then you start work on a new block where just about everything is different, and that includes the merkle tree. – Dr.Haribo Jul 4 '13 at 23:35

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