ASecuritySite.com [here]

Prove Your Know The Answer To A Maths Problem, Without Giving The Answer

And That The Teacher Will Never Have to Compute It

--

Let’s say you are a maths teacher, and give your students a problem, and then ask them to solve it. But you don’t want them to prove you with the answer, but a proof that they have the right answer. In this way, the teacher doesn’t have to compute the answer but knows that it is correct and that the answer will not be leaked.

So, we will use a magical zero-knowledge proof method of zkSnarks, and which allows us to produce a proof of knowledge, and for it then to be verified that we know the answer.

In this case, the equation the teacher will use is:

x²+x+5=11

It is obvious that the answer to this is (x+3)(x-2)=11, and so the possible answers are x=-3 and x=2. So, now the pupil needs to provide a solution of x=2, and produce a proof of knowledge for this.

First, we will create a circuit from this equation (from a file named eq.circom):

pragma circom 2.0.0;
/* x^2 + x + 5 == 11 */
// x=2
function sqr(x) {
return x*x;
}
function mult(a,b) {
return a*b;
}
template Eq() {
signal input x;
signal output y;
var b;

--

--

Prof Bill Buchanan OBE FRSE
ASecuritySite: When Bob Met Alice

Professor of Cryptography. Serial innovator. Believer in fairness, justice & freedom. Based in Edinburgh. Old World Breaker. New World Creator. Building trust.