Skip to content

schappi1-byte/Midnight-Auction

Repository files navigation

Midnight Auction

Sealed-bid private auction built on Midnight's Private Reserve Auction Compact contract.

What it does

  • Auctioneer creates an auction with a hidden reserve (commitment on-chain).
  • Bidders place bids with DApp-scoped public keys (harder to track wallets across apps).
  • When the auction closes, the auctioneer runs revealWin to prove the reserve and return the winning bid.

Quick start

Prerequisites

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/midnightntwrk/compact/releases/latest/download/compact-installer.sh | sh
compact update

Install & run tests (local devnet)

yarn install
yarn test:auction:docker   # starts compose.yml, runs test, tears down
# or manually:
yarn env:up                # docker compose -f compose.yml up -d --wait
yarn test:auction          # deploy → 2 bids → reveal winner
yarn env:down

Requires Docker Desktop running.

Demo UI + 1AM wallet (Preview)

yarn web:dev
  1. Install 1AM wallet and set network to Preview
  2. Log in → Wallet tab → Connect 1AM Wallet (Preview)
  3. Fund via Preview faucet (unshielded address)
  4. Header shows Preview address + tDUST when connected

Falls back to a local demo address if no extension is detected.

Supabase backend (optional)

Shared auth + auction data (falls back to browser localStorage when keys are empty).

  1. Create a project at supabase.com
  2. In SQL Editor, run supabase/schema.sql
  3. Paste credentials in web/src/config/supabase.ts (Project Settings → API):
export const SUPABASE_URL = 'https://cqdnqmaxelryjmntvrkk.supabase.co';
export const SUPABASE_ANON_KEY = 'eyJ...your-anon-key...';

Or use web/.env.local (see web/.env.local.example).

  1. Auth: sign up / log in with email (RLS ties rows to auth.uid()). Link 1AM wallet after login.

  2. Email confirmation: disable in Supabase Auth settings for hackathon speed, or confirm email before first login.

  3. Restart yarn web:dev — login page shows “stored in Supabase”

Bid visibility (your schema): only the bidder and auctioneer can read bids (not public to all bidders).

Compact: sealed bid amounts

See contracts/SEALED_BIDS_REVIEW.md — v1 hides reserve only; bid amounts are public on-ledger. v2 design uses commitments.

Recompile contract

yarn compile:contract

Project layout

contracts/
  private-auction.compact   # Midnight official reserve auction (branded)
  SEALED_BIDS_REVIEW.md     # sealed-bid upgrade notes
  managed/private-auction/  # compiled ZK artifacts (committed)
  witnesses.ts              # localSk secret key handling
src/test/auction.test.ts    # 3-wallet integration test
web/                        # React demo for judges / video

Pitch (30 seconds)

  1. Problem: Open auctions leak bids — sniping and signaling ruin fair price discovery for high-value items.
  2. Why Midnight: Reserve and bidder privacy require ZK; public chains cannot do sealed bids fairly.
  3. User: Auction houses / creators selling art, IP, or collectibles with sealed bidding.

Stretch goals

  • Commitment-based bid amounts (fully sealed until close)
  • 1AM wallet + Preview on-chain deployment
  • Settlement circuit (winner pays, item transfers)

License

Apache-2.0 (see LICENSE)

About

Privacy-first sealed-bid auctions on Midnight blockchain. Bids stay encrypted until close, preventing frontrunning, shill bidding, and market manipulation. Smart contract proves fairness with zero-knowledge proofs. Fair, transparent, cryptographically verifiable. $1.58T market opportunity. - Midnight Hackathon MLH DeFi Track

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors