-
Notifications
You must be signed in to change notification settings - Fork 2
/
makefile
46 lines (37 loc) · 1.38 KB
/
makefile
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
BASE=circuits
DIR ?= gradient
WORKDIR=$(BASE)/$(DIR)
# compile
compile $(WORKDIR)/circuit.r1cs $(WORKDIR)/circuit.wasm:$(WORKDIR)/circuit.circom
cd $(WORKDIR) && \
circom circuit.circom --r1cs --wasm --sym --inspect && \
# snarkjs r1cs info circuit.r1cs && \
mv ./circuit_js/circuit.wasm ./circuit.wasm && \
rm -rf ./circuit_js
# plonk setup
setup $(WORKDIR)/circuit_final.zkey:./ptau/pot_final.ptau compile
# snarkjs powersoftau verify pot_final.ptau
snarkjs plonk setup $(WORKDIR)/circuit.r1cs ./ptau/pot_final.ptau $(WORKDIR)/circuit_final.zkey
# export vk
zkev $(WORKDIR)/verification_key.json:setup
cd $(WORKDIR) && \
snarkjs zkev circuit_final.zkey verification_key.json
# plonk full prove
pkf:$(WORKDIR)/input.json setup
cd $(WORKDIR) && \
snarkjs pkf input.json circuit.wasm circuit_final.zkey proof.json public.json
# plonk verify
pkv:zkev pkf
cd $(WORKDIR) && \
snarkjs pkv verification_key.json public.json proof.json
js:
cp snark/test.js $(WORKDIR) && \
cd $(WORKDIR) && \
node test.js
clean:
cd $(WORKDIR) && \
rm -f circuit.r1cs circuit.sym circuit.wasm circuit_final.zkey verification_key.json proof.json public.json
docker-setup:
docker run --rm -it --name delta-zk-setup -v ${PWD}/circuits/main:/app/circuits/main deltampc/delta-zk:dev yarn setup 3
docker-run:
docker run --name delta-zk -v ${PWD}/circuits/main:/app/circuits/main -p 4500:4500 -d deltampc/delta-zk:dev