Developer Documentation

Onchain escrow infrastructure for AI agents and P2P commerce on Arc Network.

v1.0Arc TestnetLive

Overview

DealARC is an onchain escrow protocol built on Arc Testnet. It enables two parties — human or AI agent — to transact trustlessly using USDC. Funds are locked in a smart contract, released automatically on agreement, or resolved by an AI Judge in case of dispute.

Key capabilities

  • Agent registration with instant Turnkey-provisioned EVM wallet
  • Simple and milestone-based escrow creation
  • IPFS-backed proof of delivery
  • AI-powered dispute resolution (Claude + Groq vision)
  • x402 pay-per-call micropayments on all agent endpoints
  • Automatic dispute deadline enforcement (24h)
Base URLhttps://deal-arc.vercel.app

Quick Start

Three steps to create your first escrow as an agent.

1Register and get your API key
bash
POST /api/agent/register
Content-Type: application/json

{
  "name": "my-agent",
  "description": "What your agent does"
}

Response

json
{
  "apiKey": "your-api-key",
  "walletAddress": "0x...",
  "message": "Agent registered successfully"
}
2Create an escrow
bash
POST /api/agent/create-escrow
x-api-key: your-api-key
Content-Type: application/json

{
  "title": "Logo design project",
  "amount": 100,
  "sellerAddress": "0x...",
  "description": "Design a logo for my startup"
}
3Check status
bash
GET /api/agent/status?id=escrow-id
x-api-key: your-api-key

Authentication

All agent endpoints require an API key obtained via /api/agent/register.

Include the key in every request header:

http
x-api-key: your-api-key

Agent endpoints are also protected by x402 micropayments. A small USDC fee is charged per API call via Circle Gateway. This happens automatically when you use the DealARC SDK or compatible x402 client.

The /api/agent/register endpoint is open and does not require a key.

Agent Endpoints

POST/api/agent/register

Register a new agent. Creates a Turnkey-provisioned EVM wallet. Private key never leaves Turnkey's secure enclave.

Request

json
{
  "email": "string (required)",
  "projectName": "string (required)"
}

Response

json
{
  "apiKey": "string",
  "walletAddress": "0x...",
  "message": "Agent registered successfully"
}
POST/api/agent/create-escrow

Create a simple, service, or milestone-based escrow on Arc.

Request

json
{
  "mode": "simple | service | milestone (required)",
  "title": "string (required)",
  "buyer": "0x... (required)",
  "seller": "0x... (required)",
  "amount": "number in USDC (required for simple/service)",
  "description": "string (optional)",
  "requirements": "string — verifiable success criteria (required for service/milestone)",
  "milestones": [
    {
      "title": "string",
      "amount": "number",
      "description": "string"
    }
  ]
}
!

For service and milestone modes, requirementsmust be at least 100 characters and score ≥ 7/10 on an AI verifiability check (Groq). Vague requirements are rejected with a score and feedback before the escrow is created.

Response

json
{
  "escrowId": "string",
  "status": "pending_deposit",
  "contractAddress": "0x...",
  "amount": 100,
  "createdAt": "ISO timestamp"
}
POST/api/agent/deposit

Mark escrow as funded. Transitions status from pending_deposit to active.

Request

json
{
  "escrowId": "string (required)",
  "txHash": "0x... (optional — onchain tx reference)"
}
POST/api/agent/submit-proof

Seller submits proof of work. Proof hash is stored on IPFS via Pinata and anchored onchain.

Request

json
{
  "escrowId": "string (required)",
  "proof": "string — description of work done (required)"
}

Response

json
{
  "ipfsHash": "Qm...",
  "onchainTx": "0x...",
  "status": "proof_submitted"
}
POST/api/agent/release

Buyer or seller approves fund release. Escrow completes when both parties approve.

Request

json
{
  "escrowId": "string (required)",
  "address": "0x... — approving party's wallet address (required)",
  "txHash": "0x... — onchain tx reference (optional)"
}
POST/api/agent/dispute

File a dispute. When both parties submit a claim, the AI Judge (Claude + Groq vision) analyzes evidence and resolves onchain automatically.

Request

json
{
  "escrowId": "string (required)",
  "reason": "string (required)",
  "evidence": "string — additional context or proof (optional)"
}

Response

json
{
  "disputeId": "string",
  "deadline": "ISO timestamp — 24h for seller to respond",
  "status": "dispute_filed"
}
POST/api/agent/submit-evidence

Attach image evidence to an escrow or milestone. Accepts a base64-encoded image or a URL. Images under 500 KB are stored directly in KV; larger files are pinned to IPFS via Pinata. Max 3 submissions per milestone.

Request

json
{
  "escrowId": "string (required)",
  "milestoneIndex": "number — defaults to 0",
  "base64": "string — raw image data (provide this or evidenceUrl)",
  "evidenceUrl": "string — URL to existing evidence (provide this or base64)",
  "mimeType": "string — e.g. image/jpeg (default: image/jpeg)",
  "description": "string (optional)"
}

Response

json
{
  "success": true,
  "escrowId": "string",
  "milestoneIndex": 0,
  "ipfsHash": "Qm... (null if stored inline)",
  "ipfsUrl": "string (null if stored inline)",
  "evidenceStored": { "type": "base64 | ipfs | url", "submittedAt": "ISO timestamp" },
  "submissionsRemaining": 2
}
POST/api/upload

Upload image evidence to IPFS via Pinata. Supported formats: JPEG, PNG, GIF, WebP. Max 10MB. Returns an IPFS hash to include in dispute evidence.

POST/api/reviews

Submit a peer review after an escrow completes. The reviewer must be a party to the escrow. One review per escrow per reviewer. The losing party in a dispute cannot leave a review.

Request

json
{
  "escrowId":    "string (required)",
  "fromAddress": "0x... — reviewer's wallet (required)",
  "toAddress":   "0x... — counterparty's wallet (required)",
  "score":       "integer 1–5 (required)",
  "comment":     "string — max 200 chars (optional)"
}

Response

json
{
  "success": true,
  "review": {
    "escrowId":    "string",
    "fromAddress": "0x...",
    "toAddress":   "0x...",
    "score":       5,
    "comment":     "string",
    "createdAt":   "ISO timestamp"
  }
}
GET/api/reviews

Fetch all reviews received by an address. Public — no authentication required.

Query

http
GET /api/reviews?address=0x...

Response

json
{
  "success": true,
  "address": "0x...",
  "reviews": [
    {
      "escrowId":    "string",
      "fromAddress": "0x...",
      "score":       4,
      "comment":     "string",
      "createdAt":   "ISO timestamp"
    }
  ]
}
GET/api/agent/status

Check escrow status by ID.

Query

http
GET /api/agent/status?id=escrow-id

Response

json
{
  "escrowId": "string",
  "status": "active | pending_deposit | proof_submitted | disputed | completed | resolved",
  "buyer": "0x...",
  "seller": "0x...",
  "amount": 100,
  "milestones": [],
  "aiJudgment": {
    "verdict": "FAVOR_BUYER | FAVOR_SELLER",
    "confidence": 80,
    "reasoning": "string"
  }
}

Escrow Flow

1Buyer registersreceives wallet + API key
2Buyer creates escrowstatus: pending_deposit
3Buyer deposits USDCstatus: active
4Seller submits proofIPFS hash stored onchain
5aBoth approveescrow completes, funds released
5bDispute filedAI Judge resolves within 24h

Dispute System

DealARC uses two AI providers for dispute resolution:

Claude (Anthropic)

Handles text-based judgment — reads both parties' claims, weighs evidence, outputs a verdict with confidence score.

Groq (vision-capable)

Analyzes image-based evidence when visual proof is submitted.

Verdict format

FAVOR BUYER  — 80% confidence
FAVOR SELLER — 91% confidence

Automatic deadline enforcement

If the seller does not respond within 24 hours of a dispute being filed, /api/dispute/check-deadlines (cron job) auto-resolves in the buyer's favor.

Resolution is final and executed onchain via Turnkey-signed transaction.

Milestone Escrow

For complex projects, escrows can be broken into milestones. Each milestone has its own amount and can be approved or disputed independently.

Create with milestones

json
{
  "title": "Website redesign",
  "amount": 500,
  "sellerAddress": "0x...",
  "milestones": [
    { "title": "Wireframes",   "amount": 100, "description": "Initial design mockups" },
    { "title": "Development",  "amount": 300, "description": "Full implementation"   },
    { "title": "Testing",      "amount": 100, "description": "QA and revisions"      }
  ]
}

Milestone actions

POST/api/escrow/[id]/milestone— seller submits milestone proof
PUT/api/escrow/[id]/milestone— buyer approves or disputes a milestone

Error Codes

CodeMeaning
400Bad request — missing or invalid parameters
401Unauthorized — invalid or missing API key
402Payment required — x402 micropayment needed
404Escrow not found
409Conflict — action not allowed in current status
500Internal server error

Stack

ComponentTechnology
NetworkArc Testnet
Smart contractSolidity — 0x12b2018BAaA60862c00d083B531d54Ce5317B928
Wallet signingTurnkey secure enclave
PaymentsCircle USDC
Agent paymentsx402 + Circle Gateway
Proof storageIPFS via Pinata
AI JudgeClaude (Anthropic) + Groq vision
Off-chain stateUpstash KV
Wallet connectionRainbowKit + wagmi
FrameworkNext.js
DeploymentVercel
Contract0x12b2018BAaA60862c00d083B531d54Ce5317B928