Litmus Protocol

Trustless validation for AI agents, turning adversarial testing into verifiable on-chain reputation.

Litmus Protocol

Created At

ETHGlobal Mumbai

Project Description

Litmus is a trustless validation protocol for AI agents that turns adversa,rial testing into verifiable on-chain reputation. Builders stake USDC behind the rules their agents promise to follow, and challengers earn rewards for proving those rules can be broken. Results attach to an agent’s ERC-8004 identity, creating a public record of how it performed under pressure.

As AI agents gain access to wallets, private information, and external tools, their reliability becomes more consequential. A successful demo does not show whether an agent will leak a secret, exceed a transfer limit, or call a forbidden tool when someone deliberately tries to manipulate it. Litmus gives builders a way to expose those boundaries to public testing with real economic incentives.

A builder creates a contest, defines the agent’s rules, and stakes USDC. Challengers interact with the agent, paying per message to attempt prompt injections and other adversarial strategies. When a rule violation is proven on-chain, the challenger receives a payout from the stake in the same transaction. Builders have something at risk, and challengers have a reason to find failures.

An agent that completes its contest without a proven break earns a Litmus Held NFT, an on-chain record of the rules it held through adversarial testing. Contest results are also published to its ERC-8004 reputation, tied to the exact agent package tested. This records evidence from a specific test rather than claiming that an agent is universally safe.

Agents run on 0G inference, while Hedera handles contest stakes, settlement, and payouts. A Chainlink CRE workflow audits each finished contest on Sepolia. Together, these components make the testing process financially accountable and its outcomes publicly inspectable, helping builders demonstrate reliability and users assess an agent’s track record.

How it's Made

We built Litmus to turn AI-agent behavior into verifiable outcomes: a proven rule violation triggers a payout, while an agent that holds through adversarial testing earns a record of what was tested. The architecture separates agent execution, financial settlement, and evidence auditing. A Next.js frontend connects to a Hono gateway backed by SQLite, a private runner executes the agent, and Solidity contracts developed with Foundry manage stakes and payouts on Hedera testnet.

The core smart contract holds HTS USDC for each validation’s prize pool, agent vault, and builder bond. We implemented three mechanically checkable rule types. Transfer-limit violations are detected inside the agent’s vault-send function, while invoking a forbidden emergency-withdraw tool directly triggers a breach. Secret leaks use commit–reveal: the challenger commits a hash bound to their address and a salt, then reveals the recovered secret in a later block. This prevents someone from copying a pending reveal to claim the reward. A verified breach updates the validation state and pays the challenger in the same transaction.

Each adversarial message follows an x402 payment flow on Hedera. The gateway verifies the signed payment, asks the runner to execute the agent, and settles only if the response arrives within the charging deadline. Slow or failed runs are not charged. This required controlling verification and settlement separately rather than relying on middleware that automatically charges on a successful HTTP response. Settled fees reach the smart contract through retryable background jobs, with shares allocated to the prize pool, treasury, and refund escrow.

0G Compute powers the agent’s tool-calling loop. Builders select from the live model and provider catalog and can pin a provider for the validation period; pinned runs do not silently switch to another provider or model. We request TEE verification and preserve 0G request IDs and returned trace metadata in signed attempt records. The runner keeps agent secrets in an AES-256-GCM encrypted store, separate from the public gateway. Periodic canary tasks check that the agent remains functional, with failed rounds triggering refunds and repeated failures invalidating the validation run.

On-chain settlement alone cannot establish that the gateway’s published evidence matches the original commitments. We therefore built a TypeScript Chainlink CRE auditor that retrieves the finalized log and revealed validation data, reads Hedera contract state, and compares log hashes, canary commitments, secret hashes, and deposited-message counts. Because CRE does not natively support Hedera, we access its JSON-RPC relay through the HTTP capability and use the EVM capability to write an attestation to Ethereum Sepolia. The current workflow runs through the CRE CLI simulator with broadcast enabled and the Sepolia simulation forwarder.

When an agent completes the validation period without a proven breach, the gateway requires a passing audit before minting its Litmus Held NFT. This soulbound ERC-721 uses on-chain SVG artwork and records validation metadata, including the tested package hash. For linked ERC-8004 agents, eligible results are also published as reputation feedback, connecting the outcome to the agent’s identity and the exact package tested.

We also handled failures across payment and settlement boundaries: reused payment authorizations are rejected, failed fee deposits are retried, and unsuccessful payouts become withdrawable credits so one recipient cannot block settlement. The repository includes Foundry contract tests, Vitest service tests, and fixture-based CRE audit tests. The frontend exposes inference request IDs, payment transactions, and audit status so users can inspect the evidence behind each validation result.

background image mobile

Join the mailing list

Get the latest news and updates