Add introduction & usage subsections and polish

- update README.md (landing)
- add introduction/folding-and-sonobe.md subsection
- add usage/decider-verify subsection
This commit is contained in:
arnaucube
2024-04-10 10:38:14 +02:00
parent 9798336865
commit e1924215d6
8 changed files with 80 additions and 34 deletions

View File

@@ -38,19 +38,12 @@ let circuit = DeciderEthCircuit::<
>::from_nova::<CubicFCircuit<Fr>>(nova.clone());
let mut rng = rand::rngs::OsRng;
let start = Instant::now();
let (pk, vk) =
Groth16::<Bn254>::circuit_specific_setup(circuit.clone(), &mut rng).unwrap();
println!("Groth16 setup, {:?}", start.elapsed());
// decider proof generation
let decider_pp = (poseidon_config.clone(), g16_pk, kzg_pk);
let proof = DECIDER::prove(decider_pp, rng, nova.clone()).unwrap();
// decider proof verification
let decider_vp = (poseidon_config, g16_vk, kzg_vk);
let verified = DECIDER::verify(decider_vp, nova.i, nova.z_0, nova.z_i, &nova.U_i, &nova.u_i, proof).unwrap();
assert!(verified);
```
As mentioned above, complete examples can be found at [sonobe/folding-schemes/examples](https://github.com/privacy-scaling-explorations/sonobe/tree/main/folding-schemes/examples)

View File

@@ -0,0 +1,26 @@
# Decider verify
We can now verify the Decider proof
```rust
// this is the same that we defined for the prover
type DECIDER = Decider<
Projective,
GVar,
Projective2,
GVar2,
CubicFCircuit<Fr>,
KZG<'static, Bn254>,
Pedersen<Projective2>,
Groth16<Bn254>,
NOVA,
>;
let decider_vp = (g16_vk, kzg_vk);
let verified = DECIDER::verify(
decider_vp, nova.i, nova.z_0, nova.z_i, &nova.U_i, &nova.u_i, proof,
)
.unwrap();
assert!(verified);
```
In the Ethereum Decider case, we can generate a Solidity smart contract that verifies the proofs onchain. More details in the [next section](solidity-verifier.md).

View File

@@ -1,20 +1,6 @@
# Usage
## Folding schemes overview
(wip)
<!-- [introductory text here (TODO)] -->
<img src="../imgs/folding-main-idea-diagram.png" style="width:70%;" />
[...] [this presentation](https://youtu.be/IzLTpKWt-yg?t=6367), where [Carlos Pérez](https://twitter.com/CPerezz19) overviews the features of folding schemes and what can be build with them.
## Sonobe overview
<!-- TODO explain the idea of sonobe, being a modular library to use different folding schemes -->
Suppose that the user inputs a circuit that follows the IVC structure, chooses which Folding Scheme to use (eg. Nova), and which Decider (eg. Spartan over Pasta curve).
Later the user can for example change with few code changes the Folding Scheme being used (eg. switch to ProtoGalaxy) and also the Decider (eg. Groth16 over bn254), so the final proof can be verified in an Ethereum smart contract.
![](../imgs/sonobe-lib-pipeline.png)
Complete examples can be found at [sonobe/folding-schemes/examples](https://github.com/privacy-scaling-explorations/sonobe/tree/main/folding-schemes/examples)
This section showcases how to use the Sonobe library to:
- Define a circuit to be folded using the Frontend
- Fold the circuit using one of the folding schemes
- Generate a final Decider proof
- Verify the Decider proof, and in Ethereum case, generate a Solidity verifier

View File

@@ -1,6 +1,6 @@
# Solidity verifier
Having used the `DeciderEth` (see [Onchain Decider](#Onchain-Decider) section), we can now verify it in Ethereum's EVM.
Having used the `Decider` from `decider_eth.rs`, we can now verify it in Ethereum's EVM.
First we need to generate the Solidity contracts that verify the Decider proofs. Use the [solidity-verifiers-cli](cli) tool
```