Merkle Claim Flow
Create and Claim Cred Merkle Type Process
This document explains the process of creating and claiming a Cred Merkle type, based on the provided sequence diagrams and smart contract code.
Creation Process
Overview
The creation process involves interaction between four main components:
Contract
Frontend
Backend
Arweave (decentralized storage)
Step-by-Step Creation Process
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.
Claim Process
Overview
The claim process allows eligible users to claim their credentials using Merkle proofs.
Step-by-Step Claim Process
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.
Key Points of the MerkleClaim Function:
Input Parameters:
proof_
: Merkle proofencodeData_
: Encoded data containing minter address, referral address, and art IDmintArgs_
: Minting arguments including quantity and image URIleafPart_
: 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
Conclusion
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.
Last updated