The On-Chain Story

From Quote to Proof:
Bench on X Layer

Every certificate Bench issues becomes an immutable, verifiable record on X Layer Mainnet. This is the story of what happens on-chain — what's live today, and where it's going.

1

The Trust Gap

An autonomous agent says it got the best price on a swap. But who verified that? The agent itself? That's like asking a student to grade their own exam.

Before Bench, there was no way to independently prove that an agent's trade was optimal — or even fair. Execution quality was a black box. DAOs allocated millions to trading agents with zero accountability for the routes they chose.

Bench changes this by creating a cryptographic paper trail that starts with 13 DEX aggregators and ends with an immutable record on X Layer.

2

The Journey of a Certificate

Every on-chain anchor starts the same way — an agent asks a question: "Is this a good trade?"

A

The Query

An agent calls POST /v1/certify with its swap details — tokens, amount, chain, slippage tolerance.

B

The Fan-Out

13 DEX aggregators are queried in parallel: 1inch, Paraswap, KyberSwap, OKX, OpenOcean, 0x, CoW Swap, Odos, LI.FI, Socket, Jupiter, Uniswap, and Dexalot. Each returns its best quote.

C

The Consensus

Outliers are removed using median absolute deviation. The remaining quotes produce a consensus best price and an agreement score (0-100%) measuring how closely sources aligned.

D

The Signature

A BEC v2 certificate is built — containing every quote, the consensus result, and a certification level (CERTIFIED / WARNING / FAILED). The attestor signs it using EIP-712 typed data.

E

The Anchor

The certificate hash, certification level, agreement score, and source counts are written to BenchRegistry.sol on X Layer. This happens asynchronously — the API returns immediately while the transaction confirms in the background.

By the time the agent receives its certificate, the proof is already being committed to X Layer. No extra step. No opt-in. Every cert is anchored.

3

What's On-Chain Today

BenchRegistry.sol is live on X Layer Mainnet. Here's what's already provable on-chain:

Live Contract

Address: 0x6a400d858daA46C9f955601B672cc1a8899DcE3f
Chain: X Layer Mainnet (196)
Status: Actively anchoring certificates
anchorCertificate()Live

Every certificate issued by the attestor is anchored automatically. The cert hash, certification level, agreement score, and source counts become permanent on-chain records. Duplicates are rejected — each cert can only be anchored once.

batchAnchor()Live

Gas-efficient batching for high-throughput scenarios. Multiple certs can be anchored in a single transaction, reducing per-cert gas cost for bulk operations.

getAgentStats()Live

Trustless on-chain reputation. Anyone can query how many CERTIFIED, WARNING, and FAILED certs an agent has received — no API needed, no trust required. This is the foundation of agent accountability.

getAnchor()Live

Full cert lookup by hash. Returns the anchor record including block number, timestamp, certification level, agreement score, sources queried, sources successful, and the attestor signature hash.

getAgentCerts()Live

Paginated certificate history per agent. Protocols can enumerate every cert an agent has ever received, building a complete execution quality timeline.

4

Post-Trade Accountability

Certification is only half the story. The other half: did the agent actually follow through?

BenchRegistry has a built-in mechanism for closing the accountability loop:

markExecutionVerified()Ready

After an agent executes a trade, the attestor can record whether the execution honored the certified route. This writes three pieces of data on-chain:

  • The original cert hash — linking back to the pre-trade certification
  • Whether the execution was honored — did the agent use the certified route?
  • The transaction hash — pointing to the actual swap on-chain

This creates a complete audit trail: pre-trade certification on-chain anchor execution verification. Every step is independently verifiable. No API needed. No trust required.

5

Why It Works This Way

Why anchor asynchronously?

The API returns the certificate immediately. The on-chain anchor happens in the background. Agents get sub-second responses while still getting permanent proof. If X Layer has a hiccup, the cert is still valid — the anchor catches up.

Why store so little on-chain?

Gas efficiency. The cert hash is a commitment to all the data — 13 source quotes, routing details, timestamps, the full consensus calculation. Storing all of that on-chain would cost orders of magnitude more gas for zero additional security. The hash is the proof; the data lives off-chain.

Why X Layer?

Low gas costs make it economical to anchor every single certificate — not just the valuable ones. X Layer's EVM compatibility means standard tooling (viem, ethers, Hardhat) works out of the box. And the OKX ecosystem provides native liquidity and infrastructure.

Why per-agent stats on-chain?

Trust shouldn't require an API call. Any smart contract, DAO, or protocol can query an agent's track record directly from BenchRegistry — no HTTP requests, no API keys, no intermediary. This makes agent reputation composable with DeFi.

6

What's Coming Next

The on-chain layer is live and anchoring. But the roadmap goes deeper:

Aggregator Reputation Scores

Contracts

Each DEX adapter accumulates a reputation on-chain — best-rate frequency, uptime, latency percentiles. Agents can use these scores to weight their routing decisions. Adapters compete for trust.

x402 Paywall Integration

Protocol

Machine-to-machine payments for certification. Agents pay per-cert using HTTP 402 micropayments — no API keys, no accounts. The payment and the proof happen in the same flow.

Cross-Chain Anchoring

Expansion

Certificates for swaps on Ethereum, Solana, or Arbitrum can be anchored on X Layer as the canonical trust layer. One registry, every chain.

DAO Governance Gates

DeFi

Smart contracts that require a valid Bench certificate before executing agent-initiated swaps. The DAO votes on minimum agreement thresholds — say, 85% source consensus — and the contract enforces it trustlessly.

Agent Economy Loop

Vision

Agents that consistently earn CERTIFIED verdicts build on-chain reputation. Protocols use that reputation to allocate more capital. Better performance earns more trust, which earns more volume. A virtuous cycle, enforced by math.

The on-chain layer isn't a feature bolted onto Bench — it is Bench. Without the anchor, a certificate is just a signed JSON blob. With it, it's a permanent, trustless, composable proof that anyone can verify without asking permission.

That's the difference between a promise and a proof.