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:latest midnight-proof-server -v
onchain logic

Compact ZK contract

250 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

247 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

Preprod vs Preview vs Mainnet

Midnight ships three networks. Addresses, faucets, and SDK versions differ by suffix — the wallet you derive from a seed will look different on each.

PreprodPreviewMainnet
PurposeStable testnet mirroring the current mainnet release train.Bleeding-edge testnet for upcoming SDK / protocol changes.Real network. Real value.
Address prefixmn_addr_preprod1…mn_addr_preview1…mn_addr1…
TokentNIGHT → tDUST (free test tokens)tNIGHT → tDUST (free test tokens)NIGHT → DUST (real, purchased)
FaucetNethermind preprod faucetMidnight preview faucetNone
SDK versionStable, matches current mainnet.Next release candidate — may break between drops.Stable, audited.
Use forDemos, hackathon submissions, integration tests.Trying features before they hit preprod.Production dApps only.
Reset policyOccasional resets around major upgrades.Reset frequently without notice.Never.
Which one for the hackathon? Preprod is the default in this repo — it tracks mainnet behaviour, the faucet is reliable, and the deploy script + wallet JSON default there. Only reach for Preview if you need an SDK feature that hasn't landed on preprod yet.