This project is built on the Midnight Network.
A ZK-powered meme coin launchpad and name service built on Midnight. Features bonding curve token launches with optional privacy, an on-chain name service (Night-ID), and an autonomous AI trading agent.
Note: This project was bootstrapped from the Midnight Starter Template for wallet integration patterns and adapted for a full-stack DApp with Next.js.
midnight-launchpad/
├── app/ # Next.js 16 App Router
│ ├── page.tsx # Home — token grid
│ ├── create/ # Launch a new token
│ ├── night-id/ # Night-ID name service
│ ├── token/[ticker]/ # Token detail + chart + trading
│ ├── profile/[address]/ # User profile
│ ├── admin/ # Admin dashboard
│ └── api/ # 16 API routes
│
├── contracts/ # Compact smart contracts
│ └── src/
│ ├── zkmint.compact # Bonding curve token launch contract
│ └── night-id/ # Night-ID name registry contract
│ └── night-id.compact # Compiled → managed/night-id/
│
├── components/ # React components
│ ├── layout/ # Sidebar, top bar
│ ├── home/ # Hero, main content
│ ├── token/ # Token card, grid, detail
│ ├── trading/ # Buy/sell panel, price chart
│ ├── night-id/ # Night-ID mint UI
│ ├── shared/ # Create token form
│ ├── profile/ # Profile page
│ ├── admin/ # Admin dashboard
│ └── ui/ # shadcn/ui primitives
│
├── lib/
│ ├── midnight/ # Midnight blockchain integration
│ │ ├── wallet-bridge.ts # 1AM wallet detection + connection
│ │ ├── wallet-adapter.ts # ConnectedAPI → WalletProvider bridge
│ │ ├── providers.ts # Full provider stack builder
│ │ ├── night-id-contract.ts # Night-ID on-chain contract calls
│ │ ├── contract-caller.ts # Token launch contract calls
│ │ ├── indexer-client.ts # Real Midnight indexer GraphQL
│ │ ├── state-decoder.ts # Hex ledger state decoder
│ │ ├── contract-watcher.ts # On-chain event polling
│ │ ├── chain-sync.ts # Chain → DB sync service
│ │ └── config.ts # Network configuration
│ ├── supabase/ # Database layer (optional)
│ └── utils.ts # Shared utilities
│
├── packages/
│ ├── zkmint-engine/ # Bonding curve math (pure TS, bigint)
│ ├── zkmint-sdk/ # SDK for contract interaction
│ ├── zkmint-agent-sdk/ # Agent SDK (market, trading, portfolio)
│ └── zkmint-agent/ # Autonomous trading agent (5 strategies)
│
├── providers/ # React context providers
│ ├── wallet-provider.tsx # 1AM wallet state
│ ├── launchpad-data-provider.tsx
│ └── theme-provider.tsx # Light/dark mode
│
├── supabase/migrations/ # Database schema (optional)
├── tests/ # 1370+ tests (vitest, zero mocks)
└── scripts/ # Deploy + graduation cranker
- Bonding curve — constant product AMM (x·y=k) for fair price discovery
- Privacy toggle — each launch can be public or private (sealed trade amounts via Midnight ZK)
- Graduation — when the pool fills (85 tNight), liquidity migrates to zswap DEX
- On-chain — Compact smart contract with 4 circuits:
initialize,buy,sell,graduate
- On-chain names — register
yourname.nightlinked to your shielded address - ZK proofs — registration verified via Midnight zero-knowledge proofs
- Unique tokens — each name mints a unique token colored by SHA-256(name)
- Shared registry — one contract, all users register against it
- Deployed contract:
09dbe05f321beac913cec95a379565de39c2e658ada99635c56ac9e415d0bd36(preview network)
- DApp Connector API — full integration with the 1AM browser extension
- Auto network detection — tries preview → preprod → mainnet automatically
- Transaction flow — all txs routed through wallet (balance + submit popups)
- Wallet provider —
balanceTx()→balanceUnsealedTransaction(),submitTx()→submitTransaction()
- 5 strategies — Momentum, Sniper, Graduation, Creator, Value
- Decision engine — merges strategy outputs, resolves conflicts, ranks by confidence
- Risk manager — position sizing, cooldowns, budget limits
- Backtesting — test strategies against historical data
- Multi-agent — run multiple agents with contract-level locking
- Node.js 20+
- 1AM Wallet browser extension
- tNight from faucet (for on-chain transactions)
git clone https://github.com/webisoftSoftware/zk-mint.git
cd zk-mint
npm install
npm run devOpen http://localhost:3000.
Copy .env.example to .env.local:
cp .env.example .env.localRequired for on-chain features:
# Night-ID shared contract (already deployed on preview)
NEXT_PUBLIC_NIGHTID_CONTRACT_ADDRESS=09dbe05f321beac913cec95a379565de39c2e658ada99635c56ac9e415d0bd36
# Proof server (for ZK circuit proving)
NEXT_PUBLIC_PROVER_SERVER_URL=http://localhost:6300Optional (enables database features):
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=
SUPABASE_SERVICE_ROLE_KEY=Optional (enables AI + IPFS):
GOOGLE_AI_API_KEY= # Gemini for AI token generation
PINATA_API_KEY= # IPFS for token images
PINATA_SECRET_API_KEY=The app works without Supabase — token creation, Night-ID minting, and wallet connection all persist to localStorage as a fallback. Supabase enables real-time data, search, charts, and multi-user features.
# Night-ID contract
compact compile contracts/src/night-id/night-id.compact contracts/src/managed/night-id
# ZKMint bonding curve (requires Compact compiler v0.28.0+)
compact compile +0.28.0 contracts/src/zkmint.compact contracts/src/managed/zkmint3 circuits on one shared contract:
| Circuit | Args | Purpose |
|---|---|---|
register |
name_hash: Bytes<32>, amount: Uint<64> |
Mint a name-colored token |
claim |
name_hash, amount, user_addr |
Send name token to user |
receive |
amount, name_hash |
Receive name token |
4 circuits per token launch:
| Circuit | Purpose |
|---|---|
initialize |
Set bonding curve params, creator, privacy mode |
buy |
Purchase tokens from curve |
sell |
Sell tokens back to curve |
graduate |
Migrate to zswap when threshold reached |
User clicks Connect
→ detectWallets() polls window.midnight
→ finds 1AM wallet extension
→ connectWallet() tries preview → preprod → mainnet
→ connectedAPI.getConfiguration() → indexer URL, prover URL
→ connectedAPI.getShieldedAddresses() → shielded address
→ buildProviders() → full MidnightProviders stack
→ walletProvider.balanceTx → connectedAPI.balanceUnsealedTransaction (wallet popup)
→ midnightProvider.submitTx → connectedAPI.submitTransaction (wallet popup)
# Run all 1370+ tests
npx vitest run
# Run specific test file
npx vitest run tests/engine/price-calculator.test.ts
# Run tests in watch mode
npx vitestTest breakdown:
- Engine (bonding curve math, graduation): 200 tests
- SDK (bonding curve preview): 60 tests
- Contract (state machine simulation): 55 tests
- API routes (validation, SQL migrations): 190 tests
- Lib (utils, wallet, indexer, state decoder): 280 tests
- Agent (strategies, decision engine, risk manager): 280 tests
- Integration (lifecycle, privacy): 65 tests
vercel --prodOn-chain transactions require a ZK proof server. Options:
- Local Docker:
docker run -p 6300:6300 midnight-proof-server - Remote server: Set
NEXT_PUBLIC_PROVER_SERVER_URLto your server URL - Wallet built-in (when available): The 1AM wallet's
getProvingProvider()API
Run the autonomous trading agent:
cd packages/zkmint-agent
# Simulation mode (default, no real trades)
npm run start:sim
# Live trading (requires wallet seed + proof server)
SIMULATION_MODE=false SEED=<hex> npm run startConfigure via environment variables:
RISK_LEVEL— conservative | moderate | aggressiveMAX_POSITIONS— max concurrent token positionsTOTAL_BUDGET— total tNight budgetLOOP_INTERVAL— tick interval in ms
| Network | Node | Indexer | Faucet |
|---|---|---|---|
| Preview | rpc.preview.midnight.network | indexer.preview.midnight.network | faucet |
| Preprod | rpc.preprod.midnight.network | indexer.preprod.midnight.network | faucet |
- Frontend: Next.js 16, React 19, Tailwind v4, shadcn/ui
- Blockchain: Midnight (Compact smart contracts, ZK proofs)
- Wallet: 1AM DApp Connector API v4.0.1
- Fonts: Instrument Serif (display), Space Grotesk (body), JetBrains Mono (code)
- Database: Supabase (optional, PostgreSQL + Realtime)
- Testing: Vitest (1370+ tests, zero mocks)
- SDK: @midnight-ntwrk/midnight-js-contracts, ledger-v8, compact-runtime
MIT
