How to Build
Back to Blog
CryptoAIAgentsCryptoEthereumBooks

How to Build

Global Builders ClubFebruary 1, 20266 min read

The complete protocol stack for trustless agent marketplaces

Share:

How to Build "Upwork for AI Agents" with ERC-8004: A Technical Tutorial

The complete protocol stack for trustless agent marketplaces


What if AI agents could hire each other?

Not humans browsing agent profiles—agents autonomously discovering, evaluating, hiring, and paying other agents based on cryptographically verified reputation.

A marketing agent that needs image generation could hire a design agent. An analysis agent that needs real-time data could pay a data agent per query. A complex task orchestrator could delegate subtasks to specialized agents, all without human intervention.

This isn't science fiction. The infrastructure to build this exists today, and this tutorial will show you how to use it.


The Problem with Current Agent Marketplaces

Today's AI agent marketplaces suffer from several fundamental issues:

No Standard Identity: Each platform has its own identity system. An agent's reputation on Platform A means nothing on Platform B.

No Portable Reputation: Build a track record on one marketplace, and you start from zero when you move.

No Verification: Clients have no way to verify that work was actually completed to specification beyond trusting the platform.

High Fees: Traditional platforms charge 20%+ in fees—money that could go to agents or clients.

Human-Dependent: Most marketplaces require humans at every step. Agents can't autonomously discover and hire other agents.

ERC-8004, combined with complementary protocols, solves all of these problems.


The Protocol Stack

Building a trustless agent marketplace requires four protocol layers:

Layer 1: ERC-8004 (Identity, Reputation, Validation)

ERC-8004, created in August 2025 by co-authors from MetaMask, Ethereum Foundation, Google, and Coinbase, establishes three on-chain registries:

Identity Registry: Every agent gets an ERC-721 token pointing to an off-chain JSON "Agent Card" containing capabilities, endpoints, and supported trust models.

Reputation Registry: Records structured feedback from clients with scores, tags, and cryptographic authorization to prevent spam.

Validation Registry: Enables third-party verification of agent work with stake-based accountability.

Layer 2: A2A Protocol (Discovery & Communication)

Google's Agent-to-Agent protocol standardizes how agents discover each other through Agent Cards published at /.well-known/agent.json. This enables programmatic capability discovery.

Layer 3: MCP (Capabilities)

Anthropic's Model Context Protocol exposes what an agent can actually do—its tools, resources, and prompts. Adopted by OpenAI and Google DeepMind in 2025.

Layer 4: x402 (Payments)

Coinbase's x402 protocol enables micropayments as small as $0.001 with latency under 200ms. Agents can pay other agents automatically over HTTP without human intervention.


Building the Marketplace: Step by Step

Step 1: Set Up the Agent Registration File

Every agent needs a registration file that describes its identity and capabilities:

{
  "type": "https://eips.ethereum.org/EIPS/eip-8004#registration-v1",
  "name": "DataAnalysisAgent",
  "description": "Performs market analysis and generates reports with 95% accuracy",
  "image": "ipfs://Qm.../agent-avatar.png",
  "endpoints": [
    {
      "name": "A2A",
      "endpoint": "https://agent.example/.well-known/agent.json",
      "version": "0.3.0"
    },
    {
      "name": "MCP",
      "endpoint": "https://agent.example/mcp",
      "capabilities": ["analyze", "report", "visualize"]
    }
  ],
  "supportedTrust": ["reputation", "validation"],
  "x402Support": true
}

Upload this to IPFS and you get a permanent, content-addressed URI.

Step 2: Register on the Identity Registry

const agentURI = `ipfs://${ipfsHash}`;
const tx = await identityRegistry.register(agentURI, []);
const receipt = await tx.wait();
const agentId = receipt.events[0].args.agentId;
console.log(`Registered agent with ID: ${agentId}`);

Your agent now has a portable, verifiable identity that works across any marketplace built on ERC-8004.

Step 3: Create the Job Registry Contract

The job registry handles posting jobs, accepting bids, and tracking work status:

struct Job {
    uint256 jobId;
    address client;
    string descriptionURI;
    uint256 budget;
    uint256 deadline;
    string[] requiredCapabilities;
    uint256 minReputationScore;
    JobStatus status;
    uint256 assignedAgentId;
}

function postJob(
    string calldata descriptionURI,
    bytes32 descriptionHash,
    uint256 deadline,
    string[] calldata capabilities,
    uint256 minReputation
) external payable returns (uint256);

function submitBid(
    uint256 jobId,
    uint256 agentId,
    uint256 price,
    string calldata proposalURI
) external;

function acceptBid(uint256 jobId, uint256 bidIndex) external;

function submitWork(
    uint256 jobId,
    string calldata deliverableURI,
    bytes32 deliverableHash
) external;

Step 4: Implement Escrow with Validation

The escrow contract holds payment until work is validated:

function createEscrow(
    uint256 jobId,
    uint256 agentId,
    address validator
) external payable returns (uint256);

function requestValidation(
    uint256 escrowId,
    string calldata deliverableURI,
    bytes32 deliverableHash
) external;

function releaseOnValidation(uint256 escrowId) external {
    // Check validation score meets threshold
    (,, uint8 response,,,) = validationRegistry.getValidationStatus(
        escrow.validationRequestHash
    );
    require(response >= 70, "Validation score too low");

    // Release payment to agent
    address agentWallet = identityRegistry.getAgentWallet(escrow.agentId);
    payable(agentWallet).transfer(escrow.amount * 97 / 100); // 3% fee
}

Step 5: Integrate Reputation Feedback

After work is complete, clients provide feedback:

// Agent signs authorization allowing client to submit feedback
const feedbackAuth = await agent.signMessage(
    ethers.solidityPackedKeccak256(
        ['address', 'uint256'],
        [clientAddress, agentId]
    )
);

// Client submits feedback with authorization
await reputationRegistry.giveFeedback(
    agentId,
    90,  // score out of 100
    0,   // decimals
    "market-analysis",  // tag1
    "quality",          // tag2
    "",                 // endpoint
    feedbackURI,
    feedbackHash
);

The pre-authorization mechanism ensures only actual clients can submit reviews—eliminating fake feedback.


The Complete Workflow

Here's how a job flows through the marketplace:

  1. Agent registers identity on ERC-8004 with capabilities
  2. Client posts job with budget, requirements, and deadline
  3. Agents discover job via marketplace or A2A protocol
  4. Agents submit bids with proposals and pricing
  5. Client accepts bid, escrow is created
  6. Agent completes work, submits deliverables
  7. Validator verifies work meets specifications
  8. Escrow releases payment based on validation score
  9. Client provides feedback with agent authorization
  10. Reputation updates on-chain for future discovery

Each step is verifiable on-chain, with off-chain data anchored by cryptographic hashes.


Why This Changes Everything

From 20%+ Fees to Under 3%

Traditional freelance platforms charge hefty fees because they provide identity verification, escrow, and dispute resolution. With ERC-8004, these services are provided by the protocol itself at near-zero marginal cost.

Agent-to-Agent Transactions

Olas has already processed 2M+ agent-to-agent transactions—agents hiring other agents for capabilities they lack. This is the bigger opportunity: not just digitizing human freelance work, but enabling entirely new economic activity between artificial agents.

Portable Reputation

Build reputation on one marketplace, and it transfers to any other marketplace built on ERC-8004. This creates healthy competition between platforms and gives agents leverage.

Validation as a Service

The Validation Registry enables a new market: specialized validators who stake collateral and compete on accuracy. Domain experts can earn fees by verifying agent work in their specialty.


Getting Started

Reference implementations are live on testnets:

  • Nuwa Protocol: Production-quality contracts with 100% spec compliance
  • Vistara Example: Complete implementation with AI agents (Python/CrewAI)
  • Supported testnets: Ethereum Sepolia, Base Sepolia, Linea Sepolia, Hedera

Key resources:


Conclusion

The infrastructure for trustless agent marketplaces exists today. ERC-8004 provides identity and trust, A2A enables discovery, MCP exposes capabilities, and x402 handles payments.

What's missing is the marketplace itself—the application layer that brings these protocols together into a coherent user experience.

The first team to build a compelling "Upwork for Agents" on this stack will capture a market that doesn't exist yet: autonomous AI economic activity. That market could be enormous.

The protocols are ready. The testnets are live. Who's building?


Full technical tutorial with complete Solidity contracts and TypeScript SDK available in our analysis document.

Written by

Global Builders Club

Global Builders Club

Support Our Community

If you found this content valuable, consider donating with crypto.

Suggested Donation: $5-15

Donation Wallet:

0xEc8d88...6EBdF8

Accepts:

USDCETHor similar tokens

Supported Chains:

EthereumBasePolygonBNB Smart Chain

Your support helps Global Builders Club continue creating valuable content and events for the community.

Enjoyed this article?

Join our community of builders and stay updated with the latest insights.