mirror of https://github.com/vacp2p/zerokit.git
RLN: update README (#27)
* refactor(rln): update readme * fix(rln): update README in light of https://github.com/vacp2p/zerokit/pull/30
This commit is contained in:
parent
3378aed857
commit
64f5083639
|
@ -1,15 +1,12 @@
|
|||
# RLN wrapper
|
||||
# Zerokit RLN Module
|
||||
|
||||
`cargo run` should produce a verified proof:
|
||||
This module provides APIs to manage, compute and verify [RLN](https://rfc.vac.dev/spec/32/) zkSNARK proofs and RLN primitives.
|
||||
|
||||
```
|
||||
Proof: Proof { a: GroupAffine { x: Fp256(BigInteger256([8483808811394525823, 2911623124993487936, 965710634470565595, 371243954766865014])), y: Fp256(BigInteger256([705817196479998808, 17904136250720012753, 4190084222192764444, 7218570197435348])), infinity: false }, b: GroupAffine { x: QuadExtField { c0: Fp256(BigInteger256([5458988222411652552, 17182308780189183250, 14791331698105531271, 721079937701984589])), c1: Fp256(BigInteger256([7448529038603485276, 13923597709209930, 3309560575781216904, 880478657337970720])) }, y: QuadExtField { c0: Fp256(BigInteger256([15528177727577722078, 5558129266105870459, 2736358139645020298, 1495034096047214880])), c1: Fp256(BigInteger256([17682510405762186416, 10008291815399475705, 8906017124801037485, 3406569241364819001])) }, infinity: false }, c: GroupAffine { x: Fp256(BigInteger256([15442965511095371475, 16233723700799040245, 2033693936526019359, 1940755394980495809])), y: Fp256(BigInteger256([9607769396956991597, 16531786910336973521, 16312419257791650835, 838503992599180484])), infinity: false } }
|
||||
```
|
||||
Currently, this module comes with three [pre-compiled](https://github.com/vacp2p/zerokit/tree/master/rln/resources) RLN circuits having Merkle tree of height `15`, `19` and `20`, respectively.
|
||||
|
||||
## Example witness data
|
||||
Implemented tests can be executed by running within the module folder
|
||||
|
||||
See:
|
||||
https://github.com/oskarth/zk-kit/commit/b6a872f7160c7c14e10a0ea40acab99cbb23c9a8
|
||||
`cargo test --release`
|
||||
|
||||
## Compiling circuits
|
||||
|
||||
|
@ -26,7 +23,21 @@ cd vendor/rln/ && npm install
|
|||
./scripts/build-circuits.sh rln
|
||||
|
||||
# Copy over assets
|
||||
cp build/rln.r1cs ../../resources
|
||||
cp build/zkeyFiles/rln-final.zkey ../../resources
|
||||
cp build/zkeyFiles/rln.wasm ../../resources
|
||||
cp build/zkeyFiles/rln-final.zkey ../../resources/tree_height_15
|
||||
cp build/zkeyFiles/rln.wasm ../../resources/tree_height_15
|
||||
```
|
||||
|
||||
Note that the above code snippet will compile a RLN circuit with a Merkle tree of height equal `15` based on the default value set in `rln/circuit/rln.circom`.
|
||||
|
||||
To compile a RLN circuit with Merkle tree height `N`, it suffices to change `rln/circuit/rln.circom` to
|
||||
|
||||
```
|
||||
pragma circom 2.0.0;
|
||||
|
||||
include "./rln-base.circom";
|
||||
|
||||
component main {public [x, epoch, rln_identifier ]} = RLN(N);
|
||||
```
|
||||
|
||||
However, if `N` is too big, this might require a bigger Powers of Tau ceremony than the one hardcoded in `./scripts/build-circuits.sh`, which is `2^14`.
|
||||
In such case we refer to the official [Circom documentation](https://docs.circom.io/getting-started/proving-circuits/#powers-of-tau) for instructions on how to run an appropriate Powers of Tau ceremony and Phase 2 in order to compile the desired circuit.
|
Loading…
Reference in New Issue