Merkle Root

Merkle Root Hash of all the transactions in a block.

The Merkle Root is a field in the block header. It provides a fingerprint for all the transactions included in the block.

How do you get a merkle root?

By repeatedly hashing together pairs of Transaction IDs until you end up with a single hash as a result.


  1. Take each pair of Transaction IDs from the block, and hash them together through SHA256 twice.
  2. Keep doing this for each pair Transaction IDs, until you end up with a new list of hashes.
    • Note: If you have an odd number of transactions, hash the remaining transaction with itself.
  3. Repeat steps 1-2 for every new list of hashes you create until you finally end up with one hash.

The structure is called a merkle tree, and the result is referred to as the root.

Why does bitcoin use the merkle root method?

Or in other words...

Question: Why the hell wouldn't you just hash all of the transaction IDs in one go? Why use this more complicated method of hashing pairs together? What's the matter with you?

Answer: Because if you want to check that a transaction is part of the final hash, a merkle root is a more efficient way of doing it, sir.

You see, if you hash all of the transactions in one go, when it comes to checking if a transaction ID was used to make that hash, you're going to need all of the transaction IDs to get the same result. And if there are 1000 or so transactions in that block, that's a hefty amount of data you need for a simple check.

But with a merkle tree, you can do the same check, but you'll only need a specific set of hashes across the branches of the tree to form the final hash.

So whilst merkle trees take a little more effort in the beginning, they save energy when it comes to verification later on.

Why is it called a "merkle" root?

Because the crytography guy who patented the concept happens to be called Ralph Merkle.

Close enough.


By Greg Walker,

Last Updated: 25 Nov 2018
  • 25 Nov 2018: Subtitles for pages in Glossary. Looks good.
  • 20 Mar 2018: CSS - Separated mobile CSS in to its own file, and changed all em to px
  • 28 Feb 2017: - added xlinks
  • 26 Feb 2017: - edited
  • 03 Jan 2017: Fixed broken HTML when using pandoc.
  • 01 Jan 2017: Moved /manual/guide/ and /manual/reference/ to /guide/ and /glossary/

Hey there, it's Greg.

I'll let you know if something seriously interesting happens in bitcoin.

Don't worry, it doesn't happen very often.