Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
This article examines ERC8126, a proposed framework for off-chain contract, media, web, and wallet verification and risk scoring for AI agents registered through ERC8004.
We follow the proposal to explain how off-chain verification of agents registered through ERC8004 works and how scores and proofs are handled.
Even as on-chain agent registration and discovery advance, services still differ in how they assess trustworthiness. ERC8126 proposes a framework in which verification providers start with agents registered in the ERC8004 Identity Registry, perform five kinds of off-chain verification covering contracts, media, Solidity, the web, and wallets, and consolidate the results into ZKPs and risk scores from 0 to 100.
ZKP・PDV
A ZKP (zero-knowledge proof) is a cryptographic mechanism that can demonstrate that something has been verified without disclosing its contents. PDV (Private Data Verification) handles intermediate verification data through ZKPs and proof IDs rather than writing the raw data on-chain.
Overview
ERC8126 starts with an agent minted in the ERC8004 Identity Registry (the ERC721 tokenId is its agentId). It reads the metadata, performs five checks—contract (ETV), media (MCV), Solidity (SCV), HTTPS endpoint (WAV), and wallet (WV)—and covers Private Data Verification (PDV) and overall risk.
The verification itself takes place off-chain. An attestation can optionally be posted to the ERC8004 Validation Registry.
Identity Registry and tokenURI
The Identity Registry is one of the ERC8004 registries. It registers an agent as an ERC721 tokenId (the agentId here) and returns its metadata URL through tokenURI.
Validation Registry and attestations
The Validation Registry is another ERC8004 component. Verification results can be posted as attestations (signed claims), making agents easier to discover alongside other indicators.
Key points
Starting with the agentId, the provider follows tokenURI to retrieve JSON, performs checks using only the fields present, and calculates overall risk as the arithmetic mean of the scores.
Intermediate verification data is then consolidated into ZKPs through PDV and handled using proof IDs.
Detailed results are visible only to the wallet holder, while other users receive a summary.
| Item | Details |
|---|---|
| Official name | AI Agent Verification |
| Target | Agent registered through ERC8004 (identified by agentId) |
| Verification location | Off-chain (reduces gas costs and accommodates complex checks) |
| Specialized verification | Contract (ETV), media (MCV), Solidity (SCV), HTTPS endpoint (WAV), and wallet (WV), performed according to the metadata fields |
| Aggregation | ZKP and proof IDs through PDV; overall score is the arithmetic mean of individual scores |
| Optional | Post an attestation to the ERC8004 Validation Registry |
Contract (ETV) checks contracts, media (MCV) checks media, Solidity (SCV) checks source code, HTTPS endpoint (WAV) checks HTTPS, and wallet (WV) compares wallet transaction history against threat intelligence. The overall score uses a common 0–100 scale. It can be posted to the Validation Registry when needed to make agents easier to discover alongside other indicators.
For more on ERC8004, see the following article.
[ERC8004] Understanding Trustless Agents
For more on ERC721, see the following article.
[ERC721] An Introduction to ERC721
Motivation
Background
Even as AI agents become easier to register and list on-chain, the procedures and metrics for determining how far to trust them still differ across services.
Several aspects need to be examined. These include whether contracts behave as intended, the authenticity of HTTPS endpoints and media, wallet transfer histories, and comparisons against threat intelligence. Using a different tool for each of these checks, however, fragments operations.
Verification, scoring, and registration
The proposal assesses trustworthiness across five categories: contract (ETV), media (MCV), Solidity (SCV), HTTPS endpoint (WAV), and wallet (WV). Providers implement all five in a consistent form so that every agent can be verified using the same procedure. Intermediate verification data is consolidated into ZKPs before it is handled. This avoids writing sensitive information, such as the contents of transfer histories, to the chain in full. Scores use a common 0–100 scale to make agents easier to compare. Agent registration follows ERC8004, standardizing how agent IDs and metadata are retrieved.
It has been noted that ZKPs based on elliptic curves could theoretically become vulnerable to cryptanalysis as quantum computing advances. For data that must be retained long-term, the proposal includes optional QCV (Quantum Cryptography Verification), which can layer additional mechanisms such as symmetric-key cryptography over the existing system.
QCV
QCV (Quantum Cryptography Verification) is not mandatory. It is an additional option for protecting long-lived data using mechanisms such as symmetric-key cryptography. It is also included as a possible response to concerns about advances in quantum computing.
The following diagram illustrates an optional long-term storage protection mechanism layered over elliptic-curve-based ZKPs.

The lower layer shows the ZKPs used by PDV (such as elliptic-curve-based circuits). Above it, QCV is shown with a dotted line or separate box as an optional addition that layers other mechanisms, such as symmetric keys, for long-term storage. The higher layers are optional and supplementary.
Specification
The verification target is restricted to an ERC8004 agentId. JSON is retrieved from the Identity Registry's tokenURI, and the five checks—contract (ETV), media (MCV), Solidity (SCV), HTTPS endpoint (WAV), and wallet (WV)—use only the fields present.
The results are aggregated into an overall risk score by averaging the scores, which may then be posted to the Validation Registry.
The proposal also includes events and read calls (such as view functions) for returning the latest score in a recording contract.
The complete ERC8126 verification flow is illustrated below.

This diagram, supplied with the proposal, shows the entire flow through its layout: from agentId, the Identity Registry, and tokenURI as the metadata entry point, through individual contract (ETV), media (MCV), Solidity (SCV), HTTPS endpoint (WAV), and wallet (WV) scores (0–100), aggregation into overall risk, PDV and proof IDs, and optional on-chain recording or submission to the Validation Registry.
The diagram uses swimlanes, block boundaries, arrow directions, and labels to make the roles distinguishable through boxes and arrows alone.
The next diagram simplifies the same process into a single vertical path while corresponding to the official diagram. Use the official diagram for the overall structure and the simplified diagram to follow the individual steps in sequence.
flowchart TD A[agentId] --> B["Identity Registryで<br/>tokenURIを取得"] B --> C["JSONメタデータを取得"] C --> D["コントラクト(ETV)<br/>メディア(MCV)<br/>Solidity(SCV)<br/>HTTPSのエンドポイント(WAV)<br/>ウォレット(WV)<br/>(該当フィールドがある分)"] D --> E["各タイプのスコア 0〜100"] E --> F["全体リスクは平均"] F --> G["PDVでZKPとProof ID"] G --> H["任意でValidation Registryへ"]
This diagram traces the process from top to bottom: retrieve JSON through tokenURI using the agentId, run the five verification types for the fields present, obtain their individual scores (0–100), average the overall risk, apply PDV (ZKP and proof ID), and optionally proceed to the Validation Registry.
Read nodes A through H as groups corresponding to the official diagram above.
- Start with the agentId
The verification target is always the
agentIdregistered in the ERC8004 Identity Registry (theuint256tokenId). Verification cannot begin through a different route. - Retrieve tokenURI from the Identity Registry
The provider calls
tokenURI(agentId)on the registry and uses the returned URI string as the next retrieval destination. - Retrieve the JSON metadata
Retrieve that URI using
fetchor a similar mechanism, producing JSON from which the proposal's keys (such ascontractAddress,url, andwalletAddress) can be read. - Run ETV, MCV, SCV, WAV, and WV for the fields present All five types are implemented, but types without corresponding metadata are not run or are skipped. Only the denominator of the average changes.
- Obtain a score (0–100) for each type Each check performed returns a risk score from 0 to 100 (a heuristic based on the provider's rules).
- Calculate overall risk using the arithmetic mean The arithmetic mean of the applicable scores is the overall risk. Using the same 0–100 scale makes agents easier to compare.
- Handle ZKPs and proof IDs through PDV Raw intermediate results are not placed on-chain in full; they are consolidated into ZKPs, proof IDs, and similar artifacts. This does not automatically constitute mathematical proof that each check is substantively correct.
- Optionally proceed to the Validation Registry Posting the overall score and proof to the ERC8004 Validation Registry as an attestation is optional and performed only where operational or product requirements call for it.

This overview shows how the ERC8126 verification provider operates off-chain in relation to the on-chain components of ERC8004, including the Identity Registry (agent registration and tokenURI) and the Validation Registry (attestations), and where results are returned.
The proximity of the blocks and their connecting arrows show how the registries, verification provider, and PDV relate to one another.
Entry point and metadata resolution
Verification always begins with the agentId (uint256) in the ERC8004 Identity Registry.
The provider first calls tokenURI(agentId) and retrieves JSON from the returned URI.
Fields listed in the proposal, including agentWallet, walletAddress, chain_id, contractAddress, endpoints, url, image, imageUrl, platform_id, and solidityCode, are read from this JSON.
They are interpreted according to the ERC8004 registration schema.
Checking a contract or wallet requires an unambiguous answer to which address on which network is being examined.
If chain_id is missing or invalid, the implementation resolves the chain, for example by using the provider's preconfigured chain, before proceeding with eth_getCode or HTTPS verification.
This article uses the term resolved to mean that the target has been clearly identified. A resolved target means that the chain and address to verify are uniquely determined.
Verification can only begin by following the metadata from the agentId.
It cannot start by independently supplying arbitrary addresses or URLs.
This ensures that the information read during verification matches the agent registered in the registry.
Five verification types
Providers implement all five types—contract (ETV), media (MCV), Solidity (SCV), HTTPS endpoint (WAV), and wallet (WV)—and use them according to the retrieved metadata. A verification type whose field is absent is skipped, or only the number of applicable scores used in the average changes. Each type returns a score from 0 to 100.
Terms such as appropriate, secure, and authentic are heuristic assessments based on the proposal's MUST/SHOULD requirements and 0–100 scores. For ETV below, the article explains what appropriate and secure mean in the proposal's MUST requirements. The depth of static analysis and the set of patterns used vary by provider and do not constitute a universal guarantee (see also What verification means for wallets and URLs below).
The following diagram illustrates which JSON fields feed into each verification type.

The arrows in each row show which verification type (ETV through WV) receives the corresponding JSON field in the left column as input. Verification types without corresponding metadata are not run or are skipped; only the denominator of the average changes.
Ethereum Token Verification(ETV)
The proposal calls this Ethereum Token Verification (ETV).
If contractAddress is present and fields such as chain_id have been resolved, the provider checks whether a deployed smart contract exists at that address on the identified chain and evaluates risk against known vulnerability patterns on a 0–100 scale.
Despite its name, Token is not limited to ERC-20 tokens; this check covers on-chain contract destinations.
Call eth_getCode on the resolved chain_id and confirm that the returned bytecode is not empty.
This verifies that executable code exists at the address, rather than simply an EOA.
The provider then compares it against known vulnerability patterns it maintains and generates a risk score.
The OWASP Smart Contract Security Verification Standard (SCSVS) is cited as implementation guidance.
Under the proposal's MUST requirements, appropriate includes at least legitimacy—an on-chain basis for verification, meaning that a contract is deployed on the specified chain_id.
Secure is not proof of absolute security; it is a relative indicator that quantifies the comparison against known patterns on a 0–100 scale.
Static-analysis coverage and pattern update frequency depend on the provider. ETV is not a substitute for an audit or formal verification.
Media Content Verification (MCV)
When fields such as imageUrl identify media, MCV examines authenticity (whether content has the claimed origin), provenance (clues about who created it and through which process), and integrity (whether it has been altered along the way).
For the retrieved binary, the provider checks embedded metadata and its contents, traces of tampering, and, if present, watermarks, steganography, and signatures.
Forensic analysis for signs of AI generation or synthetic video is a SHOULD (recommended).
It returns a score from 0 to 100.
Existing frameworks such as the C2PA implementation guidelines are cited as examples.
Solidity Code Verification (SCV)
If solidityCode is present in the metadata, SCV checks that the declared Solidity and the deployed on-chain bytecode are at least in a state that can be interpreted as deployed code, and scores risk from 0 to 100 according to common implementation flaws.
Call eth_getCode on the resolved chain_id and check that the bytecode is not empty (confirming that actual code exists on-chain).
Check common weakness patterns such as reentrancy and flash loan attacks, then produce a score from 0 to 100.
The framework alone does not guarantee a rigorous proof that the source exactly matches the bytecode.
Alignment with SCSVS is cited as an implementation guideline.
Web Application Verification (WAV)
For the url or endpoints array, check that the endpoints respond over HTTPS, that their TLS certificates are valid, and that they do not exhibit commonly known web vulnerability categories. Express the results on a 0–100 scale.
Common vulnerabilities refers to automated or semi-automated checks against publicly documented testing criteria such as OWASP's. It does not mean a complete penetration test of the entire site has been performed.
The proposal identifies the OWASP Web Security Testing Guide (WSTG) as a guideline.
Wallet Verification (WV)
For walletAddress or agentWallet, check whether the address has an on-chain transfer history, compare it against threat-intelligence databases (such as provider-maintained lists of reported abuse, sanctions, and fraud-related indicators), and generate a score from 0 to 100.
The mere presence of transaction history does not determine whether a wallet is good or bad. The score draws on factors such as whether an address is new or largely unused, or overlaps with known abuse patterns.
Threat intelligence
Think of this as a database used to compare wallet addresses with abuse and risk signals aggregated by third parties, such as fraudulent transfers or sanctions lists. Data sources and update frequencies differ among providers.
The following illustrates the relationship between the presence of transaction history and comparison against abuse signals.

The diagram isolates the flow: the wallet address is the input, it is checked for transaction history and compared against third-party aggregated lists, and the results feed into a 0–100 score. Actual data sources, update frequency, and scoring methods depend on the provider. The diagram is illustrative.
PDV and result visibility
Raw results from each verification type are converted into ZKPs through Private Data Verification (PDV) and handled as proof IDs. A ZKP is a mechanism for showing that something has been verified without writing raw intermediate data to the chain. It does not automatically provide mathematical proof that the substance of every specialized check is correct; that depends on circuit design and the provider's implementation. Other users receive summaries such as the overall risk score and proof ID, while the wallet holder can view the details.
The following diagram contrasts the visibility of raw data with that of the widely available summary.

The diagram separates the provider's raw data and details, which are not exposed directly on-chain, the summaries (scores, proof IDs, and similar data) available to general users, and the details accessible only to the wallet holder. It illustrates the proposal's division of roles: the original verification data stays off-chain, summaries such as scores and proof IDs are shared generally, and the wallet holder views the details.
Integration with ERC8004
Risk scores and proof IDs are posted as attestations to the ERC8004 Validation Registry. The aim is to make agents easier to discover alongside other indicators.
Why verification is performed off-chain
Verification itself is performed off-chain. The main reasons are as follows.
- Avoid gas costs for every verification
- Allow complex logic that would be too expensive on-chain
- Make it easier to update criteria without upgrades
- Allow multiple providers to compete
Payment protocol
If fees are charged, the pricing structure must be clearly disclosed before verification.
The proposal specifies payment in stablecoins and the use of EIP3009 TransferWithAuthorization for gasless transfers.
Risk scores and tiers
The overall score is calculated as the arithmetic mean of the applicable verification scores.
| Tier | Score range | Description |
|---|---|---|
| Low risk | 0–20 | Minor concerns |
| Moderate | 21–40 | Some review recommended |
| Elevated | 41–60 | Caution required |
| High risk | 61–80 | Significant concerns |
| Critical | 81–100 | Best avoided |
The following diagram illustrates the same categories as a linear scale.

The horizontal scale runs from lower scores and lower risk on the left to higher scores and critical risk on the right, with a label and score range for each tier. The table above defines the numerical boundaries; the diagram illustrates the colors and divisions.
Standard errors and custom errors
Implementations distinguish the following codes and names.
| Code | Name | Meaning |
|---|---|---|
0x01 |
InvalidAddress |
Invalid address format |
0x02 |
InvalidURL |
Invalid URL or non-HTTPS URL |
0x03 |
AgentNotFound |
No agent exists for the agentId |
0x04 |
VerificationFailed |
Provider-side error |
0x05 |
InsufficientCredits |
Insufficient credits |
0x06 |
InvalidProof |
PDV proof verification failed |
0x07 |
ProviderUnavailable |
Provider is not responding |
0x08 |
InvalidScore |
Score outside the 0–100 range |
0x09 |
ContractNotFound |
No contract exists on the chain |
0x0A |
SolidityCodeNotFound |
The specified Solidity code could not be resolved |
0x0B |
ImageNotFound |
Image retrieval failed |
0x0C |
SteganographyFailed |
Technical failure in steganographic extraction |
0x0D |
MediaVerificationFailed |
General media verification failure |
When an on-chain operation fails and reverts, it is expected to return a custom error using one of the error names listed in the proposal (the error corresponding to the Name column above).
The numerical codes primarily provide a mapping for off-chain implementations and APIs to use in logs and responses.
Optional on-chain interface
Although verification itself is primarily off-chain, providers and integrators may optionally deploy a contract to record scores and attestations.
IERC8126 interface
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;
interface IERC8126 {
event AgentVerified(
uint256 indexed agentId,
uint8 overallRiskScore,
bytes32 etvProofId,
bytes32 mcvProofId,
bytes32 scvProofId,
bytes32 wavProofId,
bytes32 wvProofId,
bytes32 summaryProofId
);
event AttestationPosted(
uint256 indexed agentId,
uint8 riskScore,
bytes32 proofId
);
function getLatestRiskScore(uint256 agentId) external view returns (uint8);
}The IERC8126 interface above is the proposal's example of an optional recording contract.
It contains no verification logic, defining only two events and one read function (external view).
Once the overall score and proof IDs have been determined off-chain, the following diagram shows how the optional recording contract and Validation Registry interact as envisioned by the proposal. After reviewing the diagram, see the explanation directly below for the meaning of each node.
flowchart TD
A[オフチェーン検証と PDV] --> B[総合スコアと Proof ID が確定]
B --> C{任意の<br/>記録用コントラクト}
C --> D["emit AgentVerified"]
B --> E{任意の<br/>Validation Registry}
E --> F[アテステーションを投稿]
F --> G["emit AttestationPosted"]
A–B represent the stages in which the off-chain results are collected. C–D are the optional branch that emits AgentVerified in the recording contract. E–G are the optional branch that writes to the registry and then emits AttestationPosted.
The upper and lower branches distinguish their roles: AgentVerified records the complete verification results (individual proof IDs and the overall score) in the recording contract, while AttestationPosted logs the fact that submission to the registry has completed.
Neither is mandatory; only the branches needed for operations are used.
The following sections extract each event and function signature, followed by tables explaining the fields, arguments, and return values. Events list their fields, while functions have separate tables for parameters and return values. As in related standards articles such as ISPVGateway, the structure is the full interface, then code, explanation, and tables for each element.
AgentVerified
event AgentVerified(
uint256 indexed agentId,
uint8 overallRiskScore,
bytes32 etvProofId,
bytes32 mcvProofId,
bytes32 scvProofId,
bytes32 wavProofId,
bytes32 wvProofId,
bytes32 summaryProofId
);This event records the overall risk and the proof IDs for each type together on-chain after all verification has been completed. Front ends and indexers can use the log to track which agentId received which score for which set of proof IDs.
| Field | Description |
|---|---|
agentId (indexed) |
Identifies the agent whose verification results the event refers to.It is expected to use the same identifier as the agentId (the uint256 tokenId) in the ERC8004 Identity Registry. |
overallRiskScore |
Overall risk, calculated by averaging the scores from contract (ETV) through wallet (WV) verification. An integer from 0 to 100. |
etvProofId |
Identifier assigned after consolidating the contract verification (ETV) results through PDV.The original data is not placed on-chain; it is assumed to be accessible by reference through this ID. |
mcvProofId |
Identifier assigned after processing the media verification (MCV) results through PDV. |
scvProofId |
Identifier assigned after processing the Solidity code verification (SCV) results through PDV. |
wavProofId |
Identifier assigned after processing the web endpoint verification (WAV) results through PDV. |
wvProofId |
Identifier assigned after processing the wallet verification (WV) results through PDV. |
summaryProofId |
Proof ID referring to the complete set of verification results.Used alongside the individual type IDs to trace the full result set of this verification run for auditing or display. |
Each bytes32 is an identifier handled through PDV (the ZKP and proof ID framework), rather than the raw data itself.
Consumers interpret which proof type corresponds to each ID using the field names.
AttestationPosted
event AttestationPosted(
uint256 indexed agentId,
uint8 riskScore,
bytes32 proofId
);This event is emitted after writing an attestation to the ERC8004 Validation Registry. It also records the risk score and proof ID in the chain's logs. Integrators can trace the registration flow through the accumulated logs without following the steps across registries.
| Field | Description |
|---|---|
agentId (indexed) |
ID identifying the agent to which the submission relates.It is expected to be the same agentId used when writing to the Validation Registry. |
riskScore |
Explicitly records the same overall risk (0–100) as the attestation in the event. |
proofId |
PDV proof ID associated with the submission.Allows the relationship between the score and proof to be traced from the log alone. |
The event provides an additional record of the same fact for consumers who may find it difficult to extract the information from the registry transaction body alone.
getLatestRiskScore
function getLatestRiskScore(uint256 agentId) external view returns (uint8);This function is defined as external view and returns the latest recorded overall risk score (0–100) for a specified agentId.
It does not update storage; it only reads from the recording contract deployed on-chain.
A dApp or another contract can use it when only the numerical score is needed for an agent list or filter.
Parameters
| Name | Type | Description |
|---|---|---|
agentId |
uint256 |
ID of the agent whose overall score is requested.Uses the same identifier scheme as the event's agentId. |
Return value
| Type | Description |
|---|---|
uint8 |
Latest overall risk (0–100) stored in the contract.Behavior when no record exists depends on the deployed implementation. |
The intended use is for a UI to retrieve the score it should currently display without spending gas.
Additional considerations
Standards referenced for signatures, payments, and registration
When an agent owner signs a verification request or fee authorization, EIP155 binds it to a chain to prevent replay, EIP191 standardizes the signed data format, and EIP712 includes the agentId, metadata hash, nonce, and payment information in a signature payload that is easier to read in a wallet.
If fees are charged, EIP3009 TransferWithAuthorization is used for stablecoin payments in a context where gas costs are sponsored.
The single source for registration is the ERC8004 Identity Registry, where the ERC721 tokenId serves as the agentId.
For more on EIP155, EIP191, and EIP712, see the following articles.
[EIP155] Understanding Replay Protection on Ethereum
[ERC191] Using Signed Data Securely
[EIP712] Understanding Typed Structured Data Hashing and Signing
Verification type ordering and roles
Contract (ETV), media (MCV), Solidity (SCV), HTTPS endpoint (WAV), and wallet (WV) appear in that order, corresponding to contracts, media, Solidity, the web, and wallets.
Risk score range and the purpose of PDV and QCV
The common 0–100 scale allows agents to be placed side by side and compared using the same metric. PDV (Private Data Verification) consolidates intermediate data into ZKPs without disclosing it in full. This avoids writing the contents of individual transfer histories and similar information to the chain. QCV (Quantum Cryptography Verification) is not mandatory; it is an optional addition for protecting long-lived data using mechanisms such as symmetric-key cryptography.
Test cases
The following are outlines of Foundry-style test functions corresponding to the proposal's Test Cases. The names and comments are examples reflecting the intent of the draft. Implementation details depend on the provider's verification logic.
Verification tests
These examples isolate whether each verification type completes according to the metadata fields, and whether PDV/ZKPs, the overall score, event emission, and custom-error reverts behave as expected.
ETV completes when contractAddress is present
Verify that ETV succeeds when the metadata contains contractAddress.
function testETVCompletesWhenContractAddressPresent() public {
uint256 agentId = 1;
vm.prank(user);
// bytes32 proofId = verifier.verifyETV(agentId);
}MCV completes when imageUrl is present
Verify that MCV succeeds when imageUrl is present.
function testMCVCompletesWhenimageUrlPresent() public {
uint256 agentId = 42;
vm.prank(user);
// verifier.verifyMCV(agentId);
}SCV completes when solidityCode is present
Verify that SCV succeeds when solidityCode is present.
function testSCVCompletesWhensolidityCodePresent() public {
uint256 agentId = 42;
vm.prank(user);
// verifier.verifySCV(agentId);
}WAV completes for multiple agentId values
Vary the agentId across several values (e.g., 10, 20, 30) and verify that WAV runs correctly.
function testWAVCompletesForAllAgentIds() public {
uint256[] memory ids = new uint256[](3);
ids[0] = 10; ids[1] = 20; ids[2] = 30;
for (uint i = 0; i < ids.length; i++) {
vm.prank(user);
// verifier.verifyWAV(ids[i]);
}
}WV completes for multiple agentId values
Verify that WV succeeds for multiple agentId values.
function testWVCompletesForAllAgentIds() public {
uint256[] memory ids = new uint256[](3);
ids[0] = 10; ids[1] = 20; ids[2] = 30;
for (uint i = 0; i < ids.length; i++) {
vm.prank(user);
// verifier.verifyWV(ids[i]);
}
}PDV/ZKPs are generated for each type
Verify that proofs of all types are generated for the agentId.
function testGeneratesPDVZKPForEachType() public {
uint256 agentId = 100;
vm.prank(user);
// verifier.verifyAgent(agentId);
}Calculating the average overallRiskScore
Verify that the average calculation for overallRiskScore is correct.
function testCalculatesOverallRiskScore() public {
uint8 score = verifier.calculateRiskScore(10, 20, 30, 40);
assertEq(score, 25);
}Emitting the AgentVerified event
Verify that AgentVerified is emitted with proof IDs.
function testEmitsAgentVerifiedEvent() public {
uint256 agentId = 999;
vm.expectEmit(true, true, true, true);
emit AgentVerified(agentId, 45, [bytes32(1), bytes32(2), bytes32(3), bytes32(4)]);
}Reverting with VerificationFailed
Verify that a provider failure reverts with VerificationFailed.
function testRevertsWithVerificationFailed() public {
vm.expectRevert(VerificationFailed.selector);
}Reverting with InsufficientCredits
Verify that a user without credits is blocked with InsufficientCredits.
function testRevertsWithInsufficientCredits() public {
vm.prank(poorUser);
vm.expectRevert(InsufficientCredits.selector);
}Access control
When an on-chain component manages proofs or history, this example checks through a revert that only authorized parties, such as the agent owner, can access the information.
Access to proofs by unauthorized parties
Prevent anyone other than the owner from accessing proofs.
function testUnauthorizedProofAccess() public {
vm.prank(0xBBBB);
vm.expectRevert(UnauthorizedAccess.selector);
registry.getAgentProofs(1234);
}Risk scores
This example uses assert to check that classification from a numerical score into a RiskTier (low, moderate, and so on) is consistent with the thresholds.
Risk tier classification
Verify that each score maps to the correct RiskTier.
function testRiskScoreTiers() public {
assertEq(verifier.getRiskTier(15), RiskTier.Low);
assertEq(verifier.getRiskTier(35), RiskTier.Moderate);
}Compatibility
Agents registered through ERC8004 can use the verification flow defined by this proposal directly.
No other token standards need to be broken.
Implementations not using ERC8004 must mint into the Identity Registry and place JSON conforming to the specification at tokenURI.
Reference implementation
What this implementation does
ERC8126 (ERCS/erc-8126.md) contains a reference implementation using TypeScript and viem.
The reference implementation outlines the following process.
- Read tokenURI from the Identity Registry and retrieve JSON
resolveAgentMetadatacallstokenURIthrough viem and usesfetchto retrieve JSON from the returned URI. - Run the five checks—contract (ETV), media (MCV), Solidity (SCV), HTTPS (WAV), and wallet (WV)—in parallel with Promise.all All five run concurrently and each reads the metadata.
- Calculate average risk, tier, and a PDV identifier, optionally proceed with submission-related processing for the Validation Registry, and return the result object
If
validationRegistryis absent, registry-related processing is skipped.
The following points apply to the use of getAddress.
- It is a function for checksummed addresses, but this code also applies it to
imageUrlandsolidityCode. The specification treats these fields as URLs or source strings, so production-oriented code should handle them as strings appropriate to the field type.
Flow diagram

The diagram arranges the stages of verifyAgent in boxes from left to right.
Read each box alongside the numbered steps below, referring to the code for details.
The flow in the diagram is as follows.
- Retrieve metadata
Resolve
tokenURIfrom theagentIdand the ERC8004 Identity Registry, then read JSON from the returned URI. - Run all five checks (ETV, MCV, SCV, WAV, and WV) in parallel with Promise.all In this example, each check returns a fixed score and a hash-derived proofId.
- Determine the average risk and tier Average the five scores and classify the result into a tier using thresholds.
- Generate an identifier for PDV
- Optionally perform QCV
- Proceed with Validation Registry processing only when configured
In the reference implementation,
submitToValidationRegistryonly returns a PDV identifier. - Return the result object
The reference implementation lets readers follow the process from entry point to return value.
import crypto from 'crypto';
import { createPublicClient, http, getAddress, parseAbi } from 'viem';
class ERC8126Error extends Error {
constructor(
public code: number,
message: string
) {
super(message);
this.name = 'ERC8126Error';
}
}
enum VerificationStatus {
Passed = 'passed',
Failed = 'failed',
Inconclusive = 'inconclusive',
}
enum RiskTier {
Low = 'low',
Moderate = 'moderate',
Elevated = 'elevated',
HighRisk = 'high',
Critical = 'critical',
}
interface AgentMetadata {
contractAddress?: string;
solidityCode?: string;
url?: string;
walletAddress?: string;
chain_id?: number;
[key: string]: any;
}
interface VerificationProviderConfig {
chainId?: number;
identityRegistry?: string;
validationRegistry?: string;
rpcUrl?: string;
}
interface VerificationResult {
type: string;
status: VerificationStatus;
score: number;
proofId: string;
}
const ERC8004_ABI = parseAbi([
'function tokenURI(uint256 tokenId) external view returns (string)',
]);
async function resolveAgentMetadata(
agentId: bigint,
config: VerificationProviderConfig
): Promise<AgentMetadata> {
if (!config.identityRegistry) {
throw new ERC8126Error(0x03, 'ERC-8004 Identity Registry address is required');
}
if (!config.rpcUrl) {
throw new ERC8126Error(0x04, 'RPC URL is required to resolve ERC-8004 metadata');
}
const client = createPublicClient({
chain: { id: config.chainId || 1, name: 'Ethereum', nativeCurrency: { name: 'ETH', symbol: 'ETH', decimals: 18 } },
transport: http(config.rpcUrl),
});
try {
const uri = await client.readContract({
address: getAddress(config.identityRegistry),
abi: ERC8004_ABI,
functionName: 'tokenURI',
args: [agentId],
});
if (!uri || typeof uri !== 'string') {
throw new ERC8126Error(0x05, 'Invalid tokenURI returned from ERC-8004 registry');
}
const response = await fetch(uri);
if (!response.ok) {
throw new ERC8126Error(0x06, `Failed to fetch metadata from ${uri}`);
}
const metadata: AgentMetadata = await response.json();
return {
contractAddress: metadata.contractAddress ? getAddress(metadata.contractAddress) : undefined,
imageUrl: metadata.imageUrl ? getAddress(metadata.imageUrl) : undefined,
solidityCode: metadata.solidityCode ? getAddress(metadata.solidityCode) : undefined,
walletAddress: metadata.walletAddress ? getAddress(metadata.walletAddress) : undefined,
url: metadata.url,
chain_id: metadata.chain_id,
...metadata,
};
} catch (error) {
if (error instanceof ERC8126Error) throw error;
throw new ERC8126Error(0x07, `Metadata resolution failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
}
}
async function ETV(m: AgentMetadata, c: VerificationProviderConfig): Promise<VerificationResult> {
return {
type: 'ETV',
status: VerificationStatus.Passed,
score: 25,
proofId: generateProofId('ETV', m.contractAddress || ''),
};
}
async function MCV(m: AgentMetadata, c: VerificationProviderConfig): Promise<VerificationResult> {
return {
type: 'MCV',
status: VerificationStatus.Passed,
score: 30,
proofId: generateProofId('MCV', m.imageUrl || ''),
};
}
async function SCV(m: AgentMetadata, c: VerificationProviderConfig): Promise<VerificationResult> {
return {
type: 'SCV',
status: VerificationStatus.Passed,
score: 30,
proofId: generateProofId('SCV', m.solidityCode || ''),
};
}
async function WAV(m: AgentMetadata): Promise<VerificationResult> {
return {
type: 'WAV',
status: VerificationStatus.Passed,
score: 15,
proofId: generateProofId('WAV', m.url || ''),
};
}
async function WV(m: AgentMetadata): Promise<VerificationResult> {
return {
type: 'WV',
status: VerificationStatus.Passed,
score: 20,
proofId: generateProofId('WV', m.walletAddress || ''),
};
}
function calculateOverallRiskScore(scores: number[]): number {
const valid = scores.filter((s) => s >= 0 && s <= 100);
return valid.length ? Math.round(valid.reduce((a, b) => a + b, 0) / valid.length) : 0;
}
function getRiskTier(score: number): RiskTier {
if (score <= 20) return RiskTier.Low;
if (score <= 40) return RiskTier.Moderate;
if (score <= 60) return RiskTier.Elevated;
if (score <= 80) return RiskTier.HighRisk;
return RiskTier.Critical;
}
function generatePDVProof(result: any): string {
return '0x' + crypto.createHash('sha256').update(JSON.stringify(result) + Date.now().toString()).digest('hex');
}
async function QCV(data: any) {
return {
recordId: '0x' + crypto.createHash('sha256').update(Date.now().toString()).digest('hex'),
algorithm: 'AES-256-GCM',
};
}
export async function verifyAgent(agentId: bigint, config: VerificationProviderConfig) {
const metadata = await resolveAgentMetadata(agentId, config);
const [etv, mcv, scv, wav, wv] = await Promise.all([
ETV(metadata, config),
MCV(metadata, config),
SCV(metadata, config),
WAV(metadata),
WV(metadata),
]);
const overallRiskScore = calculateOverallRiskScore([etv.score, mcv.score, scv.score, wav.score, wv.score]);
const riskTier = getRiskTier(overallRiskScore);
const pdvProofId = generatePDVProof({ etv, mcv, scv, wav, wv, overallRiskScore, agentId: agentId.toString() });
const qcvRecord = await QCV({ overallRiskScore, pdvProofId });
const validationRecord = config.validationRegistry
? await submitToValidationRegistry(agentId, overallRiskScore, pdvProofId, config)
: null;
return {
agentId,
overallRiskScore,
riskTier,
etv,
mcv,
scv,
wav,
wv,
pdvProofId,
qcvRecord,
validationRecord,
verifiedAt: new Date().toISOString(),
};
}
async function submitToValidationRegistry(
agentId: bigint,
score: number,
pdvProofId: string,
config: VerificationProviderConfig
) {
return pdvProofId;
}
function generateProofId(type: string, data: string): string {
const input = `${type}:${data}:${Date.now()}`;
return '0x' + crypto.createHash('sha256').update(input).digest('hex');
}
export { verifyAgent };Types and errors
The main types have the following roles.
| Type | Role |
|---|---|
ERC8126Error |
Distinguishes failures using a numerical code and message. |
VerificationStatus |
Represents the outcome of each check (passed, failed, or inconclusive). |
RiskTier |
Maps the overall score to a tier label. |
The values shown here are illustrative; the actual pass/fail rules are defined in a separate implementation.
Metadata resolution and provider configuration
The flow of resolveAgentMetadata is as follows.
- Return an error if identityRegistry or rpcUrl is missing
The respective
ERC8126Errorcodes are0x03and0x04. - Use viem to call a minimal ABI containing only tokenURI and obtain the URI
Use
readContractto read the URI string from the registry. - Fetch the URI and parse the JSON
If
response.okis false, use0x06; other failures outside JSON handling are consolidated into0x07bycatch. - Represent all failures as ERC8126Error
If the error is already an
ERC8126Error, rethrow it unchanged.
The fields referenced by the five checks are collected in AgentMetadata from the JSON at the ERC8004 tokenURI.
The main AgentMetadata fields map to the checks as follows.
| Field (reference implementation) | Primary verification type | Description |
|---|---|---|
contractAddress |
ETV (contract) | Address of the target contract. |
imageUrl |
MCV (media) | URL of an image or similar resource. Some lines of code apply getAddress, but the field is intended to be handled as a string. |
solidityCode |
SCV (Solidity) | Source code string. |
url |
WAV (HTTPS) | HTTPS URL to verify. |
walletAddress |
WV (wallet) | Wallet address. |
chain_id and others |
— | Other fields. An index signature also accepts keys not listed in the specification. |
The fields of VerificationProviderConfig are as follows.
| Field | Meaning |
|---|---|
chainId |
Chain ID. |
identityRegistry |
Address of the ERC8004 Identity Registry. |
validationRegistry |
Optional Validation Registry. |
rpcUrl |
RPC used in retrieving JSON-LD. |
Individual verification results and the overall score
In the reference implementation, instead of performing the actual static analysis or media inspection, each specialized check returns a fixed score and a hash string derived from its type, input, and current time as the proof identifier. The main points of each check are listed below.
| Verification | Fixed score (reference) | Provider configuration as second argument | Main proofId input |
|---|---|---|---|
| ETV (contract) | 25 | Accepted | contractAddress |
| MCV (media) | 30 | Accepted | imageUrl |
| SCV (Solidity) | 30 | Accepted | solidityCode |
| WAV (HTTPS) | 15 | Not accepted | url |
| WV (wallet) | 20 | Not accepted | walletAddress |
Aggregation and related processing work as follows.
| Item | Reference implementation behavior |
|---|---|
| Overall score and tier | Calculate the arithmetic mean of scores in the 0–100 range and assign tiers at 20-point intervals. |
| PDV string | SHA-256 of the results combined with a timestamp. It is not a ZKP backed by a circuit. |
| QCV | Illustrates the return format only and does not include production-grade checks. |
From verifyAgent to the return value
The only external entry point is verifyAgent.
Operations within the function occur in the following order.
- Retrieve metadata with resolveAgentMetadata
After checking
identityRegistryandrpcUrl, readtokenURIthroughreadContract, fetch the URI as JSON, and represent failures asERC8126Error. - Call ETV, MCV, SCV, WAV, and WV with Promise.all
Pass
configas the second argument to ETV, MCV, and SCV, and pass only metadata to WAV and WV. - Calculate the mean with calculateOverallRiskScore and determine the tier with getRiskTier Normalize the five scores to the 0–100 range before averaging. Tier thresholds are spaced at 20-point intervals.
- Generate a PDV identifier with generatePDVProof
Serialize the intermediate results and
agentIdas JSON, include the current time, and calculate SHA-256. - Perform QCV The returned values are an illustrative recordId and algorithm name.
- Call submitToValidationRegistry if validationRegistry is configured (it only returns a PDV identifier and does not submit an on-chain transaction)
If not configured, skip this branch and leave
validationRecordas null. - Return the result object
Include the
agentId, overall score and tier, individual verification results, PDV, QCV, and registry values, andverifiedAt.
Additional notes follow.
| Item | Details |
|---|---|
| proofId of each specialized check | Hash of the type, input, and current time; not reproducible. |
| Return value for the Validation Registry | Merely returns a PDV identifier. |
| Production registry integration | Replace the example with transactions or internal APIs appropriate to the ERC8004 Validation Registry in the operational environment. |
Security considerations
What verification means for wallets and URLs
Verification is only a technical check at a particular point in time. It does not guarantee subsequent behavior or intentions. Scores are guidance; the final decision belongs to the user.
If the wallet used for registration is compromised, an attacker could impersonate the legitimate agent. Private keys must be protected from disclosure to others.
If a URL is hijacked after registration, malicious content could be served from it. It is important to check the current state before use and rerun WAV to detect anomalies.
Interacting with contracts
Agents that register a contractAddress retain the same risks as ordinary smart contracts.
ETV and SCV are only preliminary checks, so the proposal recommends considering separate reviews or audits of code that will actually be used.
ZKPs and quantum computing
For PDV-generated ZKPs to be trustworthy in production, the circuits used must be audited and the setup must resist tampering. Guidelines include distributing trust through a ceremony with multiple participants and using proven verifiers for on-chain verification.
For elliptic-curve-based ZKPs, the long-term implications of quantum computing advances must also be considered. For valuable data retained long-term, the proposal includes the option of layering mechanisms such as symmetric-key cryptography through QCV in response to concerns about future quantum computing and elliptic-curve ZKPs alone.
Provider trust and attack scenarios
Because providers vary in their services and independence, users must choose providers, taking into account the possibility of third-party verification of PDV ZKPs.
While the creation of many agents in ERC8004 through a Sybil attack can be discouraged by minting costs and reputation, the proposal also identifies risks such as providers colluding with malicious agents to give them unjustifiably favorable ratings. For high-risk applications, the proposal recommends using multiple independent providers.
Registry dependencies
When using the ERC8004 registries, operations must ensure that the correct deployment addresses are used and that the contents of tokenURI have not been tampered with.
Conclusion
Starting with an agent registered in the ERC8004 Identity Registry, this framework combines five types of off-chain verification—contract (ETV), media (MCV), Solidity (SCV), HTTPS endpoint (WAV), and wallet (WV)—with PDV, a 0–100 risk score, and optional use of the Validation Registry. Using common metrics to determine how far to trust agents is likely to become increasingly important.
The proposal, Ethereum Magicians discussion, and official SVG diagram are linked below.
I also publish articles elsewhere, which you are welcome to explore.





