primer · midnight

Four ZK primitives, demystified.

Every idea in this repo leans on one of four Midnight primitives. Each runs against the Midnight preview testnet — a real ZK L1 funded by a tDUST faucet, so you can ship a provably private demo with zero hosting and no real DUST spent.

The five secrets

Add these in your Lovable project (Settings → Secrets) before pasting any mega-prompt:

  • VITE_NETWORK_ID`preview` (or `preprod`). Matches Lace's network setting.open ↗
  • VITE_INDEXER_URLMidnight GraphQL Indexer for public ledger reads.open ↗
  • VITE_INDEXER_WS_URLWebSocket endpoint for realtime ledger subscriptions.open ↗
  • VITE_PROOF_SERVER_URLLocal Docker proof server (port 6300) — required for tx submits.open ↗
  • VITE_DEFAULT_CONTRACTPre-deployed contract address so users skip the deploy step.open ↗
  • PINATA_JWTOptional. Only for ideas that pin artefacts to IPFS.
Terminal (one-time): install the Compact toolchain (compact update), run compact compile, then start the proof server:docker run -p 6300:6300 midnightntwrk/proof-server:8.1.0 midnight-proof-server -v
onchain logic

Compact ZK contract

520 ideas use this
kernel
a Compact `.compact` contract compiled to ZK proving/verifying keys and deployed to the Midnight preview testnet, with public ledger state readable from the Indexer
how it drives the UI
a 'verified on Midnight' badge with the live contract address and a Midnight explorer link
decentralized storage

IPFS content + on-chain CID

487 ideas use this
kernel
pin creative artefacts to IPFS via Pinata, then commit the CID to the public ledger through the Compact contract so provenance is verifiable but the file itself stays on IPFS
how it drives the UI
a 'pinned to IPFS · logged on Midnight' chip with the CID, gateway preview, and a Midnight explorer link
networks

Undeployed vs Preprod vs Preview vs Mainnet

Midnight ships four networks — one local (Undeployed, in Docker) and three hosted. Addresses, faucets, and SDK versions differ by suffix; the wallet you derive from a seed will look different on each.

UndeployedPreprodPreviewMainnet
PurposeLocal standalone chain running in Docker — no faucet dance, offline-friendly, resets when you tear down the volume.Stable testnet mirroring the current mainnet release train.Bleeding-edge testnet for upcoming SDK / protocol changes.Real network. Real value.
Address prefixmn_addr_undeployed1…mn_addr_preprod1…mn_addr_preview1…mn_addr1…
TokentDUST minted by local genesis seed (…0002); Lace starts at 0 and must be funded via scripts/fund-lace.sh.tNIGHT → tDUST (free test tokens)tNIGHT → tDUST (free test tokens)NIGHT → DUST (real, purchased)
FaucetNone — local midnight-local-dev faucet / bundled script.Nethermind preprod faucetMidnight preview faucetNone
SDK versionPinned Docker tags from the support matrix (midnight-node:0.22.5, indexer-standalone:4.0.2, proof-server:8.0.3).Stable, matches current mainnet.Next release candidate — may break between drops.Stable, audited.
Use forHackathon dev loop, offline demos, first-mint proof warm-up.Demos, hackathon submissions, integration tests.Trying features before they hit preprod.Production dApps only.
Reset policyWhenever you tear down the containers or delete the volume.Occasional resets around major upgrades.Reset frequently without notice.Never.
Which one for the hackathon? Use Undeployed for the local dev loop — fastest iteration, no faucet, no network flakiness. Promote to Preprod for a shareable submission that tracks mainnet behaviour. Only reach for Preview if you need an SDK feature that hasn't landed on preprod yet.