Attestor Contracts
An overview of attestor contracts
Reclaim Protocol: Decentralized Architecture and Incentives
The Reclaim protocol's decentralized architecture relies on smart contracts and a network of Attestor nodes to ensure secure and trustless data verification. Contracts are already deployed to Moca chain.
Core Smart Contracts
- Task Contract:
- Responsible for creating Claim Tasks and achieving Claim consensus.
- Governance Contract:
- Manages Attestor nodes, providing staking, rewards, and penalty mechanisms.
- Optionally, collects staked $MOCA tokens from Attestors and distributes earnings based on staking ratios and service quality.
Attestor Registration & Staking
- Attestors must stake a minimum number of $MOCA tokens in the Governance Contract.
- Rewards are distributed based on the staking ratio.
- Attestors must maintain online availability.
Decentralized Proof of Possession (PoP)
-
Claim Task Request:
- The user submits a "create claim task" request to the Task Contract via the Reclaim SDK.
-
Attestor Selection:
- The Task Contract randomly selects Attestors and returns them to the SDK.
-
zkTLS Protocol Execution:
- The Reclaim SDK establishes connections with the selected Attestors to execute the zkTLS protocol.
-
Proof Submission:
- Each Attestor returns a Proof to the SDK, Proofs then are submitted to the Task Contract.
-
Proof Consensus:
- The Task Contract achieves Proof consensus based on the 51% rule.
-
Proof Verification and Storage:
- The Task Contract verifies the Proof and stores the result upon successful validation.
Unstaking
- Upon an unstaking request, the system initiates an undelegation process with a chain-defined unbonding period (e.g., 21 days).
- After the unbonding period, the remaining $MOCA tokens are calculated and returned to the Attestor’s account, accounting for potential slashing risks.
Try It
Contracts can be found on Github.
Admin setup
If you wish to try things beforehand, try the following upon cloning and installing packages.
-
Populate your
.env
:PRIVATE_KEY=0x..
-
Run the deploy script:
npx hardhat deploy --network $YOUR_NETWORK
-
Create a task request:
npx hardhat create-task-request --network $YOUR_NETWORK
Attestor Example
The example showcases the complete proof lifecycle.
-
Change directory into /examples/attestor and install packages:
npm install
-
Populate your
.env
, varibales are filled for you, you just need to add you private key (without the0x
prefix):PRIVATE_KEY=
-
Download zk files:
node node_modules/@reclaimprotocol/zk-symmetric-crypto/lib/scripts/download-files
-
Run the script:
node index.js
zkFetch Example - Outdated
Alternatively, you can try out an e2e example. This example echoes a previous deployment, but we kept it still for demonstration purposes.
-
Change directory into /examples/zkfetch and install packages:
npm install
-
Populate your
.env
, add you private key (without the0x
prefix):PRIVATE_KEY=
-
Run the script:
node index.js
Register Attestor
If you wish the join the quorum with your attestor, do contact us.