docs: add readme
This commit is contained in:
parent
72c533ac62
commit
be99d3a1fd
40
README.md
40
README.md
|
@ -1 +1,39 @@
|
|||
# ark-circom
|
||||
# <h1 align="center"> ark-circom </h1>
|
||||
|
||||
Arkworks bindings to Circom's R1CS, for Groth16 Proof and Witness generation in Rust.
|
||||
|
||||
![Github Actions](https://github.com/gakonst/ark-circom/workflows/Tests/badge.svg)
|
||||
|
||||
## Documentation
|
||||
|
||||
Clone the repository and run `cd ark-circom/ && cargo doc --open`
|
||||
|
||||
## Add ark-circom to your repository
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
|
||||
ark-circom = { git = "https://github.com/gakonst/ark-circom-rs" }
|
||||
```
|
||||
|
||||
## Running the tests
|
||||
|
||||
Tests require the following installed:
|
||||
1. [`solc`](https://solidity.readthedocs.io/en/latest/installing-solidity.html). We also recommend using [solc-select](https://github.com/crytic/solc-select) for more flexibility.
|
||||
2. [`ganache-cli`](https://github.com/trufflesuite/ganache-cli#installation)
|
||||
|
||||
## Features
|
||||
|
||||
- [x] Witness generation using Circom's WASM witness code
|
||||
- [x] ZKey parsing into Arkworks Proving Key over BN254
|
||||
- [x] Compatibility layer for Ethereum types, so that proofs can be used in Solidity verifiers
|
||||
- [x] Proof generations and verification using Arkworks
|
||||
- [ ] CLI for common operations
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
This library would not have been possibly without the great work done in:
|
||||
- [`zkutil`](https://github.com/poma/zkutil/)
|
||||
- [`snarkjs`](https://github.com/iden3/snarkjs/)
|
||||
|
||||
Special shoutout to [Kobi Gurkan](https://github.com/kobigurk/) for all the help in parsing SnarkJS' ZKey file format.
|
||||
|
|
67
src/lib.rs
67
src/lib.rs
|
@ -1,71 +1,6 @@
|
|||
//! Arkworks - Circom Compatibility layer
|
||||
//!
|
||||
//! Given a Circom WASM-compiled witness.wasm, it can read it and calculate the corresponding
|
||||
//!
|
||||
//! ## WASM Witness Generator
|
||||
//!
|
||||
//! ## Types
|
||||
//! * ZKey
|
||||
//! * WTNS
|
||||
//! * R1CS
|
||||
//! * WASM
|
||||
//! * Sys?
|
||||
//!
|
||||
//! Inputs:
|
||||
//! * circuit.wasm
|
||||
//! * input.json
|
||||
//!
|
||||
//! Outputs:
|
||||
//! * witness.wtns
|
||||
//!
|
||||
//! Given a circuit WASM and an input.json calculates the corresponding witness
|
||||
//!
|
||||
//! ## Proof calculator
|
||||
//!
|
||||
//! Inputs:
|
||||
//! * witness.wtns / witness.json
|
||||
//! * circuit.zkey
|
||||
//!
|
||||
//! Given a witness (and r1cs?) synthesizes the circom circuit
|
||||
//! And then feeds it to the arkworks groth16 prover
|
||||
//!
|
||||
//! Outputs:
|
||||
//! * public.json
|
||||
//! * proof.json
|
||||
//!
|
||||
//! ## Smart Contract connector class
|
||||
//!
|
||||
//! Given an Arkworks proof, it's able to translate it to the Circom-verifier
|
||||
//! expected arguments
|
||||
//!
|
||||
//! (No Dark Forest specific modifications included, these are part of df-snark)
|
||||
//!
|
||||
//! ## Binary
|
||||
//!
|
||||
//! CLIs for each of the above + logging to stdout
|
||||
//!
|
||||
//! witness for the specified inputs
|
||||
//!
|
||||
//! ## Commands
|
||||
//!
|
||||
//! Compile a circuit:
|
||||
//! `circom circuit.circom --r1cs --wasm --sym`
|
||||
//!
|
||||
//! Phase2 over circuit + PoT
|
||||
//! `snarkjs zkey new circuit.r1cs powersOfTau28_hez_final_10.ptau circuit_0000.zkey`
|
||||
//! `snarkjs zkey contribute circuit_0000.zkey circuit_final.zkey`
|
||||
//! `snarkjs zkey export verificationkey circuit_final.zkey verification_key.json`
|
||||
//!
|
||||
//! Witness calculation from inputs:
|
||||
//! `snarkjs wtns calculate circuit.wasm input.json witness.wtns`
|
||||
//! `snarkjs wtns export json witness.wtns witness.json`
|
||||
//!
|
||||
//! Groth16 proof calculation:
|
||||
//! `snarkjs groth16 prove circuit_final.zkey witness.wtns proof.json public.json`
|
||||
//!
|
||||
//! Groth16 Proof verification:
|
||||
//! `snarkjs groth16 verify verification_key.json public.json proof.json`
|
||||
|
||||
//! Provides bindings to Circom's R1CS, for Groth16 Proof and Witness generation in Rust.
|
||||
mod witness;
|
||||
|
||||
pub mod circom;
|
||||
|
|
Loading…
Reference in New Issue