<p>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.</p>

<p>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.</p>

<p>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).</p>

CC BY-SA 3.0
2013-07-04T14:26:56.040Z
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
CC BY-SA 3.0
2013-07-04T23:35:15.303Z
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
CC BY-SA 3.0
2013-07-03T18:50:21.183Z
2013-07-03T18:50:21.183Z
Dr.Haribo
<p>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?</p>

<transactions><blockchain><mining-technical-details><merkle-tree>
How do transactions fit into mining?
Thiago
# How do transactions fit into mining?

(Asked by: username_0 on 2013-07-03)

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?

**Tags:** transactions, blockchain, mining-technical-details, merkle-tree


---

## 1 answers

### Answer by username_1 on 2013-07-03. Score: 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).

> **Comments:**
> **username_0**: 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?  
> **username_1**: 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.  

---

