DEV Community

Miguel Castellano
Miguel Castellano

Posted on

Add Escrow Protection to Any x402 Agent Payment in 5 Minutes

x402 now processes over $600M in agent-to-agent payments. That growth is great -- until your agent pays $50 for an API call and gets back an empty response. Or hallucinated data. Or a 500 error.

Every x402 payment is final. No refunds, no disputes, no recourse. Your agent wired USDC to a stranger on Base, and the money is gone.

PayCrow fixes this. It sits between your agent and the payment, adding trust scoring + USDC escrow + on-chain dispute resolution. If the API returns garbage, funds stay locked and an arbiter reviews. If the response is valid, funds release automatically.

What PayCrow Does

PayCrow is an MCP server with 10 tools. The one you care about most is safe_pay:

  1. Check trust -- queries 4 on-chain sources to score the seller (0-100)
  2. Set protection -- auto-configures escrow timelock and amount caps based on risk
  3. Create escrow -- locks USDC in a smart contract on Base
  4. Call the API -- makes the HTTP request your agent wanted
  5. Verify response -- checks for valid JSON + 2xx status
  6. Release or dispute -- auto-releases payment if valid, auto-disputes if not

All of this happens in a single tool call. Your agent says "pay this API" and PayCrow handles the rest.

Quick Start (5 Steps)

1. Install

npm install -g paycrow
Enter fullscreen mode Exit fullscreen mode

2. Generate a wallet

npx paycrow init
Enter fullscreen mode Exit fullscreen mode

This creates a fresh wallet and prints your Claude Desktop config. Copy the private key from the output.

3. Fund the wallet

Send a small amount to the printed address on Base:

  • ~$0.50 in ETH (for gas)
  • However much USDC you want for payments ($5-10 is fine to start)

4. Add to Claude Desktop

Open your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on Mac) and add:

{
  "mcpServers": {
    "paycrow": {
      "command": "npx",
      "args": ["paycrow"],
      "env": {
        "PRIVATE_KEY": "0xYOUR_KEY_FROM_STEP_2"
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Restart Claude Desktop.

5. Use it

Tell Claude:

"Use safe_pay to call https://api.example.com/data -- the seller address is 0xABC123... and pay $2 USDC."

Claude will call the safe_pay tool, which checks the seller's trust, creates an escrow, calls the API, verifies the response, and auto-releases or auto-disputes. You'll see every step in the tool output.

How It Works Under the Hood

Here is the full flow when safe_pay runs:

trust_gate check
    |
    v
Score >= 75, high confidence? --> 15min timelock, up to $100
Score moderate?               --> 60min timelock, capped at $25
Score low?                    --> 4hr timelock, capped at $5
Unknown / high dispute rate?  --> BLOCKED. No funds sent.
    |
    v
escrow_create (USDC locked on Base)
    |
    v
HTTP call to the API
    |
    v
Response valid (2xx + JSON)?
    |                  |
   YES                NO
    |                  |
auto-release      auto-dispute
(seller paid)     (arbiter reviews)
Enter fullscreen mode Exit fullscreen mode

Escrow lifecycle on-chain:

FUNDED --> RELEASED         (delivery confirmed, seller paid minus 2% fee)
       --> DISPUTED --> RESOLVED  (arbiter rules, splits funds)
       --> EXPIRED --> REFUNDED   (timeout hit, full refund, zero fee)
Enter fullscreen mode Exit fullscreen mode

If you need more control -- custom JSON Schema verification, hash-lock verification, or specific timelock values -- use x402_protected_call instead. It takes the same parameters but lets you specify everything manually.

The Trust Scoring System

PayCrow aggregates 4 on-chain sources into a single 0-100 score:

Source Weight What It Measures
PayCrow Reputation 40% Escrow completion rate, dispute history, volume
ERC-8004 Identity 25% Cross-ecosystem agent identity and feedback
Moltbook Social 15% Karma, account age, social standing
Base Chain Activity 20% Wallet age, transaction count, USDC volume

The score drives concrete decisions:

  • 75+ (high trust, high confidence): proceed with standard 15-minute timelock
  • 45-74 (moderate): longer timelock, smaller payment cap
  • Below 45 (low): maximum protection, $5 cap
  • No data / high dispute rate: payment blocked entirely

You can check any address without paying anything:

"Check trust for 0xABC123... using trust_gate"
Enter fullscreen mode Exit fullscreen mode

This returns the score, confidence level, per-source breakdown, and recommended escrow parameters.

All 10 Tools

Tool Purpose
safe_pay Trust-informed payment with auto-escrow (recommended)
trust_gate Go/no-go decision before paying
trust_score_query Full 4-source trust breakdown
trust_onchain_quick Free on-chain-only reputation check
x402_protected_call Manual escrow with custom verification
escrow_create Create a standalone escrow
escrow_release Release funds to seller
escrow_dispute Flag bad delivery for arbiter review
escrow_status Check escrow state
rate_service Rate seller quality (1-5 stars, feeds trust scores)

Why This Matters

24,000+ agents are now making payments via x402. As CryptoSlate reported, the critical question in agent commerce is who controls the escrow moment -- the moment between payment and delivery where things can go wrong.

Every other escrow service on Base says "no disputes, no chargebacks" like it is a feature. PayCrow is the only one with real on-chain dispute resolution. If the API returns garbage, an arbiter reviews the evidence and rules on how to split the funds. Your agent is not stuck eating the loss.

The protocol fee is 2% on successful releases. Zero fee on refunds. Trust queries cost $0.001.

Links

341 tests. Deployed on Base mainnet. Works with Claude Desktop, Claude Code, Cursor, Windsurf, and any MCP client.

Top comments (0)