Wetīn If Blockchain Fit Keep Secret?

Guest author Mr. Haysberg explain how Midnight dey use zero-knowledge proofs to verify transactions without to show private data.

By SongMarketCap

Midnight News - Wetīn If Blockchain Fit Keep Secret?

Imagine say your bank account dey work like this: every payment wey you ever make, every salary wey you collect, every balance, dey open for anybody wey get internet to see.

Your neighbor. Your boss. Even stranger wey fit wan rob you.

Na so most blockchains dey work today.

On November 4, @MidnightNtwrk post one short line wey I feel say capture where this matter dey go: you no need choose between public and private again. One third option dey.

This article go explain that option with simple words. If crypto new to you, you go understand. If you dey build, every section still get deeper layer for you.

The problem: two bad choices

For years, blockchains bin give you two options.

  • Public chains: anybody fit check say everything fair. E good for trust. But your whole financial life go dey open, and e go stay there forever.

  • Private systems: your data dey hide. But you go come need trust the people wey dey run the system, and you go lose the openness wey make blockchain useful from the start.

Choose openness or choose privacy. Na so the deal be.

The third option

Midnight divide the wahala into two.

The network itself remain public. Anybody fit verify am, and im token NIGHT still public too. Your personal data remain for your own device. E no ever enter the chain.

Instead of your data, the chain dey receive one proof: small piece of math wey talk say "the rules follow" without to show wetin dey inside.

The app go decide wetin fit show, and to who. Bank, auditor, partner. Only wetin dem need.

Simple way to picture am: you show bouncer say you don pass 18 without to show your name, your address, or your exact birthday.

For the advanced: this proof na zero knowledge proof. Consensus and NIGHT dey live for the public ledger, while app state fit split into public and private parts, and na only proofs about the private part go touch the chain.

Elegantna autorska kartica za Midnight News

Compact: the language behind am

To build apps like this, developers need way to talk say "this part na public, this part na private." For Midnight, that tool na one programming language wey dem call Compact. I don cover am well for Private by Default Ep. 4.

Wetin matter for everybody:

  • E resemble TypeScript well well, one of the most popular languages for the world, so developers no dey start from zero.

  • You no need be cryptographer. You go mark wetin be private and wetin be public, and the tools go handle the heavy math.

  • E be open source, so anybody fit inspect am.

For the advanced: Compact na strongly and statically typed and bounded, so contracts no fit loop forever. Public releases dey for github.com/midnightntwrk/compact.

How Midnight app dey work: the restaurant

Every Compact contract get three parts. The easiest way to picture am na restaurant.

  • The shop window (ledger). Wetin everybody fit see from street. Public information, wey the chain dey store.

  • The secret recipe (witnesses). Lock inside kitchen. Private information wey remain for your device.

  • The kitchen rules (circuits). The process wey dey turn ingredients into meal. For Midnight, these rules go turn to proofs, so customers fit trust say the meal prepare well without to ever see the recipe.

Midnight own developers sum am up for one line: the logic dey public, the data dey private, and anybody fit verify the result.

Private by default

Na this part I like pass. For Compact, everything dey private unless you choose otherwise.

If developer wan make one information become public, dem must talk am by purpose. If dem forget, the program no go compile and e go point the exact spot wey data for leak.

For the advanced: na disclose() dem take do am. Any value from witness or circuit argument wey dey flow enter public ledger state, return value from exported circuit, or another contract must dey wrap inside disclose(), otherwise the compiler go reject am. Midnight docs dey joke call this one the Witness Protection Program.

Privacy na the seat belt. To go public na conscious choice.

Why privacy na actually security

On November 5, Sebastien Guillemot (@SebastienGllmt), CTO of the Midnight Foundation, publish one blog post with one strong idea: for blockchain, privacy no be luxury. Na security.

Reason wetin fully public chain dey hand give criminal:

  • List of the richest wallets.

  • Full history of anybody wey dem wan target.

  • Clues for phishing messages wey dey look real because dem know wetin you do.

If nobody fit see your balance, nobody fit target you because of am.

How Midnight take hide your money

You fit think: just scramble the balance and e don finish. No be so. If you scramble number 1000 the same way every time, attacker fit scramble common numbers before time and just match dem.

So Midnight do something wey smart pass.

Your money go split into separate notes, like bills inside wallet, instead of one big total. Each note go seal together with im amount, the token type, the owner key, and one big random secret. That seal na note commitment.

To anybody wey dey watch, every seal be like random noise. Note wey worth 1 token and note wey worth 1 million go look the same.

For the advanced: the commitment na hash over value, token type, owner key and large random nonce, so the same face value go produce many unique commitments and precomputation attacks go fail.

[NEWSBREAK]

Spending without to show anything

If everything hide, how network go stop person from to spend the same money two times? Two tools:

  • Proof of ownership. When you dey spend, you go prove say you own valid note without to reveal which note, how much dey inside, or who you be.

  • One time stamp wey dem dey call nullifier. Every note get one. When you spend, the stamp go publish. The network go check say dem never use am before, so the same note no fit spend two times. And nobody fit trace the stamp go back to the original note.

Think am like festival wristband wey dem punch for gate. The guard know say dem don use am. The guard no know who you be.

Viewing keys: useful, but guard dem

Midnight still get viewing keys.

Viewing key go let you see money wey dey come in. E no go show wetin you spend or your total balance. E no fit move your funds.

Still, treat am like password and only share am with apps wey you trust.

The short version

  • Public network wey everybody fit verify.

  • Your data remain with you.

  • The chain dey see seals, proofs and stamps, no be your balance or history.

  • Developers dey decide exactly where the line between public and private go sit, and the tools go stop dem from leak by mistake.

No be public. No be private. One third option.

Guest author · Mr. Haysberg (Vision & Vibe, @visionandvibehq)

Listen: Private by Default Ep. 4, about Compact

Watch on YouTube