Smart Contracts
Onchain escrow and proof verification
Onchain Architecture
zkGrants smart contracts handle three core functions: holding funds in escrow, verifying zkTLS proofs, and releasing payouts to verified claimants. The same conceptual model applies to both Ethereum and Solana.
Escrow
Lock funds at creation
Verify
Validate zkTLS proofs
Release
Pay verified claims
Grant State Machine
Each grant escrow follows a common state machine:
Ethereum (EVM)
Solidity Contracts
EVM-compatible deployment
GrantFactory
Factory contract for creating new grant escrow instances. Optionally, grants can be created directly without a factory.
createGrant(params) → grantIdGrantEscrow
Holds funds, verifies proofs, releases payouts, handles refunds.
fundGrant(grantId, amount)claim(grantId, recipient, proof)refund(grantId)Verifier
zkTLS proof verification contract. Called by GrantEscrow during claim.
verify(proof, publicInputs) → boolSupported Assets
ETH (native) • USDC (ERC-20) • USDT (ERC-20) • Other ERC-20 tokens
Solana
Native Rust Programs
High-performance Solana programs
zkgrants_program
Native Rust program managing grant accounts, escrow vaults, claim verification, and refunds. Built without frameworks for maximum performance and control.
create_grant(...)fund_grant(...)submit_claim(proof_data)refund_grant(...)Account Structure
Program Derived Addresses (PDAs) for Grant, Vault, and Claim accounts. Each grant has its own vault PDA holding escrowed funds.
Light Protocol Groth16 Verifier
Proof verification uses Light Protocol's Groth16 verifier for efficient onchain ZK proof verification on Solana. This enables cost-effective verification of SP1-generated proofs.
Supported Assets
SOL (native) • USDC (SPL) • USDT (SPL) • Other SPL tokens
Security Considerations
Proofs include grantId, chainId, and recipient address to prevent replay attacks and front-running.
Grant parameters (deadline, refund policy, etc.) are fixed at creation and cannot be changed after funding.
Contracts are designed to minimize privileged roles. Verifiers are immutable where possible.
Grants track claimed status to prevent double-claims on the same escrow.
Related Topics
Learn more about proof generation and the API for interacting with zkGrants.