A smart contract implementation of the Reclaim Protocol for the Gear blockchain. This contract enables on-chain verification of zero-knowledge proofs generated by the Reclaim Protocol.
Reclaim Protocol allows users to prove claims about their data from any website without revealing the underlying data. This Gear smart contract verifies these proofs on-chain, enabling trustless verification of web2 data in web3 applications.
- Epoch-based witness management
- ECDSA signature verification using secp256k1
- Keccak256 hashing for claim verification
- On-chain proof validation
| Chain | Address | Explorer |
|---|---|---|
| Vara Testnet | 0x383951634434f94d4bf23ab1d7825bff90fe6a00ec2c3f389e7b8d771b053af8 |
View |
├── src/
│ ├── lib.rs # Main contract logic
│ ├── claims.rs # Claim verification and signature recovery
│ ├── state.rs # State definitions (Epoch, etc.)
│ └── error.rs # Custom error types
├── io/
│ └── src/lib.rs # Contract metadata and type definitions
├── tests/
│ └── tests.rs # Integration tests
└── js/ # JavaScript client
- Rust 1.81+ (stable)
wasm32-unknown-unknowntarget:rustup target add wasm32-unknown-unknown
cargo b --workspaceThe compiled WASM binary will be available at:
target/wasm32-unknown-unknown/debug/reclaim_gear.opt.wasm
Run unit and integration tests (excluding on-chain tests):
cargo t --workspace -- --skip gclientRun all tests including on-chain tests with a local node:
# Download the Gear node binary
cargo xtask node
# Run all tests
cargo t --workspaceThe contract accepts the following actions via ReAction enum:
| Action | Description |
|---|---|
Init {} |
Initialize the contract (sets caller as owner) |
AddEpoch { witness, minimum_witness } |
Add a new epoch with witnesses (owner only) |
VerifyProof(Proof) |
Verify a Reclaim proof on-chain |
// Witness configuration for an epoch
struct Witness {
address: String, // Witness address (hex)
host: String, // Witness host identifier
}
// Proof structure for verification
struct Proof {
claimInfo: ClaimInfo,
signedClaim: SignedClaim,
}cd js
npm install
cp .env.example .env # Configure your environment
npm run start