<p>For every new block there is a new Merkle tree of transactions. Once the block is included in the blockchain the Merkle tree (and hence the Merkle root) for that block is not changed. In your example, if you are a miner trying to mine a block you can choose to continue with transactions A, B, C and D or form a new Merkle tree with A, B, C, D, E, F, G and H. The larger the transaction fees on E, F, G and H the more likely the miner will switch from trying to mine a block with A, B, C and D to trying to mine a block with A, B, C, D, E, F, G and H.</p>

<p>The key point here is that Merkle trees of transactions cannot be changed once included in the global blockchain but prior to that they can be changed locally as frequently as you wish.</p>

CC BY-SA 4.0
2019-08-24T12:42:16.583Z
2019-08-24T12:42:16.583Z
Michael Folkson
<p>Merkle root is block specific, so each block has a different merkle root. If transactions A-H belong to the same block, then you will have to calculate the merkle root using all the transactions from A-H, if not you will have merkle root containing transaction A-D in Block N and merkle root containing transactions E-H in block N+1.</p>

<p>Blocks commit to the previous block using <code>previousblockhash</code>, which is the double SHA-256 hash of the header of the previous block. Header of a block includes merkle root, previous block hash, timestamp amongst other fields. So by using the hash of the previous block's header in the current block's header you are in essence indirectly committing to the transactions that were included in the previous block thus forming a chain.</p>

CC BY-SA 4.0
2019-08-24T14:48:26.187Z
It means that if we collect some transactions at some time, let say  T(1) than Merkle root based on these transactions. After some time let say T(2) if we collect some other transaction then Merkle root based on The transactions  which we collect at time T(2). Previous transactions are not included in the current Merkle tree to get the Merkle root value.
Sanjeev Dwivedi
CC BY-SA 4.0
2019-08-24T17:02:30.783Z
@SanjeevDwivedi Yes that is correct, if you meant transactions in a block. There are unconfirmed transactions that are not included in the blocks (fee used may be low etc.) that will not form the part of the merkle root in any block. The merkle root does not contain transactions from previous blocks. But the use of previous block header hash in the header of the current block indirectly commits to the transactions in the previous block.
Ugam Kamat
CC BY-SA 4.0
2019-08-24T09:57:27.483Z
2019-08-24T12:04:36.730Z
2019-08-24T12:04:36.730Z
Ugam Kamat
<p>The blockchain is the mechanism for Bitcoin to converge on one shared state. Participants submit payment orders in the form of unconfirmed transactions to the network from which miners then select a set of transactions into their block candidates. The Merkle root hereby represents a commitment to one specific list of previously unconfirmed, valid transactions. When a new block gets authored, all network participants validate the block and then adopt the new set of balances as the current network state. </p>

<p>Beside the Merkle root as a commitment to this block's transactions, the block header also commits to exactly one preceding block as its parent by including the hash of that predecessor block. As the predecessor in turn committed to it's own predecessor, a new block therefore inductively commits to the full history since the Genesis Block.</p>

<p>Given that each preceding block in turn contains a Merkle root with which it committed to its own set of transactions, any new block also commits indirectly to the full history of all transactions.</p>

<p>Coming back to your example, this means that if Block#1 committed to <code>{A, B, C, D}</code>, the Merkle root in Block#2 would only commit to <code>{E, F, G, H}</code>. However, Block#2 commits to <code>{A, B, C, D}</code> indirectly by declaring Block#1 it's predecessor.</p>

CC BY-SA 4.0
2019-08-24T15:05:31.267Z
Thanks for this valuable information. It is really helpful for me.
Sanjeev Dwivedi
CC BY-SA 4.0
2019-08-24T14:36:58.680Z
2019-08-24T14:36:58.680Z
Murch
<p>Every block in a blockchain contains merkle root value. So for any block, there is some list of transactions and you create a merkle tree based on these transaction.
For other blocks, same process will repeated.</p>

<p>My question is:
Let us assume that A, B,C,D are transactions and we create a merkle tree and we add the merkle root in block. Now later we got the transactions E,F,G,H so:</p>

<ol>
<li>whether merkle tree is based on E,F,G,H only</li>
<li>or it is based on A,B,C,D,E,F,G,H .</li>
</ol>

<p>I want to know that for some block, we created a merkle root value based on A,B,C,D. For others block whether we include previous transaction with new transactions  and create a merkle tree. Or with only new transactions, merkle tree is created.</p>

<transactions><blockchain><merkle-tree>
Does merkle root contain hashes of transactions from previous blocks?
Sanjeev Dwivedi
# Does merkle root contain hashes of transactions from previous blocks?

(Asked by: username_0 on 2019-08-24)

Every block in a blockchain contains merkle root value. So for any block, there is some list of transactions and you create a merkle tree based on these transaction.
For other blocks, same process will repeated.

My question is:
Let us assume that A, B,C,D are transactions and we create a merkle tree and we add the merkle root in block. Now later we got the transactions E,F,G,H so:

1. whether merkle tree is based on E,F,G,H only
2. or it is based on A,B,C,D,E,F,G,H .

I want to know that for some block, we created a merkle root value based on A,B,C,D. For others block whether we include previous transaction with new transactions and create a merkle tree. Or with only new transactions, merkle tree is created.

**Tags:** transactions, blockchain, merkle-tree


---

## 3 answers

### Answer by username_3 on 2019-08-24. Score: 3 | Accepted answer

The blockchain is the mechanism for Bitcoin to converge on one shared state. Participants submit payment orders in the form of unconfirmed transactions to the network from which miners then select a set of transactions into their block candidates. The Merkle root hereby represents a commitment to one specific list of previously unconfirmed, valid transactions. When a new block gets authored, all network participants validate the block and then adopt the new set of balances as the current network state.

Beside the Merkle root as a commitment to this block's transactions, the block header also commits to exactly one preceding block as its parent by including the hash of that predecessor block. As the predecessor in turn committed to it's own predecessor, a new block therefore inductively commits to the full history since the Genesis Block.

Given that each preceding block in turn contains a Merkle root with which it committed to its own set of transactions, any new block also commits indirectly to the full history of all transactions.

Coming back to your example, this means that if Block#1 committed to `{A, B, C, D}`, the Merkle root in Block#2 would only commit to `{E, F, G, H}`. However, Block#2 commits to `{A, B, C, D}` indirectly by declaring Block#1 it's predecessor.

> **Comments:**
> **username_0**: Thanks for this valuable information. It is really helpful for me.  

---

### Answer by username_1 on 2019-08-24. Score: 1

For every new block there is a new Merkle tree of transactions. Once the block is included in the blockchain the Merkle tree (and hence the Merkle root) for that block is not changed. In your example, if you are a miner trying to mine a block you can choose to continue with transactions A, B, C and D or form a new Merkle tree with A, B, C, D, E, F, G and H. The larger the transaction fees on E, F, G and H the more likely the miner will switch from trying to mine a block with A, B, C and D to trying to mine a block with A, B, C, D, E, F, G and H.

The key point here is that Merkle trees of transactions cannot be changed once included in the global blockchain but prior to that they can be changed locally as frequently as you wish.


---

### Answer by username_2 on 2019-08-24. Score: 1

Merkle root is block specific, so each block has a different merkle root. If transactions A-H belong to the same block, then you will have to calculate the merkle root using all the transactions from A-H, if not you will have merkle root containing transaction A-D in Block N and merkle root containing transactions E-H in block N+1.

Blocks commit to the previous block using `previousblockhash`, which is the double SHA-256 hash of the header of the previous block. Header of a block includes merkle root, previous block hash, timestamp amongst other fields. So by using the hash of the previous block's header in the current block's header you are in essence indirectly committing to the transactions that were included in the previous block thus forming a chain.

> **Comments:**
> **username_0**: It means that if we collect some transactions at some time, let say  T(1) than Merkle root based on these transactions. After some time let say T(2) if we collect some other transaction then Merkle root based on The transactions  which we collect at time T(2). Previous transactions are not included in the current Merkle tree to get the Merkle root value.  
> **username_2**: @username_0 Yes that is correct, if you meant transactions in a block. There are unconfirmed transactions that are not included in the blocks (fee used may be low etc.) that will not form the part of the merkle root in any block. The merkle root does not contain transactions from previous blocks. But the use of previous block header hash in the header of the current block indirectly commits to the transactions in the previous block.  

---

