Question about identical txids/merkle tree in Developer guide

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












I am new to the technical details about Bitcoin and has been reading Developer guide on bitcoin.org. I have a question about below contents mentioning merkle tree, identical txids.



I googled and searched here but seemed to be no answer.




Note: If identical txids are found within the same block, there is a possibility that the merkle tree may collide with a block with some or all duplicates removed due to how unbalanced merkle trees are implemented (duplicating the lone hash). Since it is impractical to have separate transactions with identical txids, this does not impose a burden on honest software, but must be checked if the invalid status of a block is to be cached; otherwise, a valid block with the duplicates eliminated could have the same merkle root and block hash, but be rejected by the cached invalid outcome, resulting in security bugs such as CVE-2012-2459.




I don't quite understand above contents. How would a merkle tree collide with a block? What do "collide" and “eliminate duplicates" mean ? identical txids either mean same transactions or duplicate txid in order to generate a merkle root. What does "cache the invalid status of a block" stand for ? How would this be rejected by the cached invalid outcome?



I would appreciate it if you could help me understand. Thanks!







share|improve this question


























    up vote
    3
    down vote

    favorite












    I am new to the technical details about Bitcoin and has been reading Developer guide on bitcoin.org. I have a question about below contents mentioning merkle tree, identical txids.



    I googled and searched here but seemed to be no answer.




    Note: If identical txids are found within the same block, there is a possibility that the merkle tree may collide with a block with some or all duplicates removed due to how unbalanced merkle trees are implemented (duplicating the lone hash). Since it is impractical to have separate transactions with identical txids, this does not impose a burden on honest software, but must be checked if the invalid status of a block is to be cached; otherwise, a valid block with the duplicates eliminated could have the same merkle root and block hash, but be rejected by the cached invalid outcome, resulting in security bugs such as CVE-2012-2459.




    I don't quite understand above contents. How would a merkle tree collide with a block? What do "collide" and “eliminate duplicates" mean ? identical txids either mean same transactions or duplicate txid in order to generate a merkle root. What does "cache the invalid status of a block" stand for ? How would this be rejected by the cached invalid outcome?



    I would appreciate it if you could help me understand. Thanks!







    share|improve this question
























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      I am new to the technical details about Bitcoin and has been reading Developer guide on bitcoin.org. I have a question about below contents mentioning merkle tree, identical txids.



      I googled and searched here but seemed to be no answer.




      Note: If identical txids are found within the same block, there is a possibility that the merkle tree may collide with a block with some or all duplicates removed due to how unbalanced merkle trees are implemented (duplicating the lone hash). Since it is impractical to have separate transactions with identical txids, this does not impose a burden on honest software, but must be checked if the invalid status of a block is to be cached; otherwise, a valid block with the duplicates eliminated could have the same merkle root and block hash, but be rejected by the cached invalid outcome, resulting in security bugs such as CVE-2012-2459.




      I don't quite understand above contents. How would a merkle tree collide with a block? What do "collide" and “eliminate duplicates" mean ? identical txids either mean same transactions or duplicate txid in order to generate a merkle root. What does "cache the invalid status of a block" stand for ? How would this be rejected by the cached invalid outcome?



      I would appreciate it if you could help me understand. Thanks!







      share|improve this question














      I am new to the technical details about Bitcoin and has been reading Developer guide on bitcoin.org. I have a question about below contents mentioning merkle tree, identical txids.



      I googled and searched here but seemed to be no answer.




      Note: If identical txids are found within the same block, there is a possibility that the merkle tree may collide with a block with some or all duplicates removed due to how unbalanced merkle trees are implemented (duplicating the lone hash). Since it is impractical to have separate transactions with identical txids, this does not impose a burden on honest software, but must be checked if the invalid status of a block is to be cached; otherwise, a valid block with the duplicates eliminated could have the same merkle root and block hash, but be rejected by the cached invalid outcome, resulting in security bugs such as CVE-2012-2459.




      I don't quite understand above contents. How would a merkle tree collide with a block? What do "collide" and “eliminate duplicates" mean ? identical txids either mean same transactions or duplicate txid in order to generate a merkle root. What does "cache the invalid status of a block" stand for ? How would this be rejected by the cached invalid outcome?



      I would appreciate it if you could help me understand. Thanks!









      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 22 at 7:46









      Raghav Sood

      5,0891826




      5,0891826










      asked Aug 22 at 7:00









      Olivia Zhang

      161




      161




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote













          It refers to a (practically impossible) edge case due to how unbalanced merkle trees work.



          Let's say you manage to find two transactions with the same transaction ID, T1 and T2.



          Now, let's build the merkle tree for a very simple block:



           H(A, B)
          /
          A = H(CB,X) B = H(T1,T2)
          / /
          CB X T1 T2


          Now, if you were to build the same merkle tree without T2, you have an unbalanced tree with only 3 leaves. To fix this, the last leaf is duplicated, as such:



           H(A, B)
          /
          A = H(CB,X) B = H(T1,T1)
          / /
          CB X T1 T1


          However, since T1 and T2 share a transaction hash, your merkle root actually ends up being identical to the tree with two separate transactions.



          Since the merkle root is the same, the proof of work for a block containing T1 and T2 would also be valid for a block containing only T1.



          Thus, if the first block is considered invalid by an honest node, when it sees a second block arrive with the same block header, it may dismiss it as invalid automatically based on the cached status on the original block's header, even though the second block does not contain T2, and is in effect a different, potentially valid, block.






          share|improve this answer
















          • 1




            Thanks for your explanation! It is well-explained and does help me understand :)
            – Olivia Zhang
            Aug 22 at 7:35










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "308"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fbitcoin.stackexchange.com%2fquestions%2f78486%2fquestion-about-identical-txids-merkle-tree-in-developer-guide%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote













          It refers to a (practically impossible) edge case due to how unbalanced merkle trees work.



          Let's say you manage to find two transactions with the same transaction ID, T1 and T2.



          Now, let's build the merkle tree for a very simple block:



           H(A, B)
          /
          A = H(CB,X) B = H(T1,T2)
          / /
          CB X T1 T2


          Now, if you were to build the same merkle tree without T2, you have an unbalanced tree with only 3 leaves. To fix this, the last leaf is duplicated, as such:



           H(A, B)
          /
          A = H(CB,X) B = H(T1,T1)
          / /
          CB X T1 T1


          However, since T1 and T2 share a transaction hash, your merkle root actually ends up being identical to the tree with two separate transactions.



          Since the merkle root is the same, the proof of work for a block containing T1 and T2 would also be valid for a block containing only T1.



          Thus, if the first block is considered invalid by an honest node, when it sees a second block arrive with the same block header, it may dismiss it as invalid automatically based on the cached status on the original block's header, even though the second block does not contain T2, and is in effect a different, potentially valid, block.






          share|improve this answer
















          • 1




            Thanks for your explanation! It is well-explained and does help me understand :)
            – Olivia Zhang
            Aug 22 at 7:35














          up vote
          2
          down vote













          It refers to a (practically impossible) edge case due to how unbalanced merkle trees work.



          Let's say you manage to find two transactions with the same transaction ID, T1 and T2.



          Now, let's build the merkle tree for a very simple block:



           H(A, B)
          /
          A = H(CB,X) B = H(T1,T2)
          / /
          CB X T1 T2


          Now, if you were to build the same merkle tree without T2, you have an unbalanced tree with only 3 leaves. To fix this, the last leaf is duplicated, as such:



           H(A, B)
          /
          A = H(CB,X) B = H(T1,T1)
          / /
          CB X T1 T1


          However, since T1 and T2 share a transaction hash, your merkle root actually ends up being identical to the tree with two separate transactions.



          Since the merkle root is the same, the proof of work for a block containing T1 and T2 would also be valid for a block containing only T1.



          Thus, if the first block is considered invalid by an honest node, when it sees a second block arrive with the same block header, it may dismiss it as invalid automatically based on the cached status on the original block's header, even though the second block does not contain T2, and is in effect a different, potentially valid, block.






          share|improve this answer
















          • 1




            Thanks for your explanation! It is well-explained and does help me understand :)
            – Olivia Zhang
            Aug 22 at 7:35












          up vote
          2
          down vote










          up vote
          2
          down vote









          It refers to a (practically impossible) edge case due to how unbalanced merkle trees work.



          Let's say you manage to find two transactions with the same transaction ID, T1 and T2.



          Now, let's build the merkle tree for a very simple block:



           H(A, B)
          /
          A = H(CB,X) B = H(T1,T2)
          / /
          CB X T1 T2


          Now, if you were to build the same merkle tree without T2, you have an unbalanced tree with only 3 leaves. To fix this, the last leaf is duplicated, as such:



           H(A, B)
          /
          A = H(CB,X) B = H(T1,T1)
          / /
          CB X T1 T1


          However, since T1 and T2 share a transaction hash, your merkle root actually ends up being identical to the tree with two separate transactions.



          Since the merkle root is the same, the proof of work for a block containing T1 and T2 would also be valid for a block containing only T1.



          Thus, if the first block is considered invalid by an honest node, when it sees a second block arrive with the same block header, it may dismiss it as invalid automatically based on the cached status on the original block's header, even though the second block does not contain T2, and is in effect a different, potentially valid, block.






          share|improve this answer












          It refers to a (practically impossible) edge case due to how unbalanced merkle trees work.



          Let's say you manage to find two transactions with the same transaction ID, T1 and T2.



          Now, let's build the merkle tree for a very simple block:



           H(A, B)
          /
          A = H(CB,X) B = H(T1,T2)
          / /
          CB X T1 T2


          Now, if you were to build the same merkle tree without T2, you have an unbalanced tree with only 3 leaves. To fix this, the last leaf is duplicated, as such:



           H(A, B)
          /
          A = H(CB,X) B = H(T1,T1)
          / /
          CB X T1 T1


          However, since T1 and T2 share a transaction hash, your merkle root actually ends up being identical to the tree with two separate transactions.



          Since the merkle root is the same, the proof of work for a block containing T1 and T2 would also be valid for a block containing only T1.



          Thus, if the first block is considered invalid by an honest node, when it sees a second block arrive with the same block header, it may dismiss it as invalid automatically based on the cached status on the original block's header, even though the second block does not contain T2, and is in effect a different, potentially valid, block.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 22 at 7:18









          Raghav Sood

          5,0891826




          5,0891826







          • 1




            Thanks for your explanation! It is well-explained and does help me understand :)
            – Olivia Zhang
            Aug 22 at 7:35












          • 1




            Thanks for your explanation! It is well-explained and does help me understand :)
            – Olivia Zhang
            Aug 22 at 7:35







          1




          1




          Thanks for your explanation! It is well-explained and does help me understand :)
          – Olivia Zhang
          Aug 22 at 7:35




          Thanks for your explanation! It is well-explained and does help me understand :)
          – Olivia Zhang
          Aug 22 at 7:35












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fbitcoin.stackexchange.com%2fquestions%2f78486%2fquestion-about-identical-txids-merkle-tree-in-developer-guide%23new-answer', 'question_page');

          );

          Post as a guest













































































          這個網誌中的熱門文章

          How to combine Bézier curves to a surface?

          Mutual Information Always Non-negative

          Why am i infinitely getting the same tweet with the Twitter Search API?