If you hash TXIDs with sha256 twice, you get the leaves of the merkle tree. As far as I understand the two outputs of the TXIDs are concatenated / paired. What does that mean? Are they added together?

1 Answer 1


Concatenation means the joining of the second sequence at the end of the first sequence. For example, with strings, the concatenation of "hello, " and "world" produces the string "hello, world".

For TXIDs, they are taken as a 32-byte array. The concatenation of the two TXIDs produces an array of 64 bytes, which then becomes the input for another round of double SHA256. The resulting hash becomes the parent hash of the two TXIDs in the Merkle tree.

Each pair of transactions is hashed in such way, and if the number of transactions is odd, the last TXID in the sequence is duplicated (concatenated with itself). The parent hashes are then recursively treated in the same way, concatenated pairwise, until a single hash remains, which is the Merkle root.

  • So for example: TXID1:ee475443f1fbfff84ffba43ba092a70d291df233bd1428f3d09f7bd1a6054a1f TXID2:e03a9a4b5c557f6ee3400a29ff1475d1df73e9cddb48c2391abdc391d8c1504a would become ee475443f1fbfff84ffba43ba092a70d291df233bd1428f3d09f7bd1a6054a1fe03a9a4b5c557f6ee3400a29ff1475d1df73e9cddb48c2391abdc391d8c1504a and then hashed twice to form a leaf?
    – user116823
    Apr 1, 2021 at 15:19
  • 1
    The TXIDs are the leaves. The resulting hash forms a tree branch.
    – Mark H
    Apr 1, 2021 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy