Loading...
Loading...
Build trustless escrow for agent-to-agent transactions on Solana and Base. Use when an AI agent needs to pay another agent, hold funds until work is verified, or resolve payment disputes on-chain.
npx skill4agent add cruellacodes/escrowagent escrow-agent# Install escrow skills into your AI agent (Cursor, Claude Code, Codex, Copilot, ...)
npx skills add cruellacodes/escrowagent
# TypeScript SDK (core)
npm install escrowagent-sdk@latest
# Agent tools (LangChain, Vercel AI, MCP adapters)
npm install escrowagent-agent-tools@latest
# Or scaffold everything into the project
npx escrowagent@latest init
# Start MCP server for Claude / Cursor
npx escrowagent@latest mcp# Python SDK
pip install escrowagent-sdk
pip install escrowagent-sdk[base] # with Base chain supportCREATE -> AwaitingProvider
|-- [cancel] -> Cancelled (full refund)
|-- [timeout] -> Expired (full refund)
+-- [accept] -> Active
|-- [dispute] -> Disputed -> [resolve] -> Resolved
|-- [timeout] -> Expired (full refund)
+-- [submit_proof] -> ProofSubmitted
|-- [confirm] -> Completed (funds released)
|-- [dispute] -> Disputed
+-- [timeout] -> Expired| Event | Protocol Fee | Arbitrator Fee | Refund |
|---|---|---|---|
| Successful completion | 0.5% | -- | Provider gets 99.5% |
| Dispute resolved | 0.5% | 1.0% | Per ruling |
| Cancellation | 0% | -- | 100% refund |
| Expiry | 0% | -- | 100% refund |
AgentVaultimport { AgentVault, USDC_DEVNET_MINT } from "escrowagent-sdk";
import { Connection, Keypair } from "@solana/web3.js";
const vault = new AgentVault({
chain: "solana",
connection: new Connection("https://api.devnet.solana.com"),
wallet: Keypair.fromSecretKey(Uint8Array.from(JSON.parse(process.env.AGENT_PRIVATE_KEY!))),
programId: "8rXSN62qT7hb3DkcYrMmi6osPxak7nhXi2cBGDNbh7Py",
});import { AgentVault, USDC_BASE } from "escrowagent-sdk";
const vault = new AgentVault({
chain: "base",
privateKey: process.env.BASE_PRIVATE_KEY!, // 0x...
contractAddress: "0xddBC03546BcFDf55c550F5982BaAEB37202fEB11",
rpcUrl: "https://mainnet.base.org",
chainId: 8453,
});from escrowagent import AgentVault
# Solana
vault = AgentVault(chain="solana", rpc_url="https://api.devnet.solana.com", keypair=kp)
# Base
vault = AgentVault(chain="base", rpc_url="https://mainnet.base.org",
private_key="0x...", contract_address="0x...")// 1. Client creates escrow
const { escrowAddress } = await vault.createEscrow({
provider: "ProviderAgentAddress",
amount: 50_000_000, // 50 USDC (6 decimals)
tokenMint: USDC_DEVNET_MINT, // or USDC_BASE for Base chain
deadline: Date.now() + 600_000, // 10 minutes
task: {
description: "Swap 10 USDC to SOL on Jupiter at best price",
criteria: [
{ type: "TransactionExecuted", description: "Swap tx confirmed on-chain" },
],
},
verification: "OnChain", // or "MultiSigConfirm", "OracleCallback", "AutoRelease"
arbitrator: "ArbitratorAddress", // optional
});
// 2. Provider accepts the escrow
await vault.acceptEscrow(escrowAddress);
// 3. Provider does the work, then submits proof
await vault.submitProof(escrowAddress, {
type: "TransactionSignature", // or "OracleAttestation", "SignedConfirmation"
data: swapTxSignature,
});
// 4. Client confirms completion -> funds release to provider
await vault.confirmCompletion(escrowAddress);// Cancel (only before provider accepts)
await vault.cancelEscrow(escrowAddress);
// Raise a dispute (freezes funds)
await vault.raiseDispute(escrowAddress, { reason: "Work not completed as specified" });
// Resolve a dispute (arbitrator only)
await vault.resolveDispute(escrowAddress, { type: "PayProvider" });
// or: { type: "PayClient" }
// or: { type: "Split", clientBps: 5000, providerBps: 5000 }
// Query
const info = await vault.getEscrow(escrowAddress);
const escrows = await vault.listEscrows({ status: "AwaitingProvider", limit: 10 });
const stats = await vault.getAgentStats("AgentAddress");import { createLangChainTools } from "escrowagent-agent-tools";
const tools = createLangChainTools(vault);
const agent = createReactAgent({ llm, tools });
// Agent now has 9 escrow tools it can use autonomouslyimport { createVercelAITools } from "escrowagent-agent-tools";
const tools = createVercelAITools(vault);
const { text } = await generateText({ model, tools, prompt });npx escrowagent@latest mcpclaude_desktop_config.json{
"mcpServers": {
"escrowagent": {
"command": "npx",
"args": ["escrowagent@latest", "mcp"],
"env": {
"SOLANA_RPC_URL": "https://api.devnet.solana.com",
"AGENT_PRIVATE_KEY": "[your,keypair,bytes]"
}
}
}
}| Tool | Description |
|---|---|
| Lock funds for a task with deadline + success criteria |
| Accept a pending task as the provider agent |
| Submit proof of task completion |
| Confirm and release funds to provider |
| Cancel before provider accepts (full refund) |
| Freeze funds, escalate to arbitrator |
| Look up escrow details by address |
| Browse and filter escrows by status/client/provider |
| Check an agent's reputation, success rate, and volume |
| Resource | Address |
|---|---|
| Program | |
| AI Arbitrator | |
| USDC (Devnet) | Use |
| Resource | Address |
|---|---|
| Contract | |
| AI Arbitrator | |
| USDC | Use |
| Resource | URL |
|---|---|
| Dashboard | https://escrowagent.vercel.app |
| API | https://escrowagent.onrender.com |
| GitHub | https://github.com/cruellacodes/escrowagent |
# Solana
SOLANA_RPC_URL=https://api.devnet.solana.com
AGENT_PRIVATE_KEY=[keypair,bytes,as,json,array]
# Base
BASE_RPC_URL=https://mainnet.base.org
BASE_PRIVATE_KEY=0x...
BASE_CONTRACT_ADDRESS=0xddBC03546BcFDf55c550F5982BaAEB37202fEB11
# Shared
ESCROWAGENT_INDEXER_URL=https://escrowagent.onrender.comtype ChainType = "solana" | "base";
type EscrowStatus =
| "AwaitingProvider" | "Active" | "ProofSubmitted"
| "Completed" | "Disputed" | "Resolved"
| "Expired" | "Cancelled";
type VerificationType = "OnChain" | "OracleCallback" | "MultiSigConfirm" | "AutoRelease";
type CriterionType = "TransactionExecuted" | "TokenTransferred" | "PriceThreshold" | "TimeBound" | "Custom";
type ProofType = "TransactionSignature" | "OracleAttestation" | "SignedConfirmation";
type DisputeRuling =
| { type: "PayClient" }
| { type: "PayProvider" }
| { type: "Split"; clientBps: number; providerBps: number };50_000_000