But if G is constant and known (it is), couldn't someone just pre-calculate n.G
for all reasonable values of n and scan the blockchain for those public keys?
Basically, YES!, so we're not done yet.
We need to add randomness to each in/output to prevent a pre-image attack. The basic idea is to do this by adding a second private key to each output.
Input were given their private keys when they were outputs in a previous transaction.
So what if we rewrite the inputs and outputs as follows:
where H is a generator on another (specially selected) EC.
This completely blinds the in- and outputs so that no pre-image attack is possible.
(And is called a Pedersen commitment).
Alice now builds a transaction like this:
Since in an honest transaction*
this becomes
*
We'll examine the case where someone is cheating and E=0 shortly.
and so we require
Alice sends Bob this transaction information (T1) and lets Bob know that his private
key must be k1. To prevent Alice from spending Bob's newly earned Tari, he
can choose a new blinding factor r1 and rewrites the transaction as
Notice that the RHS is r1.H+E where E is the sum of the transaction values.
The RHS is a valid key on H if and only if E=0*`, i.e. Alice has constructed
the transaction without cheating.
More generally, k1 is the sum of all the blinding factors.
*
This is a consequence of how the curves H and G were selected initially.
Bob signs an empty string with r1 which proves that he knows r1.This
signature is submitted for inclusion to the blockchain along with the transaction details.
A validator / node then only has to check that
There's still a flaw in this procedure though.
Alice could have spent a 1 Tari output, giving 2 to Bob, and -1 in change to herself,
thus creating 1 Tari out of thin air.
To prevent, this, Alice needs to provide a set of range proofs for each amount
she receives, proving that the (masked) values lie between 0 and 264 (exclusive).
Similarly, Bob provides range proofs for the value he is receiving.
The details of these proofs are beyond the scope of this presentation. But some comments:
A MimbleWimble transaction includes the following: