Skip to content

aarav1656/ghostbid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sealed bids where the AI valuation literally cannot lie - VCG mechanism meets 0G TEE provenance.

GhostBid

Sealed Strategy Auctions where AI agents bid privately inside TEEs, and settlement is verifiable on-chain with 0G stack.

Track 3: Agentic Economy & Autonomous Applications

Uses 0GM-1.0-35B-A3B - 0G's proprietary MoE model trained end-to-end on 0G Compute Network via DiLoCoX (shipped May 14, 2026)

Deployed Contract

Contract Address Network
AuctionHouse 0xeb4907a4A06592EEfbD646a40A20ccdd276877d1 0G Galileo Testnet

37+ on-chain transactions verified on 0G Galileo Testnet.


What Makes This Different

Unlike commit-reveal auctions, GhostBid uses TEE to open ALL bids simultaneously - no bidder cooperation needed. The AI valuation agent learns from past sales.

  • No reveal phase - TEE decrypts all bids atomically at settlement
  • No griefing - bidders can't stall the auction by refusing to reveal
  • AI-powered bidding - 0GM-1.0-35B-A3B generates game-theory optimal bids inside Private Computer
  • Verifiable fairness - TEE attestation proves correct settlement
  • VCG second-price payment - Winner pays the second-highest bid, incentivizing truthful bidding

Novel Mechanism: AI-Oracled VCG Payment Rule

GhostBid implements the Vickrey-Clarke-Groves (VCG) mechanism inside a TEE:

Property First-Price Auction GhostBid (VCG)
Winner pays Their own bid Second-highest bid
Optimal strategy Shade bid below true value Bid your TRUE value
AI agent behavior Must guess others' bids Just estimate true value
Incentive compatibility No (strategic) Yes (DSIC)

Why this matters for AI agents: In first-price auctions, AI agents must model other bidders' strategies (hard). With VCG, the AI oracle simply estimates the item's true value and bids it - no game-theory shading needed. This is dominant strategy incentive compatible (DSIC).

Academic basis: Vickrey 1961, Clarke 1971, Groves 1973. First implementation combining VCG with TEE-sealed AI valuation oracle on 0G.

How it works:

  1. AI agents bid their true estimated value (no strategic shading)
  2. TEE decrypts all bids atomically at settlement
  3. Highest bidder wins but pays only the second-highest bid
  4. Winner surplus = (their bid - payment) is pure value capture

Quick Demo

# 1. Clone and install
git clone https://github.com/aarav1656/ghostbid && cd ghostbid
cd packages/backend && npm install && cp .env.example .env
# Fill .env with your 0G Private Computer API key and deployer key

# 2. Start the backend
npm run dev
# API runs on http://localhost:3001

# 3. Create an auction
curl -X POST http://localhost:3001/auction/create \
  -H "Content-Type: application/json" \
  -d '{"itemDescription": "Rare NFT #42", "minBid": "0.01", "duration": 3600}'

# 4. AI agent bids (generates strategy inside TEE)
curl -X POST http://localhost:3001/auction/1/bid \
  -H "Content-Type: application/json" \
  -d '{"budget": "0.05"}'

# 5. Settle after deadline (TEE decrypts all bids)
curl -X POST http://localhost:3001/auction/1/settle

# 6. Or use the frontend
cd ../frontend && npm install && npm run dev
# Open http://localhost:3000 - connect wallet, create auctions, watch AI bid

What is GhostBid?

GhostBid introduces the Sealed Strategy Auction (SSA) primitive: AI agents analyze items, compute game-theory optimal bids inside 0G Private Computer (TEE), commit encrypted bids on-chain, and a TEE oracle settles the auction with verifiable attestation. No bidder ever sees another's strategy.


0G Integration

0G Component Usage Why Essential
0G Chain (Galileo) AuctionHouse contract - sealed bid commits, settlement, refunds On-chain state and economic settlement
0G Private Computer AI bid generation (0GM-1.0-35B-A3B inference inside TEE), bid decryption at settlement Bids stay secret until settlement - no front-running
TEE Attestation Settlement includes attestation hash proving correct decryption Verifiable fairness without revealing losing bids

Architecture

Bidder Agent                    Settlement Oracle
     |                                |
     | 1. Analyze item via 0GM-1.0    |
     |    (inside Private Computer)   |
     |                                |
     | 2. Generate optimal bid        |
     |    (game-theory shading)       |
     |                                |
     | 3. Encrypt & commit on-chain   |
     |                                |
     |                                | 4. After deadline, collect bids
     |                                | 5. Decrypt inside TEE
     |                                | 6. Determine winner
     |                                | 7. Submit settlement + attestation
     |                                |
     +------------ 0G Chain ----------+
              AuctionHouse.sol

Quick Start

Prerequisites

  • Foundry (forge)
  • Node.js 20+
  • 0G Private Computer API key from pc.0g.ai

Deploy Contracts

cd packages/contracts
forge install OpenZeppelin/openzeppelin-contracts
forge build
forge script script/Deploy.s.sol --rpc-url $GALILEO_RPC_URL --broadcast --private-key $DEPLOYER_PRIVATE_KEY

Run Backend

cd packages/backend
cp .env.example .env  # fill in keys
npm install
npm run dev

API Endpoints

Method Path Description
GET / Health check
GET /auctions/stats Auction stats (total, active, volume)
POST /auction/create Create auction {itemDescription, minBid, duration}
POST /auction/:id/bid AI agent bids {budget}
POST /auction/:id/settle TEE settles auction
GET /auction/:id Auction details
GET /auctions List all auctions

How It Works

  1. Create - Anyone posts an item for auction with a minimum bid and duration
  2. Bid - AI agents analyze the item via 0GM-1.0 inside 0G Private Computer, generate game-theory optimal bids, encrypt them with the TEE's public key, and commit the hash on-chain with ETH deposit
  3. Settle - After the deadline, the TEE operator collects all encrypted bids. The TEE decrypts ALL bids simultaneously inside the enclave - no bidder cooperation needed. It determines the winner using the VCG rule (second-price), signs the result with attestation proof, and submits settlement on-chain with TEE attestation
  4. Refund - Losing bidders reclaim their deposits

Why TEE eliminates bidder cooperation: In traditional commit-reveal auctions, bidders must actively reveal their bids (creating griefing risk). In GhostBid, bids are encrypted to the TEE's public key at submission time. At settlement, the TEE decrypts all bids atomically inside the enclave - bidders do nothing. No reveal phase, no timeouts, no griefing.


Faucet & Testing

Get testnet tokens from the faucet, then interact with the deployed AuctionHouse at 0xeb4907a4A06592EEfbD646a40A20ccdd276877d1.


Repository Layout

packages/
  contracts/   Foundry - AuctionHouse (sealed-bid + TEE settlement)
  backend/     Hono API - bid agent, settlement oracle, auction CRUD
  frontend/    Next.js UI - auction creation, bidding, settlement dashboard

License

MIT

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors