arnaucube
arnaucube/sonobe-docsPublic Self-hosted repository
sonobe-docs/src/usage/frontend-circom.md
src/usage/frontend-circom.mdRaw
 1# Circom frontend
 2 > Experimental frontend using [arkworks/circom-compat](https://github.com/arkworks-rs/circom-compat).
 3 
 4We can define the circuit to be folded in Circom. The only interface that we need to fit in is:
 5
 6```c
 7template FCircuit() {
 8    signal input ivc_input[1];
 9    signal output ivc_output[1];   
10    // [...]
11}
12component main {public [ivc_input]} = Example();
13```
14
15The `ivc_input` is the array that defines the initial state, and the `ivc_output` is the array that defines the output state after the step.
16
17So for example, the following circuit does the traditional example at each step, which proves knowledge of $x$ such that $y==x^3 + x + 5$ for a known $y$:
18
19```c
20pragma circom 2.0.3;
21
22template Example () {
23    signal input ivc_input[1];
24    signal output ivc_output[1];   
25    signal temp;
26    
27    temp <== ivc_input[0] * ivc_input[0];
28    ivc_output[0] <== temp * ivc_input[0] + ivc_input[0] + 5;
29}
30
31component main {public [ivc_input]} = Example();
32```