Build Merkle Tree
Free to download on every platform. Comes pre-installed on BotFone, BotPad and BotFlip — with extra free apps included.
About this app
WHAT IT DOES
Build Merkle Tree enables you to construct cryptographic Merkle trees from a list of leaf data, generating the Merkle root and inclusion proofs for any leaf. Merkle trees are binary hash trees that allow efficient and secure verification of whether a specific piece of data belongs to a larger set, using only a small proof path. This is fundamental to many blockchain applications including: airdrop claims, token whitelists, state commitments, transaction batching, and fraud proofs. The tool takes your list of leaf data (addresses, amounts, or arbitrary strings), supports both Keccak-256 (Ethereum standard) and SHA-3-256 hash algorithms, lets you specify the data format as text or hex, and builds the complete Merkle tree. You can also specify a leaf index to generate a Merkle proof, which can be verified against the root. The tool displays the tree structure, the root hash, and the proof path for the selected leaf, making it useful for developers building smart contract integrations that require Merkle tree verification.
HOW TO USE
Connect your wallet using the BGWallet connector (required for context). Select the leaf data format: "Text" for plain text strings or "Hex" for raw hex-encoded bytes. Choose the hash algorithm: Keccak-256 (standard for Ethereum) or SHA-3-256 (NIST standard). Enter your leaf data one per line in the text area—this can be Ethereum addresses, token amounts, arbitrary strings, or any other data you want to include in the tree. Optionally, specify a leaf index (starting from 0) to generate a Merkle proof for that leaf. Click "Build Merkle Tree" to construct the tree and compute the root. The tool displays the leaf count, tree depth, and the Merkle root. If you specified a leaf index, it also shows the leaf value and the full proof path (the sibling hashes needed to verify inclusion). You can copy the root or the proof to your clipboard for use in smart contracts or off-chain verification.
TECHNICAL MECHANISM
This tool implements the standard Merkle tree construction algorithm. Each leaf is hashed using the selected hash function (Keccak-256 or SHA-3-256). For text leaves, the raw string is hashed directly; for hex leaves, the hex string is converted to bytes and then hashed. The tree is built bottom-up: adjacent leaf hashes are paired and hashed together to produce parent nodes. If there are an odd number of nodes at any level, the last node is paired with itself (duplicated). This process continues level by level until a single root hash remains. The tool supports both Keccak-256 (using ethers.js) and SHA-3-256 (using the js-sha3 library), allowing compatibility with different blockchain ecosystems. For proof generation, the tool traverses the tree from the target leaf to the root, collecting the sibling hash at each level. The proof consists of these sibling hashes in order, which can be verified by a smart contract or off-chain verifier by recomputing the root from the leaf, proof, and verifying that it matches the stored root. The tree structure is displayed with node counts at each level for transparency.
WHAT IT CANNOT SEE
This tool cannot verify that the leaf data corresponds to any actual on-chain state without additional context—you must ensure the leaf data is correct for your application. It does not automatically generate proofs for all leaves; you must specify each leaf index individually to generate a proof. The tool cannot recover the original leaf data from the Merkle root—hashing is one-way and irreversible. It does not support trees with non-standard hashing algorithms or custom hash functions beyond Keccak-256 and SHA-3-256. The tool cannot detect duplicate leaves or invalid data automatically; you should ensure your data is unique and valid for your use case. It does not support trees larger than the browser's memory limit; very large leaf sets may cause performance issues. The tool cannot verify the tree's integrity without recomputing from the leaves; any change to the leaf data will change the root. It does not support inclusion of non-hex data without first encoding it properly. The tool cannot generate proofs for leaves that are not in the tree, such as leaves that were omitted or had typos.
PLEASE NOTE
This tool is designed for developers building smart contract applications that use Merkle trees for data commitment and verification. The generated Merkle root and proofs are compatible with standard Merkle verification libraries in Solidity (like OpenZeppelin's MerkleProof). For Ethereum applications, Keccak-256 is the standard hash function used in Solidity's sha3() function. For cross-chain or general applications, SHA-3-256 may be preferred for NIST compliance. The leaf data format determines how the data is hashed: text leaves are hashed as UTF-8 strings, while hex leaves are hashed as raw bytes. When generating proofs, the proof path includes sibling hashes ordered from the leaf level up to the root, which matches the format expected by standard verification libraries. Always verify that the generated proof works with your specific smart contract implementation, as different libraries may have different ordering or formatting requirements.