erc8004
Type-safe Rust SDK for the ERC-8004 Trustless Agents standard — on-chain identity, reputation, and validation registries for AI agents.
ERC-8004 enables discovery, reputation, and validation of AI agents across organizational boundaries without pre-existing trust. This SDK provides ergonomic, alloy-native bindings for all three registries, with 18 pre-configured network deployments (CREATE2 deterministic addresses) and full off-chain type support (registration files, service endpoints, feedback).
See Security before using in production.
Quick Start
Query an Agent (Read-Only)
use ;
use ;
let provider = new
.connect_http;
let client = new
.with_network;
// Identity Registry — ERC-721 agent identity
let identity = client.identity?;
let owner = identity.owner_of.await?;
let uri = identity.token_uri.await?;
let wallet = identity.get_agent_wallet.await?;
Register an Agent (Write)
use ;
use ;
let signer: PrivateKeySigner = var?.parse?;
let wallet = from;
let provider = new
.wallet
.connect_http;
let client = new
.with_network;
let agent_id = client.identity?
.register_with_uri
.await?;
Build a Registration File (Offline)
use ;
let mut reg = new;
reg.services.push;
reg.x402_support = true;
let json = reg.to_json?;
Architecture
| Module | Description |
|---|---|
Erc8004 |
Top-level client — generic over P: Provider, builder pattern for network / address configuration |
Identity |
Identity Registry (ERC-721) — register agents, manage URIs, wallets, metadata, EIP-712 signatures |
Reputation |
Reputation Registry — submit / revoke feedback, read aggregated summaries, list clients |
Validation |
Validation Registry — request / respond to validation, query status and summaries |
Network |
18 pre-configured deployments (10 mainnet + 8 testnet) with CREATE2 deterministic addresses |
types |
Off-chain JSON types — RegistrationFile, ServiceEndpoint, Feedback, ReputationSummary |
contracts |
Inline Solidity bindings (sol! macro) — alloy-recommended, preserves full type information |
Supported Networks
Contracts are deployed via CREATE2, so all mainnets share the same addresses and all testnets share the same addresses.
| Network | Type | Chain ID |
|---|---|---|
| Ethereum | mainnet | 1 |
| Base | mainnet | 8453 |
| Polygon | mainnet | 137 |
| Arbitrum One | mainnet | 42161 |
| Celo | mainnet | 42220 |
| Gnosis | mainnet | 100 |
| Scroll | mainnet | 534352 |
| Taiko (Alethia) | mainnet | 167000 |
| Monad | mainnet | 143 |
| BNB Smart Chain | mainnet | 56 |
| Ethereum Sepolia | testnet | 11155111 |
| Base Sepolia | testnet | 84532 |
| Polygon Amoy | testnet | 80002 |
| Arbitrum Sepolia | testnet | 421614 |
| Celo Alfajores | testnet | 44787 |
| Scroll Sepolia | testnet | 534351 |
| Monad Testnet | testnet | 10143 |
| BNB Smart Chain Testnet | testnet | 97 |
Design
- Zero
async_trait— pure RPITIT, no trait-object overhead - Inline Solidity bindings —
sol!macro preserves struct names, enums, and visibility; no JSON ABI files - Provider-generic — works with any alloy transport (HTTP, WebSocket, IPC) and any signer configuration
- Strict linting —
pedantic+nursery+correctness(deny), seeclippy.toml - Lightweight instances — each
Identity/Reputation/Validationcall creates a zero-alloc contract handle
Examples
| Example | Description |
|---|---|
query_agent |
Read agent identity from Ethereum mainnet |
register_agent |
Register a new agent on Base Sepolia testnet |
reputation_summary |
Query aggregated reputation and feedback entries |
registration_file |
Build and serialize an off-chain registration file |
multi_network |
Query the same registry across multiple chains |
Security
See SECURITY.md for disclaimers, supported versions, and vulnerability reporting.
Acknowledgments
- ERC-8004 Specification — Trustless Agents standard
- erc-8004/erc-8004-contracts — official Solidity contracts
- alloy — Rust Ethereum toolkit
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project shall be dual-licensed as above, without any additional terms or conditions.