Skip to main content
This quickstart guides you through registering an AI agent using the ERC-8004 standard on Arc Testnet. You’ll create developer-controlled wallets, register your agent’s identity, record reputation events, and verify credentials. Select the tab that matches your preferred setup.

ERC-8004 contracts on Arc testnet

Prerequisites

Before you begin, make sure you have:
  1. A Circle Developer Console account
  2. An API key created in the Console: Keys → Create a key → API key → Standard Key
  3. Your Entity Secret registered

Step 1. Set up your project

Create a project directory, install dependencies, and configure your environment.

1.1. Create the project and install dependencies

1.2. Configure TypeScript (optional)

This step is optional. It helps prevent missing types in your IDE or editor.
Create a tsconfig.json file:
Then, update the tsconfig.json file:

1.3. Set environment variables

Create a .env file in the project directory and add your Circle credentials:
Where YOUR_API_KEY is your Circle Developer API key and YOUR_ENTITY_SECRET is your registered Entity Secret.The npm run start command loads these variables from .env using Node.js native env-file support.
Prefer editing .env files in your IDE or editor so credentials are not leaked to your shell history.

Step 2. Create developer-controlled wallets

In this step, you create two Arc Testnet dev-controlled wallets for the ERC-8004 flow. One wallet owns the agent and the other records reputation. If you already have two Arc Testnet dev-controlled wallets for this flow, skip to Step 3. Per ERC-8004, agent owners cannot record reputation for their own agents to prevent self-dealing.The Step 2 through 7 code snippets explain the flow in smaller pieces. They are not cumulative and will not run if pasted together. To run the full workflow end to end, use the complete script at the end of this tutorial.

Step 3. Prepare agent metadata

Create a JSON file with metadata for your agent. The structure below is an example you can adapt for your use case. ERC-8004 registration stores a metadata URI, but the JSON fields at that URI are application-defined unless your integration follows a separate metadata convention.
agent-metadata.json
Upload to IPFS using Pinata, NFT.Storage, Web3.Storage or your preferred IPFS tool. You’ll receive an IPFS URI like ipfs://QmYourHash....
For this quickstart, you can skip uploading and use the example URI: ipfs://bafkreibdi6623n3xpf7ymk62ckb4bo75o3qemwkpfvp5i25j66itxvsoei

Step 4. Register your agent identity

Call register(metadataURI) on the IdentityRegistry to mint an identity NFT for your agent.
With Circle Gas Station, your application sponsors the transaction fees. On Arc, gas is approximately 0.006 USDC-TESTNET per transaction.

Step 5. Retrieve your agent ID

Query the Transfer event from the IdentityRegistry to find the token ID minted for your agent.
Your AI agent now has a unique onchain identity.

Step 6. Record reputation

Build your agent’s reputation by recording feedback. Use the validator wallet—per ERC-8004, agent owners cannot record reputation for their own agents.
Production scoring: This quickstart hardcodes score: 95 for demonstration. In production, calculate scores dynamically based on agent behavior. For example, score = loanRepaidOnTime ? 100 : 20 for lending protocols, or score = slippagePct < 1 ? 95 : 60 for trading platforms.The ReputationRegistry stores attestations from external observers who witnessed the agent’s actions. Your application logic calculates scores based on outcomes, then records them onchain.

Step 7. Request and verify validation

The ERC-8004 ValidationRegistry uses a two-step request/response flow. The agent owner requests validation from a validator, then the validator submits a response.

Full agent registration script

The complete script below combines all the preceding steps into a single runnable file.
Save it, then run:
If you followed the Python workflow, run deactivate when you’re done to exit the virtual environment.

Summary

After completing this quickstart, you’ve successfully:
  • Created or prepared two Arc Testnet wallets for the ERC-8004 flow
  • Registered an AI agent with a unique onchain identity (ERC-721 token)
  • Recorded reputation feedback from an external validator
  • Requested validation from a validator and verified the response onchain