How Can Peggy Prove To Victor That She Has Enough Cryptocurrency To Pay Him, Without Revealing Her…

So how can Peggy prove to Victor that she has enough cryptocurrency to pay him, without revealing all her previous transactions? Well, we…

Photo by Sharon McCutcheon on Unsplash

How Can Peggy Prove To Victor That She Has Enough Cryptocurrency To Pay Him, Without Revealing Her Transactions?

So how can Peggy prove to Victor that she has enough cryptocurrency to pay him, without revealing all her previous transactions? Well, we can use a range proof for that, and where we can sum up all Peggy’s incomings and outgoings, and then substract the amount he needs to pay Victor. If the value is positive, she has enough cryptocurrency to pay Victor, if it is negative, the transaction should be declined.

So all we want to prove that a value is positive. For this we will use the Damgard-Fujisaki method defined [here]. First Victor and Peggy agree on two bases for their calculations (g and h) and a prime number (n). Every positive value can be represented in the form:

For example:

51=1²+3²+4²+5²

1451 = 1² +9² +12² +35²

99999 = 1² +2² +313² +45²

Peggy now creates four commitments from these four values, and takes four random numbers (r0, r1, r2 and r3):

And:

r=r0+r1+r2+r3

Victor then checks:

c=cccc4

And this should be equal to:

Here is a demo:

and here is the code:

And that’s it, Peggy can now prove that she has a value which is positive, after she has paid Victor, if she cannot do this, she will have a negative value in her account, and which is not possibly in a crypto space. These days, though, the Bulletproofs are one of the best range proofs around: