How It Works

From quote request to on-chain anchored certificate — the full Bench pipeline in detail.

1

Query Fan-Out

When an agent requests a quote, Bench dispatches parallel requests to all 13 supported DEX aggregators. Each adapter normalizes the response into a standard format:

// Each source returns:
{
source: "1inch",
outputAmount: "2847320000",
gasEstimate: "145000",
latencyMs: 98,
route: "ETH → WETH → USDC",
success: true
}

Supported Sources (13)

1inchTier 1
ParaswapTier 1
KyberSwapTier 1
OKX DEXTier 1
OpenOceanTier 1
0x/MatchaTier 1
CoW SwapTier 2
OdosTier 2
LI.FITier 2
SocketTier 2
JupiterSolana
Uniswap AITier 1
DexalotTier 3

Sources are weighted by tier. Tier 1 sources have higher weight in consensus. Failed sources are excluded — Bench adapts to whatever responds successfully.

2

Consensus Engine

Once quotes arrive, the consensus engine processes them:

  1. A

    Outlier Removal

    Quotes that deviate more than 2 standard deviations from the median are flagged as outliers and excluded from consensus.

  2. B

    Weighted Median

    Remaining quotes are weighted by source tier and used to compute the weighted median price — the consensus best price.

  3. C

    Agreement Scoring

    Each source is scored 0-100 based on how close its quote is to the consensus. The overall agreement score is the weighted average.

  4. D

    Best Price Identification

    The source offering the highest output amount (best execution) is identified. This may differ from the consensus median.

  5. E

    Certification Level

    Based on agreement score and source count: CERTIFIED (≥70, ≥3 sources), WARNING (below threshold), FAILED (critical disagreement).

3

Certificate Issuance (BEC v2)

The Bench Execution Certificate (BEC v2) is a structured, signed attestation containing:

{
certHash: "0xabc...",
agentAddress: "0x5a6A...",
chainId: 196,
inputToken: "ETH",
outputToken: "USDC",
inputAmount: "1000000000000000000",
bestSource: "1inch",
bestOutputAmount: "2847320000",
sourceAgreementScore: 94,
certificationLevel: "CERTIFIED",
sourcesSuccessful: 11,
sourcesTotal: 13,
signature: "0x..." // EIP-712
}

EIP-712 Signing

Certificates are signed using EIP-712 typed structured data. The signing domain is:

{ name: "Bench", version: "2", chainId: 196 }
4

On-Chain Anchoring

Certificates are anchored to the BenchRegistry smart contract on X Layer (chain 196). The registry stores:

  • Certificate hash (bytes32)
  • Attestor address (who signed)
  • Timestamp (block.timestamp)
  • On-chain queryable by cert hash or attestor

Contract: 0x6a400d858daA46C9f955601B672cc1a8899DcE3f

Chain: X Layer Mainnet (196)