BattleZips
  • Awesome Circom
  • 🔬Theory
    • Prerequisite Knowledge
    • Resources
      • White Papers & PDF's
      • Blogs and Writeups
      • Videos
      • Important Entities
      • Communities
    • Proving Schemes
    • Primitives
      • Hash Functions
      • Public Key Cryptosystems
        • Note on L1 key registry → L2 hot key + callback to circuit-optimized hash functions
        • ECDSA & secp256k1
        • EdDSA
      • Merkle Trees
        • What is a Merkle Tree?
        • What is a merkle proof of inclusion?
        • zk-kit
        • Incremental Merkle Trees
        • Sparse Merkle Trees
        • Tree Arity (Binary, Quinary)
      • Semaphore
      • Arithmetic Circuits
  • 🏗️Development
    • Circom Language
      • Installation
      • IDE
      • Signals and Variables
      • Signal Assignment and Constraint Generation
      • Conditional Statements
      • Components and Templates
      • Circuit Compilation
      • Syntax
    • SnarkJS
      • Proving Schemes
      • Powers of Tau
      • ZK Keys
      • Zero Knowledge Proofs
      • On-Chain ZKP
      • Page 2
    • circomlib
      • Basic Math Constraints
      • Multiplexing
      • Hashing
      • EdDSA
      • circomlibjs
    • circom-tester
    • hardhat-circom
    • SHIELD
    • Circomspect
  • 🌆Ecosystem
    • Circom vs Other Solutions
      • Domain-Specific Languages
      • ZK Virtual Machines
      • ZK Ethereum Virtual Machines
    • Communities to Join
    • Recorded Content
    • Projects
  • 🛳️Examples
    • BattleZips V1
      • On the BattleZips Project
      • Docs holder
        • Join Game UML Sequence Diagram
        • Play Game UML Sequence Diagram
        • End Game UML Sequence Diagram
      • ZK Privacy Stack
      • Deploying Artifacts to Prod
      • Browser Client
    • RollupNC
      • Smart Contracts
      • Account/ State Tree
      • Transaction Tree
      • Layer 1 Deposits to Layer 2
      • Layer 2 Transacting
      • Layer 2 Withdrawals to Layer 1
Powered by GitBook
On this page
  • I have a Merkle Tree but what do I do with it?
  • Reinvent the wheel (Merkle Root)
  1. Theory
  2. Primitives
  3. Merkle Trees

What is a merkle proof of inclusion?

PreviousWhat is a Merkle Tree?Nextzk-kit

Last updated 2 years ago

I have a Merkle Tree but what do I do with it?

As described in the previous section a Merkle Tree provides an efficient way to verify the integrity of a set of data as well as see whether or not a certain piece of data is included within. How exactly is this done though? This section will explain in detail how once can prove that tree contains a piece of data pertaining to them.

Reinvent the wheel (Merkle Root)

Let's say that you have a Merkle Tree containing a set up numbers and you'd like to prove that your number (64) is contained within. To do this you will want to reconstruct the merkle root as it represents the highest level of the data set and is representative of all values below it. That may seem like quite the challenge at first but it is actually quite simple. All that needs to be provided is the value you wish to prove inclusion for and all the sibling leafs up to the root.

Your number is 64 and you need to prove it is contained within the tree

When all of that data has been provided then we can begin reconstructing the root. To do so we traverse up the tree. We start by hashing the value you have provided and then hashing that value with the sibling leaf. That operation produces the parent and then the resultant hash for the parent is hashed with the next sibling leaf provided. This process will repeat n times where n is the depth of the tree.

Once the tree has been traversed to the top you will now have the computed root. All that needs to be determined is that it is equivalent to the existing root. If it is then one can know for certain that your data is contained within the tree!

🔬