Home/Merkle Root

Merkle Root

Cryptographic fingerprint for all transactions in a Bitcoin block, preventing tampering.

Merkle RootCryptography

A merkle root is created by hashing together pairs of TXIDs to get a short and unique fingerprint for all the transactions in a block. This merkle root is placed in a block header to prevent the contents of the block from being tampered with later on.

Key Characteristics

Unique Fingerprint

Provides a unique identifier for all transactions in a block

Tamper Prevention

Prevents modification of block contents after creation

Efficient Verification

Allows quick verification of transaction inclusion

Block Header

Stored in the block header for space efficiency

How Merkle Root is Constructed

1. Transaction Hashes (TXIDs)

Each transaction in the block is hashed to create a unique TXID

2. Pairwise Hashing

TXIDs are paired and hashed together to create parent nodes

3. Tree Construction

Process continues recursively until a single root hash remains

4. Root Placement

Final root hash is placed in the block header

Security Properties

  • Immutability: Any change to transactions changes the root hash
  • Integrity: Verifies all transactions are present and unmodified
  • Efficiency: Single hash represents entire transaction set
  • Proof System: Enables Merkle proofs for transaction inclusion

Role in Bitcoin

The Merkle root is a critical component of Bitcoin's security model. It's included in every block header and is used in Bitcoin's proof-of-work consensus mechanism. Miners must include the correct Merkle root in their block headers, ensuring that all transactions in the block are accounted for and cannot be modified.

Role in RGB++

In RGB++, Merkle roots are used to verify Bitcoin transaction inclusion when validating UTXO operations on CKB. The SPV service provides Merkle proofs that reference the Merkle root in Bitcoin block headers, enabling trustless verification of Bitcoin transactions within RGB++ smart contracts.

External Resources