Rust SDK for interacting with ERC-8004 Trustless AI Agent Registries on any EVM chain.
Add to your Cargo.toml:
[dependencies]
erc8004 = "0.1"use erc8004::{ERC8004Client, ChainName, AgentMetadata};
#[tokio::main]
async fn main() -> erc8004::Result<()> {
let client = ERC8004Client::new(ChainName::BscTestnet, None)?;
// Build agent metadata
let metadata = AgentMetadata::new("My Rust Agent", "Built with the Rust SDK")
.with_service("A2A", "https://agent.example.com/a2a")
.with_service("MCP", "https://agent.example.com/mcp");
// Encode as data URI
let uri = ERC8004Client::build_agent_uri(&metadata)?;
println!("URI: {}", &uri[..80]);
Ok(())
}| Variant | Name | Chain ID |
|---|---|---|
ChainName::BscTestnet |
BSC Testnet | 97 |
ChainName::Bsc |
BSC Mainnet | 56 |
ChainName::Ethereum |
Ethereum | 1 |
ChainName::Sepolia |
Sepolia | 11155111 |
new(chain, private_key)— Create clientbuild_agent_uri(metadata)— Encode metadata as data URIparse_agent_uri(uri)— Decode metadata URIcaip10_address(chain_id, address)— Build CAIP-10 ID
Builder pattern:
let meta = AgentMetadata::new("Name", "Description")
.with_service("A2A", "https://...")
.with_image("https://...");register(uri)— Register agentowner_of(id)— Token ownertoken_uri(id)— Metadata URIbalance_of(addr)— Agent count
submit_score(id, domain, score, evidence)— Submit scoreget_score(id, domain)— Domain scoreget_aggregate_score(id)— Aggregate score
cargo testApache-2.0