arnaucube
arnaucube/sonobe-docsPublic Self-hosted repository
sonobe-docs/src/usage/decider-prove.md
src/usage/decider-prove.mdRaw
 1# Decider prove
 2
 3Two options:
 4
 5- onchain (Ethereum's EVM) mode
 6- offchain mode
 7
 8Once we have been folding our circuit instances, we can generate the *"final proof"*, the Decider proof.
 9
10
11#### Onchain Decider
12
13![](../imgs/decider-onchain-flow-diagram.png)
14
15Generating the final proof (decider), to be able to verify it in Ethereum's EVM:
16
17```rust
18type DECIDER = Decider<
19    Projective,
20    GVar,
21    Projective2,
22    GVar2,
23    CubicFCircuit<Fr>,
24    KZG<'static, Bn254>,
25    Pedersen<Projective2>,
26    Groth16<Bn254>, // here we define the Snark to use in the decider
27    NOVA,           // here we define the FoldingScheme to use
28>;
29
30let mut rng = rand::rngs::OsRng;
31
32// prepare the Decider prover & verifier params for the given nova_params and nova instance. This involves generating the Groth16 and KZG10 setup
33let (decider_pp, decider_vp) = DECIDER::preprocess(&mut rng, &nova_params, nova.clone()).unwrap();
34
35// decider proof generation
36let proof = DECIDER::prove(rng, decider_pp, nova.clone()).unwrap();
37
38```
39
40As in the previous sections, you can find a full examples with all the code at [sonobe/examples](https://github.com/privacy-scaling-explorations/sonobe/tree/main/examples).