Merkle Claim Flow
Last updated
Last updated
This document explains the process of creating and claiming a Cred Merkle type, based on the provided sequence diagrams and smart contract code.
The creation process involves interaction between four main components:
Contract
Frontend
Backend
Arweave (decentralized storage)
Request Signature: Frontend initiates the process by requesting a signature.
Upload CSV: Backend uploads a CSV file with addresses to Arweave.
Create and Upload Merkle Tree: Backend creates a Merkle tree from the CSV data and uploads it to Arweave.
Upload Cred Metadata: Backend uploads the credential metadata to Arweave.
Create and Response Signature: Backend creates a signature and sends it to the Frontend.
Call "createCred" Method: Frontend calls the createCred
method on the Contract.
The claim process allows eligible users to claim their credentials using Merkle proofs.
Request Proof: Frontend requests a proof for claiming.
Fetch Cred Metadata: Backend retrieves credential metadata from Arweave.
Fetch Merkle Tree: Backend fetches the Merkle tree from Arweave.
Load Merkle Tree & Find Proof: Backend processes the Merkle tree and finds the proof:
Response Proof: Backend sends the proof back to the Frontend.
Call "claim" Method: Frontend calls the merkleClaim
method on the Contract.
Input Parameters:
proof_
: Merkle proof
encodeData_
: Encoded data containing minter address, referral address, and art ID
mintArgs_
: Minting arguments including quantity and image URI
leafPart_
: Additional data for the Merkle leaf
Verification:
Checks if the minter address is valid and the verification type is "MERKLE"
Verifies the Merkle proof using MerkleProofLib.verifyCalldata
Claim Processing:
Validates and updates the claim state
Processes the claim, which likely includes minting the NFT
Event Emission:
Emits an ArtClaimedData
event with relevant information
The Cred Merkle type creation and claim process provides a secure and efficient way to distribute credentials to eligible addresses. The use of Merkle trees allows for gas-efficient verification on-chain, while storing larger datasets off-chain on Arweave ensures data availability and reduces on-chain storage costs.