Problem
The current RLN circuit written in circom generates a zero-knowledege proof proving (among other things) that the pre-image of a hash is a leaf of a merkle tree represented by root r.
In other words. The user pases its secret s, which is hashed hash(s) and then using the merkle proof it proves that hash(s) + merkle proof leads to a given root. A classic proof of inclusion in a merkle tree.
However, having the secret s as an input to the circuit is not ideal. That puts a liability on waku’s side, since that secret has to be taken care of. And well, a user would prefer to not reveal that information, even if the node is self hosted.
Since the user just has to prove that it knows the secret, there are better ways of doing that without revealing the secret itself. A common way is to use signatures.
Same as ethereum transactions. They are signed by the sender and the signature is verified by the node, but the node never learns about the user’s private key (secret).
Proposal
We would like to propose to modify the RLN circuit, so that instead of having the secret as an input, a signature is used. With this approach a waku node nor prover needs to know the secret anymore.
This would also allow native integration with Metamask, removing one of waku’s friction with having to bootstrap a new identity management mechanism. A waku RLN key can be handled just as any other key by Metamask. And used to sign transactions/messages.
On a high level:
- Modify the circuit. Signature instead of secret.
- Verify the signature in circom.
- Benchmark the solution to see the delta.
- Provide an integration example with metamask.
- Use some mechanisim to prevent replay attacks (same signature being reused).
Note that the essence of RLN won’t change. The circuit will be very similar, still written in circom, and the proving system (groth 16) will be kept.