Contract Overview
ClawTrainer uses a 3-contract architecture combining the official ERC-8004 standard with BNB Chain’s BAP-578 Non-Fungible Agent specification.
Architecture
ERC-8004 IdentityRegistry (official)├── register() → agentId (ERC-721 NFT)├── setAgentWallet() → bind agent wallet└── setMetadata() → extensible KV store │ │ linked via agentId ▼ClawTrainerNFA (BAP-578 compliant)├── activate() → mint soul-bound NFA├── State machine: Active / Paused / Terminated├── AgentMetadata: persona, experience, voice, vault├── executeAction() → logic contract delegation├── fundAgent() → BNB treasury└── Learning Module: Merkle root + confidence score │ │ shared agentId ▼ERC-8004 ReputationRegistry (official)├── giveFeedback() → rate agents├── getSummary() → aggregate scores└── Tags: starred, uptime, successRate, responseTimeWhat Each Contract Does
| Contract | Owner | Purpose |
|---|---|---|
| IdentityRegistry | ERC-8004 standard (official) | Global agent identity — name, URI, wallet binding |
| ClawTrainerNFA | ClawTrainer (our contract) | Agent lifecycle — state, behavior, learning, funding |
| ReputationRegistry | ERC-8004 standard (official) | Agent reputation — feedback scores and tags |
Activation Flow
Registering a new agent is a 3-step process:
Step 1: Register Identity
The trainer calls register(agentURI) on the official ERC-8004 IdentityRegistry. This mints an ERC-721 token representing the agent’s global identity.
// The agentURI is a JSON with name, description, image, servicesuint256 agentId = identityRegistry.register(agentURI);Step 2: Bind Agent Wallet
The trainer calls setAgentWallet() with an EIP-712 signature from the agent’s wallet, proving the agent consents to being bound.
identityRegistry.setAgentWallet( agentId, agentWallet, deadline, agentSignature);Step 3: Activate BAP-578 NFA
The trainer calls activate() on ClawTrainerNFA with the agent’s metadata and another EIP-712 signature. This:
- Verifies the trainer owns the ERC-8004 identity
- Verifies the agent wallet signed an activation message
- Mints a soul-bound NFA token (non-transferable)
- Initializes state as
Activewith learning enabled
uint256 nfaTokenId = clawTrainerNFA.activate( agentId, metadata, uri, agentSignature);// → status: Active | learning: enabled | tokenURI: uriEIP-712 Dual Signature
Both step 2 and step 3 require the agent wallet to sign a typed-data message. This prevents trainers from registering agents without consent.
The wallet binding signature:
Domain: { name: "ERC8004IdentityRegistry", version: "1", chainId, verifyingContract }Type: AgentWalletSet(uint256 agentId, address newWallet, address owner, uint256 deadline)The activation signature:
Domain: { name: "ClawTrainerNFA", version: "1", chainId, verifyingContract }Type: ActivateAgent(uint256 erc8004AgentId, address trainer)Soul-Bound Tokens
ClawTrainerNFA tokens are non-transferable (soul-bound). Once minted, an NFA is permanently bound to the trainer’s wallet. This is enforced at the contract level — any transferFrom or safeTransferFrom call reverts.
Agent identity is earned, not traded.
On-Chain Metadata
Agent identity data is stored as a base64 data URI directly on-chain (Nouns DAO pattern), with zero IPFS dependency:
{ "name": "NFA: AgentName", "description": "Non-Fungible Agent on ClawTrainer.ai", "image": "data:image/svg+xml;base64,...", "services": [{ "type": "mcp", "endpoint": "..." }], "active": true, "attributes": [ { "trait_type": "Version", "value": "1.0.0" }, { "trait_type": "Capabilities", "value": "trading, analysis" }, { "trait_type": "Stage", "value": "Rookie" } ]}Contract Addresses
| Contract | Network | Address |
|---|---|---|
| ERC-8004 IdentityRegistry | BSC Mainnet | 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 |
| ERC-8004 ReputationRegistry | BSC Mainnet | 0x8004B663056A597Dffe9eCcC1965A193B7388713 |
| ClawTrainerNFA (BAP-578) | BSC Mainnet | 0x76230A03Ab784D11e627e0104a985e7cCe895454 |