What If the Blockchain Could Keep a Secret?
Guest author Mr. Haysberg explains how Midnight uses zero-knowledge proofs to verify transactions without revealing private data.
By SongMarketCap
Imagine your bank account worked like this: every payment you ever made, every salary you received, every balance, visible to anyone with an internet connection.
Your neighbor. Your boss. A stranger who wants to rob you.
That is how most blockchains work today.
On November 4, @MidnightNtwrk posted a short line that I think sums up where this is going: you do not have to choose between public and private anymore. There is a third option.
This article explains that option in plain words. If you are new to crypto, you will get it. If you build, there is a deeper layer in every section for you too.
The problem: two bad choices
For years, blockchains gave you two options.
Public chains: anyone can check that everything is fair. Great for trust. But your whole financial life is on display, forever.
Private systems: your data is hidden. But now you have to trust whoever runs the system, and you lose the openness that made blockchain useful in the first place.
Pick openness or pick privacy. That was the deal.
The third option
Midnight splits the problem in two.
The network itself stays public. Anyone can verify it, and its token NIGHT stays public too. Your personal data stays on your own device. It never gets posted to the chain.
Instead of your data, the chain receives a proof: a small piece of math that says "the rules were followed" without showing what was inside.
The app decides what can be revealed, and to whom. A bank, an auditor, a partner. Only what is needed.
A simple way to picture it: showing a bouncer that you are over 18 without showing your name, your address, or your exact birthday.
For the advanced: this proof is a zero knowledge proof. Consensus and NIGHT live on the public ledger, while app state can be split into public and private parts, and only proofs about the private part touch the chain.
Compact: the language behind it
To build apps like this, developers need a way to say "this part is public, this part is private." On Midnight that tool is a programming language called Compact. I covered it in depth in Private by Default Ep. 4.
What matters for everyone:
It looks a lot like TypeScript, one of the most popular languages in the world, so developers do not start from zero.
You do not need to be a cryptographer. You mark what is private and what is public, and the tools handle the heavy math.
It is open source, so anyone can inspect it.
For the advanced: Compact is strongly and statically typed and bounded, so contracts cannot loop forever. Public releases live at github.com/midnightntwrk/compact.
How a Midnight app works: the restaurant
Every Compact contract has three parts. The easiest way to picture them is a restaurant.
The shop window (ledger). What everyone can see from the street. Public information, stored on the chain.
The secret recipe (witnesses). Locked in the kitchen. Private information that stays on your device.
The kitchen rules (circuits). The process that turns ingredients into a meal. On Midnight, these rules become proofs, so customers can trust the meal was made properly without ever seeing the recipe.
Midnight's own developers sum it up in one line: the logic is public, the data is private, and the result can be verified by anyone.
Private by default
Here is the part I like most. In Compact, everything is private unless you choose otherwise.
If a developer wants a piece of information to become public, they have to say so on purpose. If they forget, the program refuses to compile and points to the exact spot where data would leak.
For the advanced: this is done with disclose(). Any value from a witness or circuit argument that flows into public ledger state, a return value from an exported circuit, or another contract must be wrapped in disclose(), or the compiler rejects it. Midnight's docs jokingly call this the Witness Protection Program.
Privacy is the seat belt. Going public is a conscious choice.
Why privacy is actually security
On November 5, Sebastien Guillemot (@SebastienGllmt), CTO of the Midnight Foundation, published a blog post with one strong idea: on a blockchain, privacy is not a luxury. It is security.
Think about what a fully public chain hands to a criminal:
A list of the richest wallets.
The full history of anyone they want to target.
Clues for phishing messages that look real because they know what you did.
If nobody can see your balance, nobody can target you for it.
How Midnight hides your money
You might think: just scramble the balance and you are done. Not quite. If you scramble the number 1000 the same way every time, an attacker can scramble common numbers in advance and simply match them.
So Midnight does something smarter.
Your money is split into separate notes, like bills in a wallet, instead of one big total. Each note is sealed together with its amount, the token type, the owner's key, and a huge random secret. That seal is called a note commitment.
To anyone watching, every seal looks like random noise. A note worth 1 token and a note worth 1 million look the same.
For the advanced: the commitment is a hash over value, token type, owner key and a large random nonce, so the same face value produces many unique commitments and precomputation attacks fail.
[NEWSBREAK]
Spending without showing anything
If everything is hidden, how does the network stop someone from spending the same money twice? Two tools:
A proof of ownership. When you spend, you prove you own a valid note without revealing which note, how much is in it, or who you are.
A one time stamp called a nullifier. Every note has one. When you spend, the stamp is published. The network checks it was never used before, so the same note can never be spent twice. And nobody can trace the stamp back to the original note.
Think of a festival wristband that gets punched at the gate. The guard knows it was used. The guard does not know who you are.
Viewing keys: useful, but guard them
Midnight also has viewing keys.
A viewing key lets you see money coming in. It does not show what you spent or your total balance. It cannot move your funds.
Still, treat it like a password and only share it with apps you trust.
The short version
A public network everyone can verify.
Your data stays with you.
The chain sees seals, proofs and stamps, not your balance or history.
Developers decide exactly where the line between public and private sits, and the tools stop them from leaking by accident.
Not public. Not private. A third option.
Guest author · Mr. Haysberg (Vision & Vibe, @visionandvibehq)
Listen: Private by Default Ep. 4, about Compact