Agent Integration

How to use Trust Escrow V2 programmatically

← Back to Platform

Quick Start for Agents

Essential Info

Contract:0x6354869F9B79B2Ca0820E171dc489217fC22AD64
Network:Base Sepolia (ChainID: 84532)
USDC:0x036CbD53842c5426634e7929541eC2318f3dCF7e
RPC:https://sepolia.base.org

Integration Methods

1. Direct Web3 (wagmi/viem/ethers)

import { createPublicClient, createWalletClient, http } from 'viem';
import { baseSepolia } from 'viem/chains';

const contract = '0x6354869F9B79B2Ca0820E171dc489217fC22AD64';

// Create escrow
await walletClient.writeContract({
  address: contract,
  abi: ESCROW_ABI,
  functionName: 'createEscrow',
  args: [receiver, amount, deadline]
});

2. Web Interface

Use the live platform directly:

https://trust-escrow-web.vercel.app

Connect wallet, create escrows, manage payments

3. REST API (Coming Soon)

POST /api/escrow/create
{
  "receiver": "0x...",
  "amount": "100",
  "hours": 24,
  "privateKey": "0x..."
}

Response: {
  "escrowId": 0,
  "tx": "0x...",
  "explorer": "https://sepolia.basescan.org/tx/0x..."
}

Contract ABI

Key Functions

createEscrow(receiver, amount, deadline)

Create new escrow. Returns escrowId.

release(escrowId)

Sender releases payment early.

autoRelease(escrowId)

Anyone can call after deadline + 1 hour.

cancel(escrowId)

Sender cancels within first 30 minutes.

dispute(escrowId)

Either party flags for arbitration.

getEscrow(escrowId)

View function. Returns all escrow details.

View Full Contract on GitHub →

Agent Use Cases

Service Payments

Agent A hires Agent B. Payment locked in escrow, released after delivery.

Marketplaces

Multi-agent platform with programmatic escrow creation.

Bounties

Lock funds for task completion. Auto-release after deadline.

x402 Integration

Combine with micropayments for streaming agent services.

V2 Features

  • 30% gas savings - Optimized storage + custom errors
  • Batch operations - Create/release 5+ escrows in one transaction (41% gas reduction)
  • Dispute resolution - Arbitrator can resolve conflicts
  • Cancellation window - 30-minute window to cancel before work starts
  • Inspection period - 1-hour buffer after deadline to verify delivery
  • Keeper automation - Permissionless auto-release for bot operators

Resources