An OpenClaw skill for registering and verifying AI agents using the ERC-8004 standard with Pinata IPFS storage and Viem for on-chain transactions.
-
Blockchain Transactions (CRITICAL RISK)
- Signs transactions using your private key
- Costs gas fees (real money on mainnet)
- Can transfer NFT ownership permanently
- All blockchain operations are irreversible
-
IPFS File Management (HIGH RISK)
- Can upload files to your Pinata account (consumes quota)
- Can delete files from IPFS permanently
- Deleted CIDs referenced on-chain will break
✅ YOU MUST:
- Use a dedicated wallet ONLY for agent registration
- Keep minimal ETH in wallet (only for gas fees)
- NEVER use your primary wallet or one with valuable assets
- Use a separate Pinata account for agent files (or restricted API key)
- Review ALL transaction details before confirming
- Verify destination addresses in full before transfers
- Monitor your Pinata storage usage regularly
❌ NEVER:
- Share your private key or store it in files
- Approve transactions to addresses you don't recognize
- Use this skill with a wallet containing valuable NFTs or large balances
- Bypass confirmation prompts
- Trust addresses from unknown sources
The AI agent includes multiple layers of protection:
-
Mandatory Confirmation Protocol
- Displays complete operation details before every transaction
- Requires explicit "yes" or "confirm" from you
- Shows full addresses (not truncated) for verification
- Warns about permanence and risks
-
Prompt Injection Protection
- Detects suspicious patterns (unauthorized transfers, credential exfiltration)
- Alerts you to potentially malicious instructions
- Refuses operations that violate security guidelines
- Permanently blocks flagged operations (cannot be re-confirmed in the same conversation)
-
Operational Limits
- Enforces mandatory gas budgets and transaction limits (cannot be overridden via chat)
- Validates Ethereum addresses with checksums
- Individual confirmation required for each file deletion
- Timeout on stale confirmation requests
Blockchain transactions are permanent. If you:
- Transfer an NFT to the wrong address → Cannot be reversed
- Spend gas on a failed transaction → Funds are lost
- Lose your private key → Cannot recover the wallet
IPFS deletions are permanent. If you:
- Delete a file referenced on-chain → Links will break
- Delete the wrong CID → Cannot be recovered
Contact security support if the agent:
- Tries to bypass confirmation prompts
- Requests transactions to addresses you didn't provide
- Suggests "emergency" or "urgent" operations
- Asks to display or verify your private key
- Proposes transactions to unknown contracts
- Review the security guidelines in
SKILL.md - Test on testnets only (Base Sepolia, Sepolia) first
- Start with small amounts and verify everything works
- Keep transaction history for your records
This skill is designed for legitimate ERC-8004 agent registration with extensive safeguards, but YOU are the final line of defense. Always verify before confirming.
ERC-8004 enables agents to be discovered and interacted with across organizational boundaries without pre-existing trust. It establishes an open agent economy with pluggable trust models. Agents mint ERC-721 NFTs via the Identity Registry, receiving unique global identifiers.
This skill teaches your AI agent how to:
- Create ERC-8004 compliant agent card JSON files
- Upload agent metadata and images to IPFS via Pinata
- Register agents on-chain using Viem and a private key
- Sign and send blockchain transactions
- Retrieve and verify agent registrations
- Manage the complete lifecycle of agent registrations
Set these in your OpenClaw configuration (~/.openclaw/openclaw.json):
{
"skills": {
"entries": {
"erc-8004-pinata": {
"enabled": true,
"env": {
"PINATA_JWT": "your_pinata_jwt_token_here",
"PINATA_GATEWAY_URL": "your-gateway.mypinata.cloud",
"PRIVATE_KEY": "your_private_key_here_NEVER_PASTE_IN_CHAT",
"RPC_URL": "https://sepolia.base.org"
}
}
}
}
}WARNING: Replace placeholder values with your actual credentials in the config file directly. NEVER paste your actual private key into a chat message, terminal output, or any other visible medium. The agent will read it from the environment variable at runtime.
Getting your credentials:
PINATA_JWT- Get your JWT token at app.pinata.cloud/developers/api-keysPINATA_GATEWAY_URL- Find your gateway domain at app.pinata.cloud/gateway (just the domain, e.g.,your-gateway.mypinata.cloud)PRIVATE_KEY- Ethereum wallet private key with0xprefix (use a dedicated wallet for agent operations)RPC_URL- (Optional) Custom RPC endpoint, defaults to public endpoints for selected chains
- Never share or commit your private key to version control
- Use a dedicated wallet for agent registration operations
- Ensure the wallet has sufficient native tokens (ETH) for gas fees
- For production, consider using hardware wallets or key management services
The skill requires Node.js to be installed for running Viem scripts. The agent will automatically install the viem package when needed.
clawhub install erc-8004-pinata- Clone or download this repository
- Copy the
srcfolder to your OpenClaw skills directory:- Workspace-specific:
<workspace>/skills/erc-8004-pinata/ - Shared across agents:
~/.openclaw/skills/erc-8004-pinata/
- Workspace-specific:
- Rename the
srcfolder to match the skill name if needed - Configure environment variables as shown above
Once installed, your AI agent will understand how to:
Build ERC-8004 compliant JSON files with:
- Required fields:
name,description,image - Optional fields:
endpoints(a2a, mcp, ens, diy),trustModels,registrations
- Upload agent card JSON files to Pinata
- Upload agent images/avatars
- Organize files using Pinata groups
- Retrieve IPFS CIDs and gateway URLs
- Use Viem to interact with ERC-8004 smart contracts
- Sign transactions with your private key
- Register new agents (mint NFTs)
- Set agent URIs pointing to IPFS
- Configure payment wallets
- Transfer agent ownership
- Fetch agent cards from IPFS by CID
- Validate JSON structure and required fields
- Check on-chain registration status
- Verify URI matches between blockchain and IPFS
- Update agent cards (creates new CID due to IPFS immutability)
- Update on-chain URIs to point to new versions
- Delete agent cards from Pinata storage
- List all agent cards in your account
- Read agent information from blockchain
- Upload agent image → Get IPFS CID
- Create agent card JSON with image URI
- Upload agent card to IPFS → Get card CID
- Register on-chain using Viem → Get token ID
- Set agent URI linking token to IPFS card
- Update agent card with registration details
- Upload updated card → Get new CID
- Update on-chain URI to new CID
Note: Payment wallet configuration (if needed) should be handled separately by you, the agent owner.
Once the skill is installed and configured, you can ask your AI agent:
"Create an ERC-8004 agent card for my coding assistant named 'CodeHelper' with description 'Helps with software development tasks'"
"Upload this agent-card.json file to IPFS via Pinata"
"Register this agent on Base Sepolia testnet using my wallet"
"Set the agent URI for token ID 123 to ipfs://bafkreixxx..."
"Verify the agent registration at CID bafkreixxx... matches on-chain data"
"List all my agent cards stored on Pinata"
"Check my wallet balance on Base Sepolia"
"Transfer agent token 123 to address 0x..."
The agent will use Pinata API for IPFS operations and Viem for blockchain transactions automatically.
An ERC-8004 agent card looks like this:
{
"name": "My AI Agent",
"description": "Description of what the agent does",
"image": "ipfs://bafkreixxx...",
"endpoints": {
"a2a": "https://api.example.com/agent",
"mcp": "mcp://example.com/agent"
},
"trustModels": ["stake-secured", "zero-knowledge"],
"registrations": [
{
"namespace": "example",
"chainId": 8453,
"contractAddress": "0x1234567890abcdef...",
"tokenId": "1"
}
]
}The skill includes configurations for:
- Base Mainnet (Chain ID: 8453)
- Base Sepolia (Chain ID: 84532) - Testnet
- Ethereum Mainnet (Chain ID: 1)
- Sepolia (Chain ID: 11155111) - Testnet
For testing on Base Sepolia:
This skill uses Viem for blockchain interactions. Viem is a TypeScript interface for Ethereum with:
- Type-safe contract interactions
- Private key wallet support
- Multiple chain support
- Transaction signing and broadcasting
- Contract read/write operations
The agent will create Node.js scripts using Viem when blockchain operations are needed.
register()- Mint new agent identity NFTsetAgentURI(tokenId, uri)- Set or update agent metadata URIsetAgentWallet(tokenId, wallet)- Set payment wallet address (user handles separately)transferFrom(from, to, tokenId)- Transfer agent ownership
ownerOf(tokenId)- Get agent owner addresstokenURI(tokenId)- Get agent metadata URI (standard ERC-721 method)agentWallet(tokenId)- Get payment wallet addressbalanceOf(address)- Get agent count for address
Check your wallet has native tokens for gas:
const balance = await client.getBalance({ address: account.address });- Ensure private key starts with
0x - Use a hex string, not mnemonic phrase
- Keep it secret and never commit to git
- Try alternative RPC endpoints
- Public RPCs may have rate limits
- Consider using a dedicated RPC provider (Alchemy, Infura, etc.)
- Wait a few seconds after upload
- Check Pinata dashboard for file status
- Verify CID format is correct
- ERC-8004 Specification
- Pinata ERC-8004 Quickstart
- Pinata Documentation
- Viem Documentation
- OpenClaw Documentation
- ClawHub Skills Registry
Contributions welcome! Please open issues or pull requests on the GitHub repository.
MIT