npm package: @pinata/erc8004
Description: Interactive wizard to register ERC-8004 AI agents with Pinata IPFS
Author: Pinata
Latest version: 1.1.0

# @pinata/erc8004

Interactive terminal wizard to register ERC-8004 AI agents on-chain with Pinata IPFS.

## Quick Start

```bash
npx @pinata/erc8004
```

Or with Bun:

```bash
bunx @pinata/erc8004
```

Or run the CLI directly:

```bash
pinata-8004
```

## Prerequisites

1. **Pinata account** (free tier works)
   - Get your JWT at [app.pinata.cloud/developers/api-keys](https://app.pinata.cloud/developers/api-keys)
   - Create a gateway at [app.pinata.cloud/gateway](https://app.pinata.cloud/gateway)

2. **Native tokens for gas** on your chosen network
   - Testnets: Get free tokens from faucets (links shown in wizard)
   - Mainnets: Small amount of native currency (ETH, POL, BNB, etc.)

3. **Wallet private key**
   - The wallet that will own your agent NFT

## Supported Networks

| Network | Type |
|---------|------|
| Ethereum Mainnet | mainnet |
| Ethereum Sepolia | testnet |
| Base Mainnet | mainnet |
| Base Sepolia | testnet |
| Polygon Mainnet | mainnet |
| Polygon Amoy | testnet |
| Monad Mainnet | mainnet |
| Monad Testnet | testnet |
| BSC Mainnet | mainnet |
| BSC Testnet | testnet |

## Features

**Create Agent**
- Select any supported network (mainnet or testnet)
- Enter agent details (name, description, image)
- Configure all ERC-8004 service types (MCP, A2A, OASF, ENS, DID, email)
- Set trust models and x402 payment support
- Register on-chain and store metadata on Pinata IPFS

**Update Agent**
- Update URI: Re-upload agent card to IPFS and update on-chain
- Set payment wallet: Configure the on-chain address for receiving payments

**Verify Agent**
- Look up any agent by ID
- Validate schema against ERC-8004 spec
- Check registration matching
- Verify endpoint domains via `.well-known`

## Payment Wallet

The payment wallet is stored **on-chain**, not in the agent card JSON. This ensures clients always get the authoritative payment address by querying the contract directly.

- **x402 Support** (in agent card): A boolean flag indicating your agent accepts x402 payments
- **Payment Wallet** (on-chain): The actual address where payments are sent

By default, the payment wallet is the owner's address (whoever registered the agent). To use a different wallet:

1. Go to **Update Agent > Set payment wallet**
2. Enter your agent ID
3. Enter the private key of the wallet you want to receive payments
4. The new wallet signs an EIP-712 message proving consent
5. The owner submits the transaction to update the on-chain record

Clients looking to pay your agent will:
1. Check `x402Support: true` in your agent card
2. Call `getAgentWallet(agentId)` on-chain to get the payment address

## What is ERC-8004?

ERC-8004 is an open standard for AI agent identity and trust. It gives your agent:

- **Portable identity** — Your agent exists as an NFT, not tied to any platform
- **Discoverable endpoints** — Other agents can find your MCP server, A2A endpoint, and more
- **Composable reputation** — Feedback builds a track record that follows your agent

Learn more: [ERC-8004 Specification](https://eips.ethereum.org/EIPS/eip-8004)

## Development

```bash
bun install
bun run dev
```

## Build

```bash
bun run build
```

Outputs `dist/index.js` for standalone use.

## Programmatic Usage

For scripting and automation, see the example scripts in the same repo:
[github.com/PinataCloud/erc8004](https://github.com/PinataCloud/erc8004)

## License

MIT