Before starting to discuss any topic, it is important to understand why you need to study it or what problem it solves and whether there is another alternative.In this article we will explore the real need for ZKP, its use in the blockchain and how can we develop mechanisms based on ZKP for our own needs.
Issue
If you are like me a person passionate about mathematics and cyber security you would certainly have the spirit to always solve problems in the most efficient and least expensive way, so before going further we will put ourselves in the context of the blockchain of course the ZKP has many uses and other usefulness outside the blockchain but we will focus on its applications at the blockchain level.
The Blockchain
But first of all, what is a blockchain? Is it a protocol? A programming language? A crypto-currency?
I will write after a detailed article to discuss more about the blockchain and how we can start our adventure in the blockchain and the development of decentralized applications but to get a general idea the blockchain is a database.
A database? So what’s the difference between the blockchain and a classic MySQL, PostgreSQL database, just a buzzword, isn’t it?
Short Answer NO. The blockchain is in fact a database that will store data, transactions, etc. like a classical database but in a decentralized way.
Decentralized? What does that mean?
Decentralized means that everyone will have the same database but in a decentralized way in all the nodes of the network and therefore there will be no power relationship between the developers and the network participants or a central entity that will control the data or the transactions.
So how will this database be synchronized at all nodes and how can we validate these transactions?
This is another subject, but we will use consensus that will help to validate these transactions, such as the Proof of Work or the Proof of Stack.
Now back to our subject, a decentralized database good I understood that, but what is the relationship between that and the ZKP ?
In one word It’s privacy.
One of the characteristics of a public blockchain is transparency and therefore all transactions are visible and accessible to all network participants.
For example, if I initiate a transaction or make a function call to a Smart Contract, everyone can consult it and even have the parameters that I have injected, of course this will cause several problems in terms of security but also in terms of the functionality of our program, for example, giving the example of the game ShiffuMe (Rock – Paper – Scissors) and we want to develop it in a decentralized way, The problem here is that the other player will be able to know what choice I made and therefore easily will be able to win in every match, of course there are solutions for this kind of problem like the Commit-Reveal Scheme that I will discuss more in another article.
Now let’s imagine that a dAPP application that is going to contain your sensitive, critical information stored in a decentralized database that everyone can access, scary is it?
This is the problem we want to solve, we want to keep the principle of transparency in blockchain but also protect the identity, keep the anonymity of our users.
Even Bitcoin does not offer this possibility – you can easily view all transactions without any problems and even see the history of transactions made through a specific public address.
You can view these transactions just from the BlockchainExplorer website [1] and choose the Bitcoin Explorer or which network you want exactly.
The Solution
Here comes the concept of the Zero Knowledge Proof, we can imagine that two people want to make a duel for example.
The duel is as follows: Whoever has the largest amount of money in their bank account wins, but the problem here is that these two people do not want to reveal their balance in their bank accounts and therefore it is necessary to have a protocol or an algorithm that will of course take care of calculating the max of the two balance and at the same time keep the confidentiality of the two calculated entries, this concept is very well known by the MPSC or the Multi Party Secure Computation is the fact of making calculations or executing functions while keeping the confidentiality of the entries.
Of course there are functions and operations where this concept can be applied and others not!
The ZKP is a branch of the MPSC that will allow us to prove something to another entity but without revealing it, from here comes the name of Zero Knowledge it means without knowledge.
For the concept of the ZKP it’s very simple to understand.
I will first give you an idea about the architecture or the operations in general and then I will illustrate it with some examples.
There is always a part called the Prover and the second part called the Verifier, the first one is the Prover who wants to prove or demonstrate a proposition that can be either false or true, for example my balance is bigger than yours, or for example I have the password to authenticate myself, etc. ….
The Verifier is the one who has to verify this proposal through certain mechanisms or protocols.
Of course, this whole process exists to guarantee the confidentiality between the two parties and also apply the principle known as Trust No One.
In general, the ZKP scheme is divided into 3 steps
Let’s put in the scenario that person A is the Prover and person B is the Verifier.
The First Person A will ask the person B for his proposal, for example I have two apples of different colors (This proposal may be true or false, The Prover who must validate this proposal).
Then the Person B will generate a question and send it to the Prover.
And finally the person must solve the challenge or answer the Verifier’s question to prove his proposal.
Understand More
To understand more I will give you the most known example in the ZKP it’s the problem of the color blind person.
Let’s imagine the scenario that a color-blind person wants to know exactly if two apples have different colors, these apples are the same, same size, same weight, same shape, so how can he do it?
The ZKP concept will be applied here in 3 phases, the first thing is the proposal: “These apples are two different colors.” Now we have to prove this proposition, indeed the Verifier (who is color blind here) will try to create a challenge for example he will take the two apples and hide them and then he has the choice to either change their positions or not and he will ask the Prover to tell him whether he changed the apple positions or not.
The last step is that the Prover will try to solve the challenge, remember here that the Prover can lie or tell the truth if for example the apples are the same color the Prover will have a difficulty to know if the apples have changed color or not and therefore it will have a probability of ½ to be correct but in the case of apples if they are different colors and the Prover tells the truth the probability will be 1.
Of course in these ZKP protocols we will repeat this process several times to reduce the chance in the first iteration the probability was ½ then it would be ¼, 1/8, … And this probability will converge to 0.
There are other very interesting examples, I suggest you also consult this paper ‘How to Explain Zero-Knowledge Proof to Your children’ [2].
Properties of the ZKP
- Consistency (completeness): if the Prover and Verifier follow the protocol then the verifier must always accept the Proof.
- Soundness: if the proposition is false, no malicious Prover can convince an “honest” Verifier that the proposition is true and this with a high probability.
- No information (zero knowledge): The Verifier learns from the Prover nothing more than the truthfulness of the proposal, he gets no information he did not already know without the Prover’s input.
Properties of the ZKP
First of all, will the blockchain ensure our privacy?
No and No and again No! Many people say that the blockchain will secure your data or encrypt your data or other concepts that are wrong even bitcoin and many known platforms store transactions in clear text and so the direct solution to this problem is the integration of ZKP at the blockchain level.
By using ZKP solutions it is possible to introduce the notion of privacy to other use cases that also seem very interesting in terms of authentication, or even to keep the anonymity or identity of the people who carry out transactions.
The relationship between ZKP and the blockchain
First of all, will the blockchain ensure our privacy?
No and No and again No! Many people say that the blockchain will secure your data or encrypt your data or other concepts that are wrong even bitcoin and many known platforms store transactions in clear text and so the direct solution to this problem is the integration of ZKP at the blockchain level.
By using ZKP solutions it is possible to introduce the notion of privacy to other use cases that also seem very interesting in terms of authentication, or even to keep the anonymity or identity of the people who carry out transactions.
Want to know more?
There are other mechanisms such as the non-interactive ZKP to understand more you can read the article Interactive and Noninteractive Zero Knowledge Are Equivalent in the Help Model [3] another very interesting article Security and privacy using one-round zero-knowledge proofs [4] but also there are other concepts that will solve some complex problems such as Commit, Multi Signatures …
* If you have any remarks or other ideas to add do not hesitate to put a comment and share the post with the community, you can also contact me by mail: souhail.mssassi@owasp.org
References
[1] URL : https://www.blockchain.com/explorer
[2] Quisquater JJ. et al. (1990) How to Explain Zero-Knowledge Protocols to Your Children. In: Brassard G. (eds) Advances in Cryptology — CRYPTO’ 89 Proceedings. CRYPTO 1989. Lecture Notes in Computer Science, vol 435. Springer, New York, NY. https://doi.org/10.1007/0-387-34805-0_60
[3] Chailloux A., Ciocan D.F., Kerenidis I., Vadhan S. (2008) Interactive and Noninteractive Zero Knowledge are Equivalent in the Help Model. In: Canetti R. (eds) Theory of Cryptography. TCC 2008. Lecture Notes in Computer Science, vol 4948. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-78524-8_28
[4] S. Almuhammadi and C. Neuman, “Security and privacy using one-round zero-knowledge proofs,” Seventh IEEE International Conference on E-Commerce Technology (CEC’05), Munich, Germany, 2005, pp. 435-438, doi: 10.1109/ICECT.2005.78.