# Spec 5: ERC-8004 + x402/AP2 conformance for Aere's agent stack ## What was built (all under aerenew/) Thin ADAPTERS over the LIVE, already-deployed agent primitives. Nothing live was redeployed or modified. New dir: `aerenew/contracts/contracts/erc8004/` - `IERC8004.sol` - modeled ERC-8004 Identity / Reputation / Validation interfaces ([VERIFY] flagged). - `AereIdentityRegistry8004.sol` - Identity adapter over the deployed AereAgentDID (0xce64..22C5). agentId == the DID's Falcon root key id; register binds AgentCard URI + domain to an existing DID agent, controller-gated; resolve by id/domain/address; DID string did:aere::. - `AereReputationRegistry8004.sol` - Reputation adapter over the deployed AereAIReputation (0x781e..feBF). READ path (getScore/getStats) reads the live scoreOf/statsOf directly. WRITE path (giveFeedback) forwards to live attest; needs the adapter to be a registered attestor (live set is immutable Foundation-only, so write-through is a founder-gated governance step -> honest AdapterNotAttestor revert + canWriteThrough()). - `AereValidationRegistry8004.sol` - THE DIFFERENTIATOR. ERC-8004 validation request/respond where the response proof is a Falcon-512 or ML-DSA-44 signature verified on-chain via the live precompiles (0x0AE1 / 0x0AE3) through AerePQCKeyRegistry.verifyWithKey. Fail-closed, non-replayable, challenge-bound. - `AereAP2MandateVerifier.sol` - x402/AP2 payment mandate ("agent X may spend up to N per period for purpose P") signed with Falcon-512 (PQC), verified via 0x0AE1. verifyMandate (view) + authorizeSpend (enforced: window + cap + PQC). Settlement routes through the existing AERE402 rail (not redeployed); optional SETTLEMENT_EXECUTOR gate. Test: `aerenew/contracts/test/erc8004-adapters.test.js` Doc: `aerenew/docs/AERE-ERC8004-X402-CONFORMANCE.md` (mapping table + PQC differentiator + honest status) ## REAL test result `npx hardhat test test/erc8004-adapters.test.js` from aerenew/contracts -> **18 passing** (~2s). Compiled 5 Solidity files (solc 0.8.23). Covers: identity register/resolve + controller gating; reputation attest->read (forward into live AereAIReputation, score reads back) + honest not-attestor revert; validation Falcon-512 (0x0AE1) accepted + ML-DSA-44 (0x0AE3) accepted + tampered rejected fail-closed + score-binding + stale-precompile-invalid; mandate verify/authorize/cap/expiry/tampered-fail-closed/revoke-halt/executor-gate. ## Flags - [MEASURE] Local Hardhat has no PQC precompile. Test installs the repo's MockPQCPrecompile at 0x0AE1/0x0AE3 via hardhat_setCode (same as the AereRecoveryRegistry fault-harness). Mock parses at the LIVE precompile spec offsets (accept iff commitment == keccak256(pk||message)), so a pass proves correct input routing + fail-closed. Real precompile acceptance is proven separately vs live mainnet 2800 via eth_call (as AerePQCKeyRegistry/AerePQCAttestation are), NOT re-proven in this unit test. Adapters stay wired to 0x0AE1/0x0AE3 for production. - [VERIFY] ERC-8004 exact selectors are evolving (identity trending to ERC-721 register/tokenURI; reputation/validation arg orders unsettled). Adapters implement documented semantics; selector-level conformance reconcile pending. Marked in NatSpec + doc. - [VERIFY] x402/AP2 mandate field set still evolving (AP2 Intent vs Cart; x402 HTTP-402 payload). Struct captures the common "spend up to N per period for purpose Q" authorization. - [VERIFY] Reputation write-through needs Foundation to authorize this adapter as an attestor on mainnet (immutable live set) - external/founder-gated. Read path works against the live instance today. ## Honesty boundaries respected - Adapters wrap live contracts, do NOT redeploy them. Consensus is NOT made post-quantum (still Besu QBFT classical ECDSA); only the validation-response and mandate AUTHENTICITY are PQC. - Standard-adoption by the wider ecosystem is external, stated as not controlled by Aere. - Brand "Aere Network"/"Aere" title case, ticker AERE uppercase; no em-dashes / "--" in doc prose. ## Live addresses used (chain 2800) AereAgentDID 0xce641d7d7C10553D82b06B7C21d423550e7522C5 | AereAIReputation 0x781ef746c08760aa854cDa4621d54db6734bfeBF AereAgentBond 0x32E0015F622a8719d1C380A87CE1a09bcd0cB86A | AerePQCKeyRegistry 0x1eCa3c5ADcBD0b22636D8672b00faC6D89363691 AERE402FacilitatorV2 0xFC2f7FAa94919caF1126b3c995F0F6AcCef291de | AereSink 0x69581B86A48161b067Ff4E01544780625B231676 Precompiles: 0x0AE1 Falcon-512, 0x0AE3 ML-DSA-44 (live, activation block 9,189,161)