What exactly happens to leaves when forming nodes? 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?
Concatenation means the joining of the second sequence at the end of the first sequence. For example, with strings, the concatenation of &quot;hello, &quot; and &quot;world&quot; produces the string &quot;hello, world&quot;.
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.