This demo showcases how ai agents can verify, sign, and provide feedback to each other on ERC-8004 validation registry by using WachAI’s Verification Network and mandates SDK. It demonstrates end-to-end agent collaboration, starting from discovery, to communication, to verifiable signing and feedback loops.
- ChaosChain SDK → Used for agent discovery and registration on ERC-8004.
- XMTP → Enables secure, decentralized agent-to-agent messaging.
- WachAI SDK → Powers signing, verification, and feedback exchange for job mandates registered under ERC-8004.
Together, these tools form a verifiable and trust-minimized framework for how AI agents coordinate and hold each other accountable within decentralized ecosystems.
-
Client agent shares an intent (e.g., a token swap intent).
-
Server reviews it and shares a signed mandate.
-
Client accepts the server's mandate by signing it.
-
Server performs the task and shares mandate with a validation receipt to the validator.
-
Validator agent validates the task and provides feedback on the job.
npm inpm run setupThis command generates fresh wallet keys for:
-
Server
-
Client
-
Validator
-
Swap wallet
and creates a new .env file with these credentials.
You’ll need a Pinata Cloud account to store metadata on IPFS.
Add your JWT key to the .env file:
PINATA_JWT=your_pinata_jwt_tokenEach generated wallet (SERVER, CLIENT, VALIDATOR, SWAP) must be funded with:
ETH → for gas fees 🔗 Get ETH from Sepolia Faucet
Test USDC → for ERC-20 interactions 🔗 Get Test USDC from Circle Faucet
Ensure all four wallets have sufficient ETH and test USDC before proceeding.
Once setup is complete and wallets are funded, run the demo agents in sequence:
# Start Server Agent (Provider) first
npm run server-agent
# In another terminal, start Client Agent (Requester)
npm run client-agent
# Optionally, start Validator Agent in another terminal (demo starts it automatically)
npm run agent-validator├── src/
│ ├── agent/
│ │ ├── clientAgent.ts # Swap requester agent (Client Agent)
│ │ ├── serverAgent.ts # Swap provider agent (Server Agent)
│ │ ├── validatorAgent.ts # On-chain validation responder
│ │ └── verifier/
│ │ └── thirdParty.ts # Third-party mandate verification
│ ├── services/
│ │ ├── uniswap/
│ │ │ ├── uniswapV3.ts # Uniswap V3 swap execution & validation
│ │ │ ├── uniswap.config.ts # Uniswap configuration
│ │ │ └── abis.ts # Contract ABIs
│ │ └── customPinataService.ts # IPFS storage via Pinata
│ ├── core/
│ │ ├── mandate.ts # Mandate creation and verification
│ │ └── mandate-base.ts # Base mandate implementation
│ └── types/ # TypeScript type definitions
├── scripts/
│ ├── testSwap.ts # Test script for swap functionality
│ ├── setup.js # Setup script for environment
│ └── revokeInstalaltions.ts # Revoke XMTP installations helper
├── db/ # Local XMTP databases (gitignored)
├── demo.ts # Demo orchestration script (TypeScript)
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
└── README.md # This file
The Server Agent supports two execution modes:
- Set
UNISWAP_DRY_RUN=truein your.envfile - No actual blockchain transactions are executed
- Mock transaction hashes are generated
- Safe for testing and development
- No gas fees or token balances required
- Set
UNISWAP_DRY_RUN=falseor omit the variable - Executes actual swaps on-chain via Uniswap V3
- Validates transactions after execution
- Stores validation proofs on IPFS
- Requires:
- Sufficient token balances for swaps
- ETH for gas fees
- Valid Uniswap V3 contract addresses
Swapping: After each swap execution (in live mode), the agent automatically:
- Executes the swap transaction on Uniswap V3
- Waits for transaction confirmation
- Validates the swap by decoding transaction logs
- Verifies swap amounts and direction
- Includes validation results in proof data stored on IPFS
If you need to revoke old XMTP installations (for example, to force a fresh session), use the provided script:
# Usage
npm run revoke-installations -- <inbox-id> [installations-to-save]
# Example: keep current installation only
npm run revoke-installations -- 743f3805fa9daaf879103bc26a2e79bb53db688088259c23cf18dcf1ea2aee64
# Example: keep a comma-separated list of installation IDs
npm run revoke-installations -- 743f38...ee64 "current-installation-id,another-installation-id"Requirements (in your .env):
CLIENT_AGENT_PRIVATE_KEYSERVER_AGENT_PRIVATE_KEYXMTP_DB_ENCRYPTION_KEYXMTP_ENV(e.g.,dev)
If something goes wrong, stop all running agents with:
pkill -f "tsx.*src/agent/(serverAgent|clientAgent|validatorAgent)\.ts"This sends SIGTERM to matching processes; the demo and agents handle SIGTERM for clean shutdown.