Smart Contracts

On-chain contracts for agent registration, verification, and access control

Self Agent ID deploys 9 contracts on Celo. The core registry implements IERC8004 and the IERC8004ProofOfHuman extension.

Contract Overview

Contract
Role

SelfAgentRegistry

Core registry — ERC-721 soulbound NFTs, IERC8004 + IERC8004ProofOfHuman, registration modes, credentials, proof expiry, sybil detection (UUPS upgradeable)

SelfHumanProofProvider

Implements IHumanProofProvider — metadata wrapper connecting to Self Protocol Hub V2 (verification strength: 100)

SelfReputationRegistry

ERC-8004 Reputation Registry — aggregated feedback with document-type weighted signals (UUPS upgradeable)

SelfValidationRegistry

ERC-8004 Validation Registry — on-demand validation requests/responses from third parties (UUPS upgradeable)

AgentDemoVerifier

EIP-712 meta-transaction verifier for gasless on-chain agent verification

AgentGate

Abstract contract with onlyVerifiedAgent modifier for gating access

LocalRegistryHarness

Local mock for testing without Hub V2 dependency

Deployed Addresses

Celo Mainnet (42220)

Celo Sepolia (11142220)

ERC-8004 Interfaces

The registry implements two standard interfaces:

IERC8004 (Base Identity Registry)

IERC8004ProofOfHuman (Extension)

Key Interfaces

Reading Agent State

Sybil Detection

Metadata & Agent URI

Gating Access

Use AgentGate as a base contract:

EIP-712 Meta-Transactions

The AgentDemoVerifier contract accepts EIP-712 signed messages for gasless verification:

Proof Expiry

Each agent's human proof has a validity window. After expiry, isProofFresh() returns false and the agent must re-authenticate.

circle-info

Expired proofs do not burn the soulbound NFT. The NFT remains as a historical record, but hasHumanProof() returns true while isProofFresh() returns false. The agent must re-authenticate to restore fresh status.

The expiry is calculated as the minimum of:

  • Document expiry date (from passport)

  • Registration timestamp + maxProofAge (default: 1 year)

Reputation Registry

The SelfReputationRegistry is a standalone ERC-8004 Reputation Registry scoped to the SelfAgentRegistry. It stores aggregated feedback from clients with document-type weighted signals.

Document-type weights (auto-assigned at registration):

Document
Weight
Tag

E-Passport (NFC)

100

passport-nfc

EU ID Card (NFC)

100

id-card-nfc

Aadhaar

80

aadhaar

KYC (Sumsub)

50

kyc-sumsub

Validation Registry

The SelfValidationRegistry is a standalone ERC-8004 Validation Registry for on-demand validation requests.

Deregistration

Three paths to deregister an agent (all burn the soulbound NFT):

  1. Hub V2 callback_deregisterAgent() triggered by a new deregistration proof

  2. Self-deregisterselfDeregister(agentId) called by the NFT owner

  3. Guardian revokeguardianRevoke(agentId) called by the agent's guardian

All converge on _revokeAgent() which clears all state (credentials, nullifier, provider, guardian, metadata) and burns the NFT.

Governance

The registry uses role-based governance with two multisig wallets:

Role
Capability

SECURITY_ROLE

Approve proof providers, set verification configs, set max proof age

OPERATIONS_ROLE

Grant roles, link reputation/validation registries

Integration with Self Protocol

The SelfHumanProofProvider connects to Self Protocol's Identity Verification Hub V2. See the Working with userDefinedData guide for details on how the registration data is encoded.

All core registries (SelfAgentRegistry, SelfReputationRegistry, SelfValidationRegistry) are deployed as UUPS proxies with ERC-7201 namespaced storage, enabling safe upgrades without storage collision.

Last updated