跳到正文
DEV Community· agent402dev·· 2 小時前AI 評分52

Agent402 Bond:本機試用 Solana 上的 AI 智能體抵押任務

Paying an AI agent for work it hasn't delivered yet: bonded jobs on Solana, tried locally

AI 導讀

Agent402 Bond 是一個 Solana 程式,作者示範在本機 Solana 主網分叉上,為尚未交付的 AI 智能體工作安排抵押交易。買家存入 0.5 USDC、賣家抵押 0.2 USDC,買家確認工作後支付 1.5 USDC 餘款;示範使用 fork-only USDC,不會花費真實資金。

正文

x402 handles the simple case well: an agent pays, and gets a response right away. Many useful jobs do not fit that shape. A report, an export or a batch of lookups takes minutes, and the buyer pays before it can see the result.

Agent402 Bond is a small Solana program for that gap. For one deal, the seller locks a bond and the buyer can lock a deposit. What happens to that money depends only on the two parties' signatures and the Solana clock. There is no arbiter and no operator who can move the funds.

This post shows how to try it with your own AI agent (Claude Code or any MCP client) on a local fork of Solana mainnet. It uses throwaway keys and fork-only USDC, so nothing real is spent. It takes about five minutes.

How a bonded deal works

  1. Buyer and seller agree on terms and both sign open. The seller's bond (at most 20% of the price) and the buyer's deposit go into a vault that belongs to that one deal.
  2. The seller does the work and marks it delivered on chain.
  3. The buyer checks the work. If it is right, the buyer confirms and pays the balance (price minus deposit) directly to the seller.
  4. Anyone can settle once the outcome is fixed by signatures and time, and each side claims its share.

The outcomes, from the terms:

At the deadline Seller gets Buyer gets
Buyer confirmed and paid Bond back + deposit The work
Seller marked delivery, buyer never confirmed Bond back Deposit back
Nothing marked or confirmed Nothing Bond + deposit
Both sign to cancel Bond back Deposit back

One design choice matters here. If the seller marks delivery and the buyer refuses to confirm, each side just gets its own money back. Neither side can profit from a false claim, but the program also does not judge quality. It protects the buyer against a seller who never delivers, not against a disagreement about how good the work is.

Try it locally

You need Node 20+, Surfpool (a local Solana mainnet fork), and an MCP client such as Claude Code.

1. Start a mainnet fork in its own terminal:

surfpool start --network mainnet --no-tui

The fork pulls the deployed Bond program and USDC from mainnet when they are first used. Everything disappears when you stop it.

2. Start the demo seller:

git clone https://github.com/agent402-dev/agent402-toolkit
cd agent402-toolkit && npm install
cd packages/pay-mcp
npx tsx examples/bond-local/start.ts

The script creates a throwaway seller and buyer, gives each 2 SOL and 100 USDC on the fork, and starts a seller at http://127.0.0.1:8790. The job counts the words in a short text. The price is 2 USDC, with a 0.2 USDC seller bond and a 0.5 USDC buyer deposit. The script refuses to run against anything but a local RPC.

3. Connect your agent. The script prints the exact settings. For Claude Code they look like this:

claude mcp add agent402-bond-local \
  --env X402_KEYPAIR_PATH=… --env X402_RPC_URL=http://127.0.0.1:8899 \
  --env X402_ALLOWED_DOMAINS=127.0.0.1:8790 --env X402_BOND_SELLERS=<seller> \
  --env X402_BOND_MAX_USD=5 --env X402_MAX_USD_PER_DAY=10 \
  -- npx -y @agent402-dev/pay-mcp

These settings allow exactly one seller and one domain, at most 5 USDC per deal. With no settings at all, pay-mcp refuses every payment. That is also how it behaves on mainnet until you choose your own limits.

Ask your agent

Try a prompt like this:

Use bond_job_quote on http://127.0.0.1:8790. If it is acceptable, buy the job with the text "hello bonded agents", show me the result, and pay only if the word count is right.

Here is what happens, tool by tool:

  1. bond_job_quote reads the seller's terms and checks them against your limits.
  2. bond_job_start sends the text and receives an open transaction already signed by the seller. It checks the transaction, then asks you before locking your 0.5 USDC deposit.
  3. The seller does the work and marks delivery on chain.
  4. bond_job_result returns the work. Your agent should treat it as data, not instructions.
  5. bond_confirm_and_pay asks you again, then pays the 1.5 USDC balance. The seller settles and claims on its own, and the deal account closes.

If the word count is wrong, don't confirm. After the deadlines, settlement gives you your deposit back, and the seller gets its bond back.

Want to see the flow before wiring up an agent? Run the script with --check. A scripted buyer calls the same tools, and the script ends with all checks passed.

What to know before using it for real

  • It is beta. The program has had an internal review, not an independent audit.
  • The deployed program cannot be upgraded. Fixes ship as new programs, and each deal follows the version it was opened under.
  • Limits are low on purpose. At most 100 USDC can be locked per deal, and 2,000 USDC across all open deals.
  • No one can move locked funds. The operator key can pause new deals and adjust some limits for new deals. It cannot move locked funds or stop settlement.
  • The current mainnet sellers are run by the toolkit's developer. That is the honest state of the directory today; more sellers are welcome (see below).

Where to go next

  • Use it on mainnet. bond_find_sellers reads the public seller directory. Two sellers are listed today: a wallet activity CSV export (1 USDC per job) and transaction receipts (0.1 USDC per job).
  • Sell your own job. Use @agent402-dev/bond-seller-mcp when an AI agent does the work, or the Cloudflare Workers template in pay-server. Then open a PR to add yourself to the directory.
  • Read the protocol. The Bond Job Protocol describes how two agents run a bonded job over HTTP.

The code is Apache-2.0 at github.com/agent402-dev/agent402-toolkit. Feedback and issues are welcome, especially from anyone who tries the local flow and gets stuck.

Not investment advice.

來源:DEV Community · dev.to