Zero-Knowledge Proofs

The future of distributed and decentralized technology.

Cryptocurrencies can sound a bit intimidating. Perhaps it is too close too cryptic in my mind which has a negative connotation to most. There is also a general lack of understanding as to what crypto and other decentralized technologies are. Today we are going to walk through a core tenant of those technologies and how modern day computing and cryptography, Zero-Knowledge proofs. I have been lucky enough to spend some time recently with the team over at Algorand, a new blockchain protocol created by Silvio Micali, an MIT professor and a worldwide leader in cryptography and actual co-invented the zero-knowledge proof. I'm going to do my best to do his work justice and also 

Zero-knowledge proofs are a mathematical construct that are at the door of blockchain based systems. The idea is that through a zero-knowledge proof, a receiver of something is able to verify that a sender posses that thing by solving a set of challenges in which the response to that challenge can only be solved if the sender does posses such information or things. That is a bit confusing when explained that way so let's get into an example that shows how this works in practice.

Today, if I wanted to send you $100 I would go to Venmo or my banks mobile app and send you that $100, the both of us are relying on the bank as a trusted third-party to verify that I, the sender, in fact do have that $100 and it can now be transferred to you and then that same process occurs on and on every subsequent time money changes hands. The other benefit here is that I, the sender, don't need to show you my entire bank account balance (that is something personal) but the bank will vouch that I have at least enough funds to cover the $100 giving the receiver peace of mind and the sender privacy. Aside from deposits being loaned out, this is a way in which banks and other intermediaries make money, they charge fees to provide this service.

But what if I wanted to send you that $100 just between us? How would you verify that I actually have the money that I say that I do without asking me to show you my entire bank account balance (which no one would do). This is where Zero-Knowledge Proofs come in.

There is a simple yet famous example that demonstrates how a zero-knowledge proof works in practice called "The Ali Baba Cave". The cave and it's dynamics are outlines in the image below and then we will discuss the dynamics of how it works.

In Ali Baba's cave, that line that you see Peggy approach is a magic gate that can only be opened if you know the secret pass phrase, in our money example, that gate can only be opened if you are able to verify as the send that you have what you claim you have, your own version of a secret passphrase. 

In this example, Peggy is the sender. She enters the cave first and randomly selects a path, A or B. Once she gets to the gate she stops and waits. Victor then enters the entrance to the cave. Having waited outside while Peggy chose her path, Victor has no way of knowing which way Peggy went and cannot see her now so he would have no idea which side of the door she is standing on, see where the name is coming from, Victor has Zero-Knowledge yet he is about to be able to verify if Peggy has what she says she has.

Victor will then randomly pick a path, A or B, and yell it out so that Peggy can hear it. Whichever path Victor picks is the path that Peggy must emerge out of. In he image above, Victor chooses A yet Peggy had originally gone down the B path meaning that only way for her to successfully emerge is to have possessed the knowledge as to what the secret passcode is. In that above example she does and emerges out of path A, but how does Victor know if she was already in path A and therefor got "lucky" versus what actually happened?

This is where cryptography and modern computing come in to play. For Peggy, she is trying to convince Victor that she has something so that Victor can feel safe conducting a transaction with Peggy without that third-party in the middle. In the above example, if we do this test once Peggy has a 50/50 chance of being in the path that Victor chooses regardless of whether or not she chooses the right answer. But if we conduct this test over and over again, say 20 times, the chances of Peggy "happening" to choose the same path that Victor calls out goes down to one in a million meaning that the only way Peggy can successfully continue to come out the right path is she would need to know the secret passphrase to open the gate proving that she does in fact have what Victor is trying to verify. If she doesn't, after a number of times the test is repeated Peggy will fail to come out the right path a certain % of times more than if she knew it.

That is what blockchain technology and cryptography allows us to do in this new generation of distributed systems. This test can be conducted hundreds of times over and over again till you have done the test enough times that you can stay with statistical significance that Peggy does know or own what she claims to own. The beauty in this for Peggy is that says she wanted to send Victor that same $100 that I was going to send you, she can verify for Victor that she has it without having to verify the entire balance of her account. For Victor, he has "zero-knowledge" of the balance of the account that Peggy is using to fund the transaction, but if the secret to unlocking the gate in the cave is Peggy declaring her $100 to the gate then Victor can know that she has at least enough to fund their transaction.

This is a simplified example but this is the basic premise behind the algorithms that enable two parties to transact on blockchain networks such as Algorand, Ethereum, or Solana. Victor is able to verify that Peggy does, in fact, have the $100 that she is trying to send to him and Peggy is able to prove it without revealing the details of her account and its overall balance which is private to her, no third parties required.

As Always, Stay SaaSy Folks and See You Soon ✌️