Bitcoin Forum
May 10, 2024, 10:59:40 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: would a merkle root collision cause a network split  (Read 883 times)
jonald_fyookball (OP)
Legendary
*
Offline Offline

Activity: 1302
Merit: 1004


Core dev leaves me neg feedback #abuse #political


View Profile
April 24, 2017, 08:21:58 PM
 #1

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?


1715381980
Hero Member
*
Offline Offline

Posts: 1715381980

View Profile Personal Message (Offline)

Ignore
1715381980
Reply with quote  #2

1715381980
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715381980
Hero Member
*
Offline Offline

Posts: 1715381980

View Profile Personal Message (Offline)

Ignore
1715381980
Reply with quote  #2

1715381980
Report to moderator
1715381980
Hero Member
*
Offline Offline

Posts: 1715381980

View Profile Personal Message (Offline)

Ignore
1715381980
Reply with quote  #2

1715381980
Report to moderator
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6635


Just writing some code


View Profile WWW
April 24, 2017, 08:46:54 PM
Merited by ABCbits (2)
 #2

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.

DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4653



View Profile
April 24, 2017, 08:47:31 PM
 #3

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.
jonald_fyookball (OP)
Legendary
*
Offline Offline

Activity: 1302
Merit: 1004


Core dev leaves me neg feedback #abuse #political


View Profile
April 24, 2017, 09:02:34 PM
Last edit: April 24, 2017, 09:25:44 PM by jonald_fyookball
 #4

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.

DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4653



View Profile
April 25, 2017, 12:25:50 AM
 #5

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.

jonald_fyookball (OP)
Legendary
*
Offline Offline

Activity: 1302
Merit: 1004


Core dev leaves me neg feedback #abuse #political


View Profile
April 25, 2017, 01:00:52 AM
 #6

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?

achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6635


Just writing some code


View Profile WWW
April 25, 2017, 01:08:33 AM
 #7

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.

jonald_fyookball (OP)
Legendary
*
Offline Offline

Activity: 1302
Merit: 1004


Core dev leaves me neg feedback #abuse #political


View Profile
April 25, 2017, 01:50:21 AM
 #8

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

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!