Documentation
Smart contract architecture
The official ERC-8004 Identity Registry AgentID builds on, and the two small, immutable, admin-free extensions it adds for signing keys and anchoring.
Overview
| Contract | Owner / upgradeability | Purpose |
|---|---|---|
| ERC-8004 IdentityRegistry | UUPS proxy, upgradeable by its owner (ERC-8004 team) | Agent identities (ERC-721), agentURI, onchain metadata |
| AgentKeyRegistry | None — immutable, no admin, no pause | Operational signing keys per agent |
| AgentActivityAnchor | None — immutable, no admin, no pause | Optional anchoring of signed-record hashes |
AgentID deploys no proxies, no tokens and no privileged roles. The extensions reference the identity registry by an immutable address and read ownership from it on every call.
ERC-8004 Identity Registry
| Value | |
|---|---|
| Proxy (Robinhood Chain Testnet) | 0x8004A818BFB912233c491871b3d84c89A494BD9e |
| Proxy (Robinhood Chain) | 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 |
| Implementation | 0x7274e874CA62410a93Bd8bf61c69d8045E399c02 |
| Version | 2.0.0 |
| Implementation runtime keccak256 | 0xa5f9624ea85e45b3f4b8558581f03bfb3e6cefab278d7bf0500ec9bd065dc16f |
| Proxy owner (upgrade authority) | 0x547289319C3e6aedB179C0b8e8aF0B5ACd062603 |
AgentID verified independently that the proxy code and the EIP-1967 implementation are identical on Robinhood Chain Testnet, Robinhood Chain and Ethereum Sepolia, and that the implementation has a Sourcify exact match on chain 4663. Every identity report re-checks the live implementation (Registry implementation matches verified ERC-8004 build), and Network status shows it continuously.
Semantics AgentID relies on: ids start at 0; register mints with _safeMint and sets the reserved agentWallet metadata to the caller; owners, approved addresses and operators may call setAgentURI, setMetadata, setAgentWallet and unsetAgentWallet; transfers clear agentWallet. Events: Registered, URIUpdated, MetadataSet, ERC-721 Transfer, proxy Upgraded.
AgentKeyRegistry
// AgentKeyRegistry (Solidity 0.8.24) — EIP-712 domain ("AgentID Key Registry", "1")
bytes32 constant KEY_AUTHORIZATION_TYPEHASH = keccak256(
"KeyAuthorization(address registry,uint256 agentId,address key,address owner,uint64 epoch,uint256 deadline)"
);
uint256 constant MAX_DEADLINE_WINDOW = 1 days;
struct KeyRecord { uint64 epoch; uint64 authorizedAt; uint64 revokedAt; address owner; }
function authorizeKey(uint256 agentId, address key, uint256 deadline, bytes calldata keySignature) external;
function rotateKey(uint256 agentId, address oldKey, address newKey, uint256 deadline, bytes calldata newKeySignature) external;
function revokeKey(uint256 agentId, address key) external;
function revokeAllKeys(uint256 agentId) external;
function sync(uint256 agentId) external returns (uint64 epoch); // permissionless
function isAuthorized(uint256 agentId, address key) external view returns (bool); // never reverts
event OwnerSynced(uint256 indexed agentId, address indexed owner, uint64 epoch);
event KeyAuthorized(uint256 indexed agentId, address indexed key, address indexed owner, uint64 epoch);
event KeyRevoked(uint256 indexed agentId, address indexed key, address indexed owner, uint64 epoch);
event AllKeysRevoked(uint256 indexed agentId, address indexed owner, uint64 newEpoch);Writes require the caller to be the agent's owner, its approved address or an operator of the owner. Authorization verifies the key's EIP-712 signature with OpenZeppelin SignatureChecker (EOA or ERC-1271), marks the digest as used, and stores the record under the owner, never the operator.
Owner binding and epochs#
Before every write the registry syncs ownership: if ownerOf(agentId) differs from the bound owner, it binds the new owner and increments the epoch (the first bind yields epoch 1) and emits OwnerSynced. isAuthorized requires record ∧ not revoked ∧ record.epoch = current epoch ∧ record.owner = current owner, so a transfer invalidates keys immediately and the next sync makes it permanent.
Errors#
NotOwnerOrOperator, AgentDoesNotExist, InvalidKey, SignatureExpired, DeadlineTooFar, InvalidKeySignature, SignatureAlreadyUsed, KeyAlreadyActive, KeyNotActive. The SDK decodes them into readable messages.
AgentActivityAnchor
// AgentActivityAnchor (Solidity 0.8.24)
uint256 constant MAX_BATCH = 64;
struct Anchor { uint64 timestamp; uint64 blockNumber; address submitter; }
function anchor(uint256 agentId, bytes32 recordHash) external;
function anchorBatch(uint256 agentId, bytes32[] calldata recordHashes) external; // atomic
function anchorOf(uint256 agentId, bytes32 recordHash) external view returns (Anchor memory);
function isAnchored(uint256 agentId, bytes32 recordHash) external view returns (bool);
event ActivityAnchored(uint256 indexed agentId, bytes32 indexed recordHash, address indexed submitter, uint64 timestamp);- Callers: the agent's owner, approved address or operator, or a key the AgentKeyRegistry currently authorizes for the agent — otherwise
NotAuthorizedToAnchor. - One anchor per
(agentId, recordHash)(AlreadyAnchored); zero hashes rejected (InvalidRecordHash); batches are atomic, non-empty and at most 64 (EmptyBatch,BatchTooLarge). blockNumberis Robinhood Chain's own block number, read from the ArbSys precompile (on Arbitrum Orbit chainsblock.numberreturns the parent-chain block).- The constructor checks that both referenced contracts have code and that the key registry serves the same identity registry. No Merkle batching — kept out deliberately to stay simple and testable.
Tests and deployment
Foundry suites cover registration through the vendored registry, unique incremental ids, ownership, metadata authorization, unauthorized calls on both extensions, key authorization with EOA and ERC-1271 keys, bad / expired / reused signatures, rotation, revocation, revoke-all, ownership transfer (including A→B(sync)→A), operators and duplicate anchoring. The official registry is vendored verbatim for local tests only; it is never deployed to Robinhood Chain by AgentID.
# Foundry: build and run the test suites
cd contracts && forge build && forge test -vv
# ABI parity between the Solidity and the SDK's frozen ABIs
node scripts/check-abi.mjs
# Local devnet: vendored ERC-8004 registry + both extensions → deployments/31337.json
node scripts/chain-bootstrap.mjs