Building Trustless AI Agents: ERC-8004 Security Audit Guide

marsbitОпубликовано 2026-03-05Обновлено 2026-03-05

Введение

ERC-8004, the Trustless Agents standard deployed on Ethereum, introduces a verifiable and trust-minimized framework for AI Agent identity and reputation management through three core registries: Identity, Reputation, and Validation. The **Identity Registry** (ERC-721 based) mints a unique AgentID (an NFT) for each agent, with a `tokenURI` pointing to an off-chain registration file. This file contains the agent's basic info, service endpoints, and capabilities. A critical security feature is domain verification, requiring agents to host a signed file at a specific path on their domain to prove ownership and prevent spoofing. Key audit points include access controls for URI updates, use of immutable storage, proper cryptographic signature validation (EIP-712), and prevention of signature replay attacks. The **Reputation Registry** provides a standard interface for submitting and aggregating feedback. It uses a "Payment-Proof Linking" mechanism, where feedback submissions must include a proof of a payment (e.g., an x402 transaction hash), making Sybil attacks economically costly. Audit focuses include enforcing payment proof validity, constraining score ranges, and ensuring robust, manipulation-resistant off-chain aggregation algorithms. The **Validation Registry** allows agents to submit their work for independent verification, crucial for high-stakes tasks. It supports two models: 1. **Cryptoeconomic Validation:** Agents stake funds, which can be slashed via a fraud-proof ...

With the ERC-8004 (Trustless Agents) standard officially deployed on the Ethereum mainnet, AI Agent identity and reputation management have entered a new stage of verifiability and trustlessness. This standard provides agents with an on-chain verifiable "identity system" through three core registries: the Identity Registry, Reputation Registry, and Validation Registry. This article will adopt a security audit perspective, combining the technical details of ERC-8004, to analyze the key points of risk for each registry, providing a practical audit guide for developers and auditors.

Technical Details and Audit Key Points

The key to ERC-8004 lies in its three registries:

1. Identity Registry

A minimal on-chain handle based on ERC-721, with URIStorage extension, resolving to the agent's registration file, providing a portable, censorship-resistant identifier for each agent.

In the ERC-8004 architecture, the Identity Registry is built on ERC-721 and extends the URIStorage functionality. In other words, each agent corresponds to a unique NFT on the chain, this NFT is called an AgentID.

When a developer creates an agent, they call the register function of the registry contract, minting a new AgentID. This token is bound to a tokenURI, pointing to a JSON file stored off-chain—the so-called "agent registration file." The registration file must follow strict specifications, typically including three core types of content:

- Basic information, such as name, description, avatar URL;

- Service endpoints, which are the network addresses where the agent can be accessed, supporting various protocols like HTTP, WebSocket, Libp2p, A2A, MCP;

- Capability declarations, i.e., a list of tasks the agent can perform, such as image generation, arbitrage trading, or code auditing.

Self-declaration alone is clearly insufficient to establish trust, so ERC-8004 introduces a domain verification mechanism. The agent must host a signature file under its declared domain, at the path /.well-known/agent-card.json. The on-chain registry verifies this link, thereby binding the on-chain AgentID to the corresponding DNS domain. The significance of this step is to prevent phishing and impersonation attacks; an agent cannot arbitrarily claim to belong to a domain; it must prove control with a cryptographic signature.

Audit Key Points:

● Check the access control of the setTokenURI function, ensuring only the agent owner or an authorized role (e.g., onlyOwnerAfterMint) can update the URI.

● Review whether the URI supports immutable storage schemes (e.g., IPFS, Arweave). If centralized HTTP links are used, assess the security of domain control rights to prevent DNS hijacking.

● Verify the legality of the URI format to avoid contract exceptions caused by null pointers or invalid URIs.

● Verify that the contract strictly enforces cryptographic signature verification (e.g., EIP-712) when checking domain signatures, preventing signature forgery or replay attacks.

● Check the expiration mechanism for domain ownership proofs to prevent long-valid signatures from being reused.

● Ensure the domain resolution process does not rely on centralized oracles, avoiding single points of failure or manipulation.

2. Reputation Registry

A standard interface for publishing and obtaining feedback signals. Scoring and aggregation happen both on-chain (for composability) and off-chain (for complex algorithms), enabling an ecosystem of professional services like agent scoring, audit networks, and insurance pools.

Used for providing feedback and evaluation on registered AI Agents. Simple feedback submission occurs on-chain, with the potential for complex, aggregated off-chain processing before being recorded on-chain.

ERC-8004 also incorporates a "Payment-Proof Linking" mechanism to prevent malicious review spamming. When Agent A completes an evaluation of Agent B, it calls the giveFeedback function. This function not only accepts a score (0-100) and a comment hash but also allows for a paymentProof field, typically the hash of an x402 transaction. This makes the cost of spamming reviews extremely high, significantly reducing the possibility of Sybil attacks. Ultimately, the system naturally rewards agents with stable and high-quality performance.

Audit Key Points:

● Verify that the giveFeedback function mandates the paymentProof parameter and check if this parameter is a valid x402 transaction hash (or conforms to other payment standards). Ensure payment proofs cannot be reused (e.g., record used hashes) to prevent multiple reviews from a single payment.

● Check if the scoring range (0-100) is enforced at the contract level to avoid out-of-bounds scores disrupting aggregation logic.

● Evaluate the anti-manipulation properties of the off-chain aggregation algorithm: e.g., whether it uses medians, trims extreme values, or uses weighted averages, and whether it penalizes anomalous behavior (like a large number of reviews in a short time).

● Review slashing conditions for clarity and verifiability, e.g., whether they rely on on-chain evidence or fraud proofs submitted by third-party oracles.

● Ensure slashing logic does not contain centralized privileges (e.g., an admin can arbitrarily confiscate staked funds); slashing trigger conditions should be executed automatically solely by the smart contract.

● Test the lock-up period and conditions for staked fund withdrawal to prevent agents from urgently withdrawing funds just before facing slashing.

3. Validation Registry

A universal hook for requesting and recording checks by independent validators (e.g., zkML verifiers, TEE oracles, trusted judges).

Reputation reflects the past, but in high-risk scenarios (like large fund allocation), history alone is not enough. The Validation Registry allows agents to submit results for verification by third parties or automated systems, which can use methods like attested safe inference re-execution, zkML verifiers, or TEE oracles to verify or reject requests.

The first model is cryptoeconomic validation, based on game-theoretic security design. The agent must stake a certain amount of native token or stablecoin in the registry. If the agent fails to perform or provides incorrect results, the verifier network can submit a fraud proof, triggering the smart contract to automatically slash its staked funds. This model is suitable for tasks where results are easy to verify but the computation process is opaque, such as data scraping or simple API services.

The second model is cryptographic validation, based on mathematical security principles. TEE attestation (Trusted Execution Environment) allows the agent to run in a security-hardened hardware environment, such as Intel SGX or AWS Nitro. The Validation Registry can store and verify remote attestation reports from the hardware, proving that the agent is indeed running an untampered specific version of the code.

zkML (Zero-Knowledge Machine Learning) is another method of cryptographic validation. The agent submits a zero-knowledge proof along with the inference result. This proof can be verified at very low cost by an on-chain verification contract, mathematically guaranteeing that the output was indeed produced by a specific model (e.g., Llama-3-70B) on a specific input. This prevents "model swapping" attacks, where a service provider claims to use a high-end model but actually uses a lower-tier model to save costs.

Audit Key Points

For cryptoeconomic validation, check:

● Check the submission window for fraud proofs: Is enough time given for verifiers to discover and submit proofs? A window too short might miss malicious behavior, while too long locks funds for extended periods.

● Verify the adjudication logic for fraud proofs: Does it rely on a multi-signature verifier set? If so, review the decentralization level and threshold settings for verifier selection; if adjudication is fully on-chain, ensure the basis for judgment (e.g., on-chain verifiable results) exists and is unambiguous.

● Ensure the staked amount matches the risk, preventing low-cost malicious behavior (e.g., staking too little, where the profit from misbehavior far exceeds the loss).

For TEE attestation, check:

● Check if the contract verifies the timeliness of the TEE proof (e.g., includes a timestamp or block height) to prevent expired proofs from being accepted.

● Verify that the proof content includes the agent's code hash and input/output digests, ensuring the proof is bound to the specific task and avoiding cross-task reuse.

● Evaluate if the TEE proof verification logic relies on external oracles (e.g., Intel IAS). If it does, audit the oracle's security and decentralization level.

For zkML validation, check:

● Confirm the contract integrates an audited zk verification library (e.g., SnarkVerifier) and is correctly configured with verification keys for the specific proof system (e.g., Groth16, PLONK).

● Check if the verification contract restricts the models and input ranges applicable to the proof, preventing model swapping attacks (e.g., a proof generated for a small model is claimed to be from a large model).

● Evaluate the decentralization level of proof generation: Does it rely on a single prover? If multiple provers exist, a consensus mechanism is needed to prevent malicious provers.

Conclusion

ERC-8004 provides a standard for building trust in AI Agents, and its security is crucial for the entire on-chain Agent ecosystem. Security audit work requires a deep understanding of the design intent and potential risks of the three registries. Furthermore, the complexity of cross-contract interactions and common vulnerabilities cannot be ignored. Comprehensive and rigorous audits are necessary to ensure ERC-8004 truly delivers on its "trustless" promise, laying a secure foundation for the future of autonomous agents.

Связанные с этим вопросы

QWhat are the three core registries defined by the ERC-8004 standard, and what is the primary function of each?

AThe three core registries are: 1. Identity Registry: Provides a minimal on-chain handle based on ERC-721 with URIStorage extension, resolving to a proxy's registration file to offer a portable, censorship-resistant identifier. 2. Reputation Registry: A standard interface for publishing and obtaining feedback signals, enabling both on-chain and off-chain scoring and aggregation for an ecosystem of professional services like agent rating, audit networks, and insurance pools. 3. Validation Registry: A general-purpose hook for requesting and recording checks by independent validators (e.g., zkML verifiers, TEE oracles, trusted judges) to verify an agent's work output for high-stakes scenarios.

QWhat mechanism does ERC-8004 use to prevent Sybil attacks in its Reputation Registry, and what is a key audit point related to this?

AERC-8004 uses a 'Payment-Proof Linking' mechanism to prevent Sybil attacks. When an agent gives feedback, the `giveFeedback` function requires a `paymentProof` parameter, typically a hash of an x402 transaction, which makes the cost of spamming reviews extremely high. A key audit point is to verify that the function enforces this requirement and checks that the `paymentProof` is a valid, non-reusable transaction hash to prevent a single payment from being used for multiple reviews.

QIn the context of the Identity Registry, what is the purpose of the domain verification mechanism, and what is a critical security risk auditors must check for?

AThe domain verification mechanism binds an on-chain AgentID to a specific DNS domain by requiring the agent to host a signed file at `/.well-known/agent-card.json` on that domain. This prevents phishing and impersonation attacks by cryptographically proving control of the domain. A critical security risk for auditors to check is whether the URI in the token metadata uses a centralized HTTP link, which could be vulnerable to DNS hijacking, and to assess the security of domain control.

QWhat are the two main models of verification described for the Validation Registry, and what is a primary cryptographic concern for each?

AThe two main models are: 1. Cryptoeconomic Verification: Relies on staking and fraud proofs. A primary concern is ensuring the staking amount is sufficient to disincentivize malicious behavior, as a low stake could make the cost of cheating lower than the potential profit. 2. Cryptographic Verification: Includes TEE Attestation and zkML. For TEE, a key concern is verifying the timeliness and task-specific binding of the attestation proof to prevent replay attacks. For zkML, a primary concern is ensuring the verification contract is correctly configured with audited libraries and restricts the proof to the intended model and input to prevent model-swapping attacks.

QRegarding the Reputation Registry's on-chain aggregation, what is an important algorithmic consideration auditors must evaluate to ensure manipulation resistance?

AAuditors must evaluate the off-chain aggregation algorithm for its resistance to manipulation. This includes checking if it uses techniques like calculating the median, trimming extreme values, or applying weighted averages to mitigate the impact of outlier scores. They should also assess if the algorithm incorporates penalties for anomalous behavior, such as a high volume of reviews submitted in a very short period.

Похожее

From Banning Doubao to Embracing Honor: Why Did WeChat Suddenly 'Change Its Face'?

The article explores the sudden shift in WeChat's strategy towards AI assistants from mobile phone manufacturers, transitioning from strict opposition to active collaboration. For over a year, WeChat fiercely resisted attempts by phone AI assistants (like ByteDance's Doubao in late 2025) to control its features via GUI automation ("simulated clicking"), citing security and data control concerns. This stance created a significant barrier for system-level AI integration. Now, Tencent has initiated A2A (Agent-to-Agent) partnerships with major phone brands like Honor, Xiaomi, OPPO, and vivo. This model allows a phone's system AI (e.g., Honor's YOYO) to parse a user's voice command and send a structured request directly to WeChat's own internal AI agent via secure APIs. WeChat then executes the action (e.g., sending a message) and returns the result. The article attributes Tencent's "change of face" to strategic pressure. While leading in social app usage, Tencent trails rivals like ByteDance and Alibaba in standalone AI app popularity. WeChat, with its vast mini-program ecosystem, is Tencent's key asset for an AI comeback. The upcoming WeChat AI agent aims to handle tasks like booking and payments within the app. However, phone system assistants remain the primary AI entry point for most users. The A2A collaboration allows Tencent to extend WeChat's AI reach to this crucial system layer while maintaining control over its core functions and data. For phone manufacturers, embracing A2A is a pragmatic move. The GUI route proved unviable due to WeChat's blocks. A2A offers a compliant path to integrate a vital service, enhancing their AI assistants' usefulness. It allows them to focus on developing their own AI ecosystems for other services while cooperating on WeChat access. The collaboration is framed as a mutual, strategic necessity: Tencent gains a distribution channel, and manufacturers gain a key functionality. The partnership relies on a "dual authorization" mechanism for security, requiring both user and app consent for each action. While questions about long-term data privacy practices remain, experts note A2A is more secure and compliant than GUI automation. Ultimately, this cooperation is seen as a tentative, calculated truce. Tencent's long-term goal is to make WeChat an AI-powered "service OS." Phone manufacturers aim to make their system AI the central user interface. Their paths may converge or clash in the future, but for now, the A2A deal represents the opening chapter in the battle for the AI-era user入口, driven by necessity and strategic calculus on both sides.

marsbit1 ч. назад

From Banning Doubao to Embracing Honor: Why Did WeChat Suddenly 'Change Its Face'?

marsbit1 ч. назад

On-Chain Figures on the Eve of Kickoff: 1.6 Billion Traded Before the World Cup Even Begins

"On-Chain Numbers on the Eve of the World Cup: $1.6 Billion Traded Before Kick-off" Analysis of on-chain markets before the 2026 FIFA World Cup reveals significant crypto integration into football. The most striking figure is the approximately **$1.6 billion** in total trading volume on the single "World Cup Winner" contract on the Polymarket prediction market platform, accumulated before a single match was played. This represents explosive growth for a sector whose annual volume surged from ~$16B in 2024 to ~$64B in 2025. The ecosystem is maturing beyond speculation. Key developments include: 1) **Infrastructure upgrades** like Polymarket's migration to native, regulated USDC stablecoin for settlements; 2) **Reliable data oracles**, such as Chainlink, being used to resolve real-world match outcomes on-chain; and 3) **Official recognition**, with FIFA appointing its first-ever "Prediction Markets" partner. Over 100 contracts now cover everything from the outright winner to individual match results and even non-sporting risks like venue relocation. This evolution marks a fundamental shift. While crypto firms are absent from FIFA's top-tier sponsor list, the technology has deeply penetrated the tournament's financial and predictive infrastructure through regulated stablecoin settlements, decentralized oracles, and new official partnership categories. The regulatory landscape remains complex and varies by jurisdiction, but on-chain markets for the World Cup are already a multi-billion-dollar reality.

marsbit2 ч. назад

On-Chain Figures on the Eve of Kickoff: 1.6 Billion Traded Before the World Cup Even Begins

marsbit2 ч. назад

From SpaceX's IPO to the Future of Crypto: Which Crypto Sectors Will Host the Trillion-Dollar Narrative?

From the SpaceX IPO, which targets a $750 billion raise at a $1.77 trillion valuation, we can extrapolate capital flow trends relevant to crypto. The focus shifts from speculative narratives to foundational infrastructure and real-world asset (RWA) integration. Key crypto sectors poised to benefit include: 1. **AI Infrastructure**: The narrative is moving from consumer-facing AI applications to underlying, scarce resources like compute power and decentralized GPU networks (e.g., TAO, RENDER, AKT, IO). These protocols are positioning as the essential "picks and shovels" providers for the AI economy. 2. **Real-World Assets (RWA)**: Beyond tokenized treasury bonds, RWA's future lies in on-chain equity and pre-IPO assets like SpaceX. This could democratize access to high-growth assets and reshape global capital flows, benefiting infrastructure projects like ONDO, LINK, and Plume that facilitate issuance, data, and liquidity. 3. **Core Financial Infrastructure**: Stablecoins, payment networks, and DePIN (Decentralized Physical Infrastructure Networks) are critical for settling the future on-chain economy. Their role expands from internal trading tools to foundational layers for global finance, AI systems, and real-world asset networks, leading to potential value reassessment. In summary, the next cycle may prioritize long-term infrastructure value—AI compute, asset tokenization networks, and settlement layers—over short-lived application hype, mirroring the broader market's shift towards funding the foundational systems of the future.

marsbit2 ч. назад

From SpaceX's IPO to the Future of Crypto: Which Crypto Sectors Will Host the Trillion-Dollar Narrative?

marsbit2 ч. назад

Торговля

Спот
Фьючерсы

Популярные статьи

Неделя обучения по популярным токенам (2): 2026 может стать годом приложений реального времени, сектор AI продолжает оставаться в тренде

2025 год — год институциональных инвесторов, в будущем он будет доминировать в приложениях реального времени.

1.8k просмотров всегоОпубликовано 2025.12.16Обновлено 2025.12.16

Неделя обучения по популярным токенам (2): 2026 может стать годом приложений реального времени, сектор AI продолжает оставаться в тренде

Обсуждения

Добро пожаловать в Сообщество HTX. Здесь вы сможете быть в курсе последних новостей о развитии платформы и получить доступ к профессиональной аналитической информации о рынке. Мнения пользователей о цене на AI (AI) представлены ниже.

活动图片