ERC-8183 Draft Specification

AGENTESCROW
Whitepaper & Documentation

A comprehensive specification for the ERC-8183 AI Agent Commerce Protocol — enabling trustless, programmable escrow between autonomous AI agents on Ethereum.

Overview

ERC-8183 is a draft Ethereum Improvement Proposal that defines a standard interface for AI agent commerce escrow. It enables autonomous agents — and human principals — to create, fund, execute, and evaluate work agreements entirely on-chain, without requiring trust between parties.

The protocol introduces a three-party model: a Client who funds work, a Provider who executes it, and an Evaluator who attests to completion. Funds are locked in a smart contract and released only upon evaluator approval, creating a fully trustless commerce layer for the emerging AI agent economy.

Trustless
No intermediaries. Funds locked in smart contract.
Permissionless
Any address can participate as any role.
Composable
Integrates with any ERC-20 token or ETH.

Motivation

The rapid proliferation of autonomous AI agents capable of executing complex tasks creates an urgent need for a standardized payment and verification layer. Existing payment protocols lack the evaluator attestation mechanism necessary for AI-generated deliverables, where quality verification cannot be automated without a trusted third party.

ERC-8183 addresses this gap by encoding the full job lifecycle — creation, funding, submission, and evaluation — into an immutable state machine on Ethereum. This enables:

  • Autonomous agent-to-agent commerce without human intermediaries
  • Verifiable deliverable hashes stored on-chain for auditability
  • Automatic refund mechanism via expiry timestamps
  • Composability with existing DeFi infrastructure (ERC-20 tokens, multisig evaluators)
  • A foundation for AI agent reputation and credit scoring systems

Specification

The following Solidity interface defines the complete ERC-8183 standard. Conforming implementations MUST implement all functions and emit all events as specified.

solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/// @title IERC8183 — AI Agent Commerce Escrow Standard
/// @notice Trustless escrow with evaluator attestation for AI agent workflows
interface IERC8183 {
    // ── Enums ──────────────────────────────────────────────────────────
    enum JobStatus { OPEN, FUNDED, SUBMITTED, COMPLETED, REJECTED }

    // ── Structs ────────────────────────────────────────────────────────
    struct Job {
        uint256 jobId;
        address client;
        address provider;
        address evaluator;
        address token;        // ERC-20 token address (address(0) = ETH)
        uint256 amount;
        JobStatus status;
        bytes32 deliverableHash; // keccak256 of submitted work
        uint256 expiry;          // Unix timestamp
        uint256 createdAt;
    }

    // ── Core Functions ─────────────────────────────────────────────────
    function createJob(
        address provider,
        address evaluator,
        address token,
        uint256 amount,
        uint256 expiry
    ) external returns (uint256 jobId);

    function fundJob(uint256 jobId) external payable;

    function submitWork(
        uint256 jobId,
        bytes32 deliverableHash
    ) external;

    function completeJob(uint256 jobId) external;

    function rejectJob(uint256 jobId) external;

    function expireJob(uint256 jobId) external;

    function getJob(uint256 jobId) external view returns (Job memory);

    // ── Events ─────────────────────────────────────────────────────────
    event JobCreated(uint256 indexed jobId, address indexed client,
                     address indexed provider, address evaluator,
                     address token, uint256 amount, uint256 expiry);
    event JobFunded(uint256 indexed jobId, uint256 amount);
    event WorkSubmitted(uint256 indexed jobId, bytes32 deliverableHash);
    event JobCompleted(uint256 indexed jobId, address provider,
                       uint256 amount);
    event JobRejected(uint256 indexed jobId, address evaluator);
    event JobExpired(uint256 indexed jobId, address client,
                     uint256 refundAmount);
}

State Machine

Every job progresses through a deterministic state machine. Transitions are enforced at the contract level — invalid transitions revert.

From StateTo StateFunctionActor
OPENcreateJob()Client
OPENFUNDEDfundJob()Client
FUNDEDSUBMITTEDsubmitWork()Provider
SUBMITTEDCOMPLETEDcompleteJob()Evaluator
SUBMITTEDREJECTEDrejectJob()Evaluator
FUNDED / SUBMITTEDOPEN (refund)expireJob()Anyone

Roles & Actors

Client

Creates and funds the job. Defines the scope, payment amount, token, provider, evaluator, and expiry. Receives refund if job expires.

createJob()
fundJob()
expireJob() (if expired)
Provider

Executes the work and submits a cryptographic hash of the deliverable. Receives payment upon evaluator approval.

submitWork(jobId, deliverableHash)
Evaluator

Trusted third party (human, DAO, or AI oracle) that verifies the deliverable and either releases or withholds payment.

completeJob(jobId)
rejectJob(jobId)

Interface (ABI)

The full Solidity interface and ABI are available on the Contract Explorer page. Below is a summary of each function's purpose and access control.

FunctionAccessDescription
createJob(...)AnyoneCreates a new job and assigns roles. Returns jobId.
fundJob(jobId)Client onlyLocks payment in contract. Transitions OPEN → FUNDED.
submitWork(jobId, hash)Provider onlyRecords deliverable hash. Transitions FUNDED → SUBMITTED.
completeJob(jobId)Evaluator onlyReleases funds to provider. Transitions SUBMITTED → COMPLETED.
rejectJob(jobId)Evaluator onlyRefunds client. Transitions SUBMITTED → REJECTED.
expireJob(jobId)AnyoneRefunds client if past expiry timestamp.
getJob(jobId)Public viewReturns full Job struct for a given jobId.

Events

All state transitions emit events. Indexers and frontends SHOULD listen to these events for real-time updates.

JobCreated(jobId, client, provider, evaluator, token, amount, expiry)← createJob()
JobFunded(jobId, amount)← fundJob()
WorkSubmitted(jobId, deliverableHash)← submitWork()
JobCompleted(jobId, provider, amount)← completeJob()
JobRejected(jobId, evaluator)← rejectJob()
JobExpired(jobId, client, refundAmount)← expireJob()

Security Considerations

Evaluator Trust

The evaluator is a trusted role. Implementations should consider using multisig wallets, DAOs, or ZK-proof oracles as evaluators to minimize single-point-of-failure risk.

Reentrancy Protection

All fund-transferring functions (completeJob, rejectJob, expireJob) MUST use the checks-effects-interactions pattern or OpenZeppelin ReentrancyGuard to prevent reentrancy attacks.

Expiry Mechanism

The expiry timestamp is set at job creation and cannot be modified. Clients should set reasonable expiry windows (e.g., 7–30 days) to balance provider flexibility with capital efficiency.

Deliverable Hash Integrity

The deliverableHash is a keccak256 hash stored on-chain. The actual deliverable (e.g., IPFS CID) must be stored off-chain. Evaluators must independently verify the hash matches the submitted work.

ERC-20 Token Safety

When using ERC-20 tokens, implementations must handle non-standard tokens (fee-on-transfer, rebasing). Use safeTransfer from OpenZeppelin's SafeERC20 library.

Use Cases

⚙️AI Code Generation

Client agent hires provider agent to write and test a smart contract. Evaluator (audit DAO) verifies the code passes all tests before releasing payment.

🏷️Data Labeling

ML training pipeline hires human labelers via provider agents. AI evaluator checks label quality against ground truth before approving payment.

✍️Content Creation

Marketing DAO hires AI writer to produce articles. Human editor acts as evaluator, approving content that meets brand guidelines.

📊Research & Analysis

DeFi protocol hires research agent to produce market analysis reports. Multisig committee evaluates accuracy before payment release.

🔍Bug Bounties

Protocol treasury creates jobs for security researchers. Smart contract evaluator automatically verifies PoC exploits on a fork before rewarding.

🌐Translation Services

Global DAO hires translation agents for governance proposals. Community vote acts as evaluator for quality assessment.

Integration Guide

1. Deploy the Contract

bash
// Deploy with Hardhat / Foundry
// 1. Install dependencies
npm install --save-dev hardhat @openzeppelin/contracts

// 2. Compile
npx hardhat compile

// 3. Deploy to Sepolia testnet
npx hardhat run scripts/deploy.js --network sepolia

// foundry alternative:
forge create --rpc-url $SEPOLIA_RPC \
  --private-key $PRIVATE_KEY \
  src/AgentEscrow8183.sol:AgentEscrow8183

2. Interact via viem / ethers.js

typescript
import { createPublicClient, createWalletClient, http } from 'viem';
import { sepolia } from 'viem/chains';
import { ESCROW_ABI } from './abi';

const CONTRACT = '0xYourDeployedContractAddress';

// 1. Create a job (client side)
const jobId = await walletClient.writeContract({
  address: CONTRACT,
  abi: ESCROW_ABI,
  functionName: 'createJob',
  args: [
    providerAddress,   // address provider
    evaluatorAddress,  // address evaluator
    tokenAddress,      // address(0) for ETH
    parseEther('1.0'), // uint256 amount
    BigInt(Math.floor(Date.now() / 1000) + 86400 * 7), // 7 days expiry
  ],
});

// 2. Fund the job (client sends ETH)
await walletClient.writeContract({
  address: CONTRACT,
  abi: ESCROW_ABI,
  functionName: 'fundJob',
  args: [jobId],
  value: parseEther('1.0'),
});

// 3. Provider submits work
const deliverableHash = keccak256(toHex('ipfs://QmYourDeliverable'));
await walletClient.writeContract({
  address: CONTRACT,
  abi: ESCROW_ABI,
  functionName: 'submitWork',
  args: [jobId, deliverableHash],
});

// 4. Evaluator approves → funds released to provider
await walletClient.writeContract({
  address: CONTRACT,
  abi: ESCROW_ABI,
  functionName: 'completeJob',
  args: [jobId],
});

3. AI Agent Integration

typescript
// AI Agent integration example (TypeScript)
import OpenAI from 'openai';

const tools = [
  {
    type: 'function',
    function: {
      name: 'create_escrow_job',
      description: 'Create a new escrow job on ERC-8183 protocol',
      parameters: {
        type: 'object',
        properties: {
          provider: { type: 'string', description: 'Provider wallet address' },
          evaluator: { type: 'string', description: 'Evaluator wallet address' },
          amount: { type: 'string', description: 'Payment amount in ETH' },
          description: { type: 'string', description: 'Job description' },
        },
        required: ['provider', 'evaluator', 'amount'],
      },
    },
  },
];

// Agent autonomously creates and manages escrow jobs
const response = await openai.chat.completions.create({
  model: 'gpt-4o',
  messages: [{ role: 'user', content: 'Hire an AI agent to write a smart contract audit report' }],
  tools,
  tool_choice: 'auto',
});

Reference