https://github.com/distributed-lab/rarimo-issuer-risc0
Nullifier Counter in RISC Zero for apps on top of Rarimo Protocol.
https://github.com/distributed-lab/rarimo-issuer-risc0
nullifier rarimo risc-v risc0 rust zkp
Last synced: 5 months ago
JSON representation
Nullifier Counter in RISC Zero for apps on top of Rarimo Protocol.
- Host: GitHub
- URL: https://github.com/distributed-lab/rarimo-issuer-risc0
- Owner: distributed-lab
- License: apache-2.0
- Created: 2024-07-17T15:32:03.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-08-02T12:06:12.000Z (10 months ago)
- Last Synced: 2024-11-13T18:09:55.193Z (7 months ago)
- Topics: nullifier, rarimo, risc-v, risc0, rust, zkp
- Language: Rust
- Homepage:
- Size: 164 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Nullifier Counter in RISC Zero for apps on top of Rarimo Protocol
[](https://opensource.org/licenses/MIT)
This repository is a module for Identity Provider in [FreedomTool by Rarimo](https://freedomtool.org/).
Particularly, it contains necessary functionality to construct ZKP for counting duplicates of nullifiers
for some document (passport) hash.Reference implementation is [nullifiersCounter](https://github.com/rarimo/passport-zk-circuits/tree/main/nullifiersCounter) in Circom.
## TL;DR in Risc0
`Risc0` is a technology allowing to construct ZKP logic in arbitrary language, which can get compiled down to
`RISC-V` architecture. Currently, flagship support is for `Rust`.### Guest
In a `methods/guest` directory is located rust code, whose trace of execution is constructing ZKP.
It is compiled to `RISC-V ELF` binary, which is then getting run by zkVM.### Host
The entity, responsible for running zkVM and handling I/O with guest, is known as `host`.
In this repository is present necessary functionality for running the host locally, meaning private inputs
won't leave machine (versa using remote proving server known as `Bonsai`).### Core
`core` directory is a convention in Risc0 projects for placing the models shared between host and guest.
## Data flow and Testing
In order to test everything, [SageMath](https://www.sagemath.org/) script is present in `host/sage` directory. It allows to randomly generate input for `guest` program to run on. In a `host/test_values` directory
you can find generated inputs and expected _journal_ - public information in Risc0 ZKP.The host program expects CLI argument for filepath to `JSON` input. It is then read and passed to `guest`
for ZKP generation.## Quick Launch
After cloning this repository and making sure you've got installed rust and risc0, run:
```bash
make run-prove
```## Development mode and Execution Statistics
During development, faster iteration upon code changes can be achieved by leveraging [dev-mode], we strongly suggest activating it during your early development phase. Furthermore, you might want to get insights into the execution statistics of your project, and this can be achieved by specifying the environment variable `RUST_LOG="[executor]=info"` before running your project.
Put together, the command to run your project in development mode while getting execution statistics is:
```bash
RUST_LOG="[executor]=info" RISC0_DEV_MODE=1 cargo run --
```## Cryptography Acceleration
The main cryptographical primitive in this ZK scheme is a hashing function.
Even though examples like `Pedersen` or `Poseidon` are known to be ZK-friendly, Risc0 has extensive support
for `SHA256`. It is hardware accellerated and utilized in this project unlike circom implementation.## Benchmarks
Project has been tested for computational efficiency with a variety of inputs.
You can examine results in [Benchmark.md](./BENCHMARK.md)