forked from axiom-crypto/halo2-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circuit.ts
32 lines (29 loc) · 809 Bytes
/
circuit.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//@ts-ignore -- to avoid halo2-lib-js being a dependency of the cli
import {add, sub, mul, constant, witness, log, rangeCheck, makePublic, isLessThan} from "@axiom-crypto/halo2-lib-js";
export const circuit = async (inputs: {x: number}) => {
const x = witness(inputs.x);
const a = witness(1);
const b = witness(2);
const c = witness(3);
const d = add(a, b);
const e = sub(c, b);
const f = mul(d, e);
const g = add(f, x);
log(g);
rangeCheck(witness(50), 8)
rangeCheck(witness(50), 8)
isLessThan(constant(1), constant(9), "4")
makePublic(g);
makePublic(constant(1));
}
export const config = {
k: 10,
numAdvice: 4,
numLookupAdvice: 1,
numInstance: 1,
numLookupBits: 9,
numVirtualInstance: 1,
}
export const inputs = {
x: 9,
}