Author

Topic: would a merkle root collision cause a network split (Read 907 times)

legendary
Activity: 1302
Merit: 1008
Core dev leaves me neg feedback #abuse #political
i thought the merkle root was the hash of all the hashes in the merkle tree. this is not the block header hash?
The merkle tree consists of all of the transactions in the block. The merkle root is only one part of the block header though. There is a version number, the previous block hash, the time stamp, the bits (target), and the nonce in addition to the merkle root which forms the block header. All of those things are then hashed to get the block hash. The merkle root itself is not the block hash.

ty
staff
Activity: 3458
Merit: 6793
Just writing some code
i thought the merkle root was the hash of all the hashes in the merkle tree. this is not the block header hash?
The merkle tree consists of all of the transactions in the block. The merkle root is only one part of the block header though. There is a version number, the previous block hash, the time stamp, the bits (target), and the nonce in addition to the merkle root which forms the block header. All of those things are then hashed to get the block hash. The merkle root itself is not the block hash.
legendary
Activity: 1302
Merit: 1008
Core dev leaves me neg feedback #abuse #political
I would think that BLOCK_A+1 would be compatible with the chain using BLOCK_B , since they have the same hash and you can chain the blocks together.

The scenario that you presented was identical merkle root, not identical block header hash.
 



i thought the merkle root was the hash of all the hashes in the merkle tree.  this is not the block header hash?
legendary
Activity: 3472
Merit: 4801
I would think that BLOCK_A+1 would be compatible with the chain using BLOCK_B , since they have the same hash and you can chain the blocks together.

The scenario that you presented was identical merkle root, not identical block header hash.

With identical merkle root, the block header hashes are still likely to be different. (unless both miners/pools chose to set the exact same timestamp, AND chose the exact same nonce, AND the exact same version number).

If you had asked about two different blocks whose headers hash to the exact same value, then you are correct, they shouldn't diverge until someone tries to spend an output from one of the blocks that doesn't exist in the other.

legendary
Activity: 1302
Merit: 1008
Core dev leaves me neg feedback #abuse #political
For the sake of conversation and distinguishing the two blocks, lets label them BLOCK_A and BLOCK_B

The fact that the merkle roots are identical between BLOCK_A and BLOCK_B would not have any effect on the behavior.  It would continue the same as any other time that two miners solve a block at nearly the same time. Specifically:

The portion of the network that received BLOCK_A first would add BLOCK_A to their blockchain.  When they received BLOCK_B, they would not add it to their blockchain since they already have a chain of that height.

The portion of the network that received BLOCK_B first would add BLOCK_B to their blockchain.  When they received BLOCK_A, they would not add it to their blockchain since they already have a chain of that height.

Then the miners that accepted BLOCK_A would begin working on the next block at height BLOCK_A + 1
Meanwhile, the miners that accepted BLOCK_B would begin working on the next block at height BLOCK_B + 1

As soon as one of these miners solved a block, they would broadcast it.  Lets assume for a moment that it is a miner that was building on top of BLOCK _A.

Since BLOCK_A and BLOCK_B are both at the same height, this new block would make a longer chain.  All the nodes that had previously accepted BLOCK_A would simply add this new block to their chain after BLOCK_A.  All the nodes that had previously accepted BLOCK_B would abandon (orhpan) BLOCK_B and accept the new longest chain BLOCK_A and BLOCK_A+1.  The network would converge on this new chain.

I would think that BLOCK_A+1 would be compatible with the chain using BLOCK_B , since they have the same hash and you can chain the blocks together.  So therefore, when BLOCK_A+1 comes out and is broadcast, you now have:

chain:  BLOCK_A -> BLOCK_A+1
chain:  BLOCK_B _> BLOCK_A+1

they would only start diverging if the TXO wouldnt validate, but that may or may not happen on the next block.   Maybe I just answered my own question.
legendary
Activity: 3472
Merit: 4801
For the sake of conversation and distinguishing the two blocks, lets label them BLOCK_A and BLOCK_B

The fact that the merkle roots are identical between BLOCK_A and BLOCK_B would not have any effect on the behavior.  It would continue the same as any other time that two miners solve a block at nearly the same time. Specifically:

The portion of the network that received BLOCK_A first would add BLOCK_A to their blockchain.  When they received BLOCK_B, they would not add it to their blockchain since they already have a chain of that height.

The portion of the network that received BLOCK_B first would add BLOCK_B to their blockchain.  When they received BLOCK_A, they would not add it to their blockchain since they already have a chain of that height.

Then the miners that accepted BLOCK_A would begin working on the next block at height BLOCK_A + 1
Meanwhile, the miners that accepted BLOCK_B would begin working on the next block at height BLOCK_B + 1

As soon as one of these miners solved a block, they would broadcast it.  Lets assume for a moment that it is a miner that was building on top of BLOCK _A.

Since BLOCK_A and BLOCK_B are both at the same height, this new block would make a longer chain.  All the nodes that had previously accepted BLOCK_A would simply add this new block to their chain after BLOCK_A.  All the nodes that had previously accepted BLOCK_B would abandon (orhpan) BLOCK_B and accept the new longest chain BLOCK_A and BLOCK_A+1.  The network would converge on this new chain.
staff
Activity: 3458
Merit: 6793
Just writing some code
Both chains? I don't think there would be a chain split. In the case of just a merkle root collision (i.e. block hashes are different due to timestamp or nonce) the blocks with the collided merkle root are just two valid blocks and you just have the normal orphan race.

If you are talking about two block hashes colliding, that's an entirely different and more complex matter.
legendary
Activity: 1302
Merit: 1008
Core dev leaves me neg feedback #abuse #political
in the astronomically unlikely event that 2 different miners produced 2 different blocks at the same time that had the same merkle root,  then i assume new block "A" could go on both chains. etc

Would the network split because of this or would one chain become longer?

Jump to: