What inspired us
Every "agent economy" demo we watched ended the same way. The agent reasoned beautifully, planned carefully, and then — a human opened a browser, logged into a dashboard, clicked approve, and finally something happened onchain. That human step is the bottleneck. Not the AI. Not the blockchain. The missing economic infrastructure between them.
We kept asking the same question: if two AI agents need to transact with each other right now, what actually has to happen? The answer was depressing. Someone has to create accounts. Someone has to set up billing. Someone has to manually verify the counterparty is trustworthy. Someone has to approve the payment. None of that is autonomous. None of that scales. And none of it changes just by making the AI smarter.
The bottleneck is not reasoning capability. Modern language models are good enough to reason. The bottleneck is economic infrastructure. Agents need payment rails that work without human billing setup, trust rails that work without centralized reputation platforms, and discovery rails that work without anyone manually maintaining a directory. We decided to build all three.
What we built
DeFi Agent Marketplace is a closed-loop autonomous agent marketplace where AI agents discover each other, verify trustworthiness, pay each other per request, and build reputation — with zero human approval at any step.
The system is powered by two open standards combined for the first time into one working loop:
x402 handles payment. An agent calls an endpoint, receives an HTTP 402 with a price, signs a stablecoin authorization, retries, and receives the result. No accounts. No subscriptions. The payment is the authentication.
ERC-8004 handles identity and reputation. Every specialist agent holds an ERC-721 onchain identity describing what it does, its endpoint, and its price. Reputation is built from feedback entries anchored to real payment transaction hashes. The cost to fake $N$ reputation points scales linearly:
where $p_{\min}$ is the minimum price of a single agent interaction. Reputation here is an economic guarantee, not a policy one.
Agents also stake collateral to register. Sustained poor performance triggers slashing when average score falls below a threshold after reviews:
The three specialist DeFi agents
| Agent | Data sources | Price |
|---|---|---|
| Smart Contract Auditor | Slither + Snowtrace source API | 0.05 tUSDC |
| Token Risk Scorer | Avalanche RPC + DexScreener + CoinGecko | 0.03 tUSDC |
| Gas & Timing Agent | Avalanche eth_feeHistory RPC |
0.01 tUSDC |
All data sources are free and require no API key. The synthesized answer is built from structured real-time data using template formatting — no LLM API dependency on the critical path.
The orchestrator
A LangChain-based orchestrator takes one natural-language task, decomposes it via keyword and regex matching, queries the onchain Identity Registry for matching agents, filters by reputation and stake, pays each specialist via EIP-3009 gasless transfers, runs independent subtasks in parallel, writes payment-anchored feedback onchain, and synthesizes a final answer. Zero human clicks from input to settled transaction.
The privacy layer
Deployed on a permissioned Avalanche L1 (Subnet-EVM, TxAllowList precompile) with eERC encrypted payments — zk-SNARKs and ElGamal encryption hide payment amounts from anyone watching the chain. A rotatable auditor key lets the operator decrypt any payment for compliance. Privacy that still passes an audit.
The frontend
Next.js 14 with RainbowKit wallet connect. Mode A: orchestrator's own wallet pays everything autonomously, no wallet connection required. Mode B: connected MetaMask wallet pays directly. Live activity feed, streaming task progress with real transaction hashes, agent registry loaded from onchain contracts, and an auditor panel that reveals encrypted payment amounts when the compliance key is provided.
What we learned
The LLM is not load-bearing. Early versions of the orchestrator returned "No LLM response" silently whenever an API call failed. The fix was not configuring a key. It was removing the LLM from the critical path entirely. The specialist agents already return structured real-time data. Template-based synthesis turns that into a readable answer without touching an LLM. The LLM becomes optional cosmetic polish, not infrastructure. The system never fails because of an API key.
Payment-anchored reputation changes everything. Every other reputation system we studied lets reviews be written for free. Free reviews are worthless because they are free to fake. The moment you anchor each review to a real payment transaction hash, the economics flip. Fake reputation costs real money. Good agents naturally accumulate verifiable trust over time. This is a small design choice with a large structural effect.
Subnet-EVM has a critical compiler gotcha. Subnet-EVM
currently supports up to the Cancun EVM fork. Solidity 0.8.30
and above defaults to targeting the Pectra fork. Contracts
compiled with default settings either fail to deploy or
produce unexpected bytecode on Subnet-EVM without setting
evmVersion: "cancun" explicitly in the Hardhat config. This
cost us real hours and is documented nowhere prominently.
Parallel agent execution is the demo. Running Token Risk Scorer and Gas Timing Agent concurrently while keeping payment and feedback writes sequential required careful async orchestration. Getting the spend cap check atomic across parallel payment attempts was the hardest engineering problem in the project. But watching two agents get paid simultaneously in the live stream is the moment every person in the demo understands what "autonomous" actually means.
Challenges we faced
Silent LLM failures. The orchestrator was returning the
literal string "No LLM response" for every synthesis step
because the failure was caught and swallowed rather than
surfaced. Debugging this required instrumenting every code
path individually. The fix was architectural: build the
template synthesizer first as the guaranteed fallback, wrap
LLM polish in a non-blocking try/except, and never let an
external API failure break the core loop.
eERC proof generation latency. The Groth16 zk-SNARK prover runs client-side via the SDK's WASM module. First proof generation takes 1-3 seconds while the WASM initializes. We had to add explicit SSE events for the proof generation step so the frontend shows progress during that wait rather than appearing frozen. Small UX fix, significant demo quality improvement.
MetaMask wrong network detection. The custom Avalanche
L1 (chain ID 88888) is not in MetaMask's default network
list. The initial wrong-network modal only showed a
"Disconnect" button with no way to switch. We fixed this by
wiring useSwitchChain from wagmi, defining the custom chain
with defineChain from viem, and adding the chain to the
wagmi config so MetaMask's addEthereumChain flow triggers
automatically on switch — one click to add and switch to the
private L1.
Making reputation meaningful without mainnet. On a local
devnet, staking and slashing are cheap to demonstrate but
easy to dismiss. We addressed this by making the staking
minimum non-trivial relative to each agent's price per call,
and by requiring every feedback entry to reference a real
PaymentSettled event hash. The full payment history is
always verifiable onchain even in a test environment. The
economics are real even when the token has no market price.
What's next
- Escrow and dispute resolution — payments held until task completion is confirmed, with an arbiter agent for contested outcomes
- Competitive bidding — multiple agents bid price and estimated completion time; orchestrator selects on price-weighted reputation ratio
- Cross-chain agents via Avalanche ICM — specialist agents on separate Avalanche L1s, discovered and paid across chains via Interchain Messaging
- Mainnet deployment — real USDC on Avalanche C-Chain, real stakes, real slashing, real reputation
- Open agent registration — any developer can register a specialist agent in the marketplace, stake collateral, and start earning from other agents hiring them
The rails exist. The loop is closed. The proof is live.
Log in or sign up for Devpost to join the conversation.