Generate cryptographic merkle trees for gasless airdrops and allowlists. Upload raw arrays or CSV files, retrieve verifiable proofs for on-chain claims. Powered by grep3.
[["id1", "val1", "val2"], ["id2", "val3", "val4"]]Generate a merkle tree from raw JSON array data. Each sub-array becomes a leaf, with the first element as the unique identifier.
{
"data": [
["user_001", "100", "0x1234..."],
["user_002", "250", "0x5678..."],
["user_003", "75", "0x9abc..."]
]
}
{
"job_uuid": "550e8400-e29b-41d4-a716-446655440000"
}
Upload a CSV file to generate a merkle tree. Each row becomes a leaf, with the first column as the unique identifier.
# Upload CSV file curl -X POST https://merkletree.grep3.com/generate/file \ -F "file=@airdrop_data.csv" # Response { "job_uuid": "550e8400-e29b-41d4-a716-446655440000" }
Check the processing status of a merkle tree generation job. Poll this endpoint until status is "complete".
Retrieve the merkle proof for a specific leaf. Use this proof to verify inclusion on-chain in your smart contract.
{
"root_hash": "0x8a3552d60a98e0ade765adddad0a2e420ca9b1eef5f326ba7ab860bb4ea72c94",
"unique_id": "user_001",
"values": ["user_001", "100", "0x1234..."],
"proof": [
"0x5931b4ed56ace4c46b68524cb5bcbf4195f1bbaacbe5228fbd090546c88dd229",
"0x1234567890abcdef..."
]
}
# Using cURL with raw JSON curl -X POST https://merkletree.grep3.com/generate/raw \ -H "Content-Type: application/json" \ -d '{"data":[["addr1","100"],["addr2","200"],["addr3","150"]]}' # Response: {"job_uuid":"abc123..."}
# Check job status curl https://merkletree.grep3.com/status/abc123... # When complete: {"status":"complete","root_hash":"0x8a35..."}
# Get proof for a specific address curl https://merkletree.grep3.com/proof/0x8a35.../addr1 # Response includes the proof array for on-chain verification { "proof": ["0x5931b4ed...", "0x1234..."], "values": ["addr1", "100"] }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; contract Airdrop { bytes32 public immutable root; constructor(bytes32 _root) { root = _root; // Set the root_hash from grep3 API } function claim( bytes32[] calldata proof, address addr, uint256 amount ) external { // Reconstruct the leaf using double-hash (standard merkle tree format) bytes32 leaf = keccak256(bytes.concat( keccak256(abi.encode(addr, amount)) )); // Verify the proof from grep3 API require(MerkleProof.verify(proof, root, leaf), "Invalid proof"); // Process the claim (transfer tokens, etc.) } }
proof array from the API response is passed directly to the contractkeccak256(bytes.concat(keccak256(...)))) to prevent second preimage attacksroot_hash in your contract at deployment or via a setter functionGenerate merkle trees for allowlists. Users claim tokens by providing their proof, verified on-chain with minimal gas.
NFT projects can verify wallet eligibility for presale mints without storing the entire list on-chain.
Prove specific data was part of a larger dataset without revealing the entire dataset. Ideal for audits.
Batch multiple state transitions into a single merkle root for efficient layer 2 settlement.