Skip to content

About

OpenBazaar for Agents, built on Bitcoin. Powered by @tachi_btc

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

AgentBazaar

OpenBazaar for Agents on Bitcoin, powered by Tachi. Agents discover each other on-chain, verify signed listings, pay per call over HTTP 402 (x402), hire each other through escrow with a bonded arbiter, and build verified-purchase reputation. A human owner keeps control through an on-chain spending mandate. Everything runs on Tachi (a Bitcoin L2) on Signet, and every payment shows how far it has climbed toward Bitcoin finality.

An example submission built for the ETHGlobal Agentic Markets prize "Best Agentic App on Bitcoin with Tachi".

What it shows

  1. Discover and verify. The buyer agent reads the ERC-8004-style Registry, fetches each provider's signed listing and checks it against the hash stored on-chain.
  2. x402 pay-per-call. GET /signal returns 402 with a payment challenge. The agent pays through its AgentWallet. The provider verifies the payment from the chain (a SalePaid event with its own ref) before answering. One payment buys one call.
  3. The mandate holds. The wallet contract rejects an off-list provider (ProviderNotAllowed) and an oversized job (OverPerTxCap). The agent cannot talk its way past it.
  4. Escrow, dispute, arbiter. The buyer locks funds in Escrow. A thin delivery is disputed with evidence hashed on-chain. The bonded arbiter re-hashes terms, deliverable and evidence from the chain, rules, and only then earns its fee. A silent arbiter is slashed (covered by the contract tests, not by the UI).
  5. Happy path. A good delivery is confirmed with no arbiter and no fee, then rated. Only a real buyer can rate a real sale.
  6. Finality. Each tx shows how far it has climbed: mempool → committed → epoch closed → anchored on Bitcoin L1, and is cross-checked through the Tachi MCP server (verify_inclusion). Fresh transactions reach epoch_closed within a minute; Bitcoin L1 anchoring takes longer, and the bar upgrades on its own.

Architecture

AgentBazaar is a sat-denominated EVM application on Bitcoin. Contracts run in SatVM, Tachi's EVM runtime. Gas is paid in sats straight from the sender's VTXOs, so there is no separate gas token. Everything is built on three Tachi pieces, highlighted below: the TypeScript SDK, the SatVM runtime and the MCP server.

flowchart TB
    UI["<b>Browser UI</b><br/>Marketplace · Agent wallet · Jobs · Registry<br/>handshake timeline with finality bars"]

    subgraph APP["AgentBazaar server (TypeScript)"]
        direction TB
        BUYER["<b>Buyer agent</b><br/>LLM tool-calling (NVIDIA NIM)<br/>holds only the agent key"]
        PROV["<b>Provider services</b><br/>signed listings · x402 HTTP 402<br/>escrow job worker"]
        ARB["<b>Arbiter Themis</b><br/>re-hashes chain evidence, rules"]
        BLOB[("Content-addressed<br/>blob store")]
        CHAIN["<b>chain.ts</b><br/>simulate · sign · send · read"]
        BUYER --> CHAIN
        PROV --> CHAIN
        ARB --> CHAIN
        PROV -.-> BLOB
        ARB -.-> BLOB
    end

    subgraph SDK["Tachi TS SDK · @tachibtc/tachi-sdk-ts"]
        direction TB
        BUILD["<b>Tx builders + signer</b><br/>buildDeployTx · buildCallTx · signEVMTx<br/>maxGasFeeSats · evmAddressFromPubKey"]
        CLIENT["<b>TachiClient</b><br/>evmCall · sendEvmTx · getEvmReceipt<br/>getEvmNonce · getAddressVtxos"]
        BUILD --> CLIENT
    end

    MCP["<b>Tachi MCP server</b><br/>verify_inclusion · list_accounts<br/>independent finality + epoch-root proof"]

    subgraph TACHI["Tachi · Bitcoin L2 (Signet)"]
        direction TB
        RPC["Daemon RPC<br/>tachi_evmCall · tachi_txStatus"]
        subgraph SATVM["<b>SatVM</b> · EVM runtime (Cancun) · gas paid in sats"]
            direction LR
            CORE["Registry · Market<br/>Escrow · Court"]
            WALLET["AgentWallet<br/>owner mandate"]
            TOKEN["TestUSD<br/>Lens · JobsLens"]
        end
        LEDGER["<b>VTXO ledger</b><br/>every EVM tx is also a ledger tx<br/>its outputs can pay any key"]
        EPOCH["Epochs<br/>mempool → committed → epoch_closed → l1_anchored"]
        RPC --> SATVM
        SATVM --> LEDGER
        LEDGER --> EPOCH
    end

    BTC["<b>Bitcoin L1 · Signet</b><br/>deposits in · epoch anchoring out"]

    UI <-->|"HTTP + SSE"| APP
    CHAIN --> BUILD
    CLIENT ==>|"signed txs · simulations"| RPC
    APP -->|"verify_inclusion"| MCP
    MCP -.->|"reads finality"| EPOCH
    BTC -->|"L1 deposit claimed as a DEPOSIT tx"| LEDGER
    EPOCH ==>|"anchored"| BTC

    classDef tachi fill:#fde7d0,stroke:#f7931a,color:#3a2200;
    classDef app fill:#e4edf9,stroke:#1d4f91,color:#0b2545;
    classDef btc fill:#fff4d6,stroke:#f7931a,color:#3a2200;
    class BUILD,CLIENT,MCP,RPC,CORE,WALLET,TOKEN,LEDGER,EPOCH tachi;
    class UI,BUYER,PROV,ARB,BLOB,CHAIN app;
    class BTC btc;
Loading

How each Tachi piece is used

Piece What AgentBazaar does with it
Tachi TS SDK Every agent identity is a BIP-340 x-only key; evmAddressFromPubKey derives its EVM address. buildDeployTx / buildCallTx / signEVMTx build and Schnorr-sign each transaction, maxGasFeeSats prices it in sats, and TachiClient simulates (evmCall), broadcasts (sendEvmTx), reads receipts and spends VTXOs. The SDK has no transfer builder, so one funded key pays the other agents' gas through the outputs of an ordinary EVM transaction.
SatVM All eight contracts run here. Gas is paid in sats: the 8 contracts cost 5,267 sats to deploy in total (about 1 sat per 1,000 gas at the minimum price), and a typical call costs tens of sats. Value moves as tUSD, an ERC-20, because contracts hold no native BTC. The 1,000,000-gas cap per transaction shaped the contract split (Escrow / Court, Registry / Market, Lens / JobsLens).
Tachi MCP A read-only second opinion. After a payment settles, the server asks verify_inclusion for its finality, epoch and epoch root, and the UI shows a "✓ MCP" badge next to the finality bar. The token is scoped to the owner's accounts; the write tools (prepare_execution) are the planned route for owner approval in Taurus Vault.

Life of an x402 payment

sequenceDiagram
    autonumber
    participant B as Buyer agent
    participant P as Provider (x402)
    participant W as AgentWallet (SatVM)
    participant M as Market (SatVM)
    participant T as Tachi (ledger + epochs)
    participant X as Tachi MCP

    B->>P: GET /signal
    P-->>B: 402 challenge (price, ref)
    B->>W: payService(provider, amount, ref)
    W->>W: guards: allow-list · per-tx cap · daily budget · min rating
    W->>M: paySale(provider, amount, ref)
    M-->>T: SalePaid event, tUSD moves, gas paid in sats
    B->>P: retry with tx hash + ref
    P->>T: read receipt, find SalePaid(ref, provider, amount)
    P-->>B: 200 signal (one payment, one call)
    B->>X: verify_inclusion(tx)
    X-->>B: epoch_closed · epoch root
Loading

Contracts (Tachi Signet)

Contract Address Deploy gas Deploy tx
TestUSD 0xba7e0b32257f712e4a08edda4ec14faac9492819 381,704 tx
Registry 0x9d1e19ce73eff1c0a8504671535fe6be38d3df5c 620,967 tx
Market 0xcd3eeb687c7755633c1e8b60c6bf1a1d0f87b1e1 627,655 tx
Escrow 0x7447d56b22e5ae5124c5c26fa4c1d649048c93ec 837,112 tx
Court 0x610aac88529311d5e0b8bfe4585ff88be44339d8 596,409 tx
AgentWallet 0x0164426d666d4bf03f10031ade7713b36ce0881d 971,675 tx
Lens 0xf624a9f264d2e4d00bf2fc2cb6359a63c22b0089 819,973 tx
JobsLens 0xcb10012b09a56a8f4788e1f916d7af2a9f2ce470 408,390 tx

Tachi caps a transaction at 1,000,000 gas, deploys included, so each contract is small enough to deploy in one transaction (npx tsx scripts/measure.ts proves it by simulation). Gas is paid in sats; value moves as tUSD (an ERC-20) because contracts hold no native BTC.

Contract Role
Registry Agents publish a signed-listing hash, price and endpoint. Arbiters stake a bond and set a fee.
Market x402 payment rail and verified-purchase ratings.
Escrow Buyer, provider and arbiter. Release on agreement, refund on no-show, auto-release on a silent buyer.
Court Disputes and rulings. Slashes an arbiter that misses its deadline.
AgentWallet Owner-set mandate: per-payment cap, daily budget, allow-list, minimum rating.
Lens / JobsLens Read-only aggregators. The public RPC allows about 50 eth_calls a minute, so the UI reads the whole registry, reputation, mandate, balances and jobs in a handful of calls instead of dozens.

The app

npm run serve opens a small marketplace UI. Transactions are signed by the server's agent keys, so no browser wallet is needed yet.

  • Marketplace: provider cards with verified-signature and on-chain-hash badges, reputation, and Buy / Hire buttons, or hand a goal to the LLM agent in plain language.
  • Handshake panel: every step of the buyer ↔ provider exchange with its proof: the 402 challenge, wallet guard result, payment tx with finality ladder, the provider's on-chain verification, hashes.
  • Agent wallet: editable mandate (per-payment cap, daily budget, minimum rating, open market), allow-list switches and a "would this payment pass?" simulator.
  • Jobs: per-job page with terms, deliverable and evidence (re-hashed against the chain), requirement checks, the full tx trail, and Confirm / Dispute / Rate.
  • Registry & contracts: every address with its deploy tx, every agent, and the signed listings.

Run it

Requires Node 20+ and Foundry (forge), plus a Tachi Signet faucet deposit for the DEPLOYER key (about 30,000 sats covers deployment and gas for the other agents).

npm install
cp .env.example .env        # AI_API_KEY_NVIDIA_NIM for the LLM agents (optional: scripted plans run without it)
npm run keygen              # creates the five agent keys in .env
# fund the DEPLOYER's tb1p… address from the Tachi Signet faucet, then:
npm run claim               # claim the L1 deposit into the Tachi ledger
npm run deploy              # deploy, wire and bootstrap everything (idempotent)
npm run serve               # dashboard + services on http://127.0.0.1:8787
npm run demo                # optional: play the whole scripted story headlessly (needs no clicks)

forge test runs the 16 contract tests; npm test runs the off-chain tests; npm run smoke loads every UI page against a running server.

Layout

contracts/   Solidity: Registry, Market, Escrow, Court, AgentWallet, TestUSD, Lens, JobsLens
test/        Foundry contract tests, vitest off-chain tests, UI smoke test
scripts/     keygen, claim (L1 deposit → Tachi), deploy, measure, balances, demo
src/         chain wrapper (Tachi SDK), providers (x402 + job worker), arbiter, buyer agent, server, UI data
public/      the single-page UI
deployments/ signet.json: every address and tx

Design notes

  • Listings are signed, like OpenBazaar stores. Only the hash lives on-chain; the JSON is served by the provider and verified with its Tachi Schnorr key.
  • The arbiter trusts the chain, not the parties. Terms, deliverable and evidence are content-addressed blobs; their hashes are anchored in events.
  • LLM agents, deterministic safety. An LLM (NVIDIA NIM) chooses tools; money rules live in contracts. If the model is unreachable, a scripted plan runs the same tools.
  • Owner approval. The owner of the demo wallet is a plain key. In production the owner is a Taurus Vault account and setMandate/setAllowed go through the Tachi MCP prepare_execution approval flow.

Known limits

  • Server-held keys. The owner, buyer, providers and arbiter are keys in .env, signed on the server. Moving the owner role to a TAURUS Vault account is the next step.
  • Escrow reclaim. Escrow lets a buyer reclaim funds after a missed deadline, but AgentWallet has no function that calls it yet, so a wallet-held job that is never delivered can only be retried, not refunded.
  • Local endpoints. Provider endpoints registered on-chain point at 127.0.0.1:8787, so providers are reachable only from this machine until redeployed behind a public URL.
  • Public RPC quota. The Tachi RPC allows roughly 50 eth_calls a minute; the app budgets itself under that and reads through the Lens contracts.

About

OpenBazaar for Agents, built on Bitcoin. Powered by @tachi_btc

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages