This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
main.go
104 lines (100 loc) · 3.27 KB
/
main.go
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package main
import (
"log"
"os"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Name: "setup",
Usage: "Use this tool to generate parameters of Groth16 via MPC",
UsageText: "setup command [arguments...]",
Commands: []*cli.Command{
/* --------------------------- Phase 1 Initialize --------------------------- */
{
Name: "p1n",
Usage: "p1n <power> <outputPath>",
Description: "initialize phase 1 of parameters generation for Groth16",
Action: p1n,
},
/* --------------------------- Phase 1 Contribute --------------------------- */
{
Name: "p1c",
Usage: "p1c <inputPath> <outputPath>",
Description: "contribute phase 1 randomness for Groth16",
Action: p1c,
},
/* ----------------------------- Phase 1 Verify ----------------------------- */
{
Name: "p1v",
Usage: "p1v <inputPath>",
Description: "verify phase 1 contributions for Groth16",
Action: p1v,
},
/* ------------------ Phase 1 Transform from PPoT Ceremony ------------------ */
{
Name: "p1t",
Usage: "p1t <inputPath> <outputPath> <originalPower> <reducedPower>",
Description: "transforms output of PPoT ceremony to be usable by zkBnB-setup",
Action: p1t,
},
/* ------------------ Phase 1 Verify from transformed file ------------------ */
{
Name: "p1vt",
Usage: "p1vt <inputPath> <transformedPath",
Description: "verify phase 1 contributions for Groth16 based on transformed PPoT ceremony file",
Action: p1vt,
},
/* --------------------------- Phase 2 Initialize --------------------------- */
{
Name: "p2n",
Usage: "p2n <phase1Path> <r1csPath> <phase2Path>",
Description: "initialize phase 2 for the given circuit",
Action: p2n,
},
/* ------------------- Phase 2 Initialize from parted R1CS ------------------ */
{
Name: "p2np",
Usage: "p2np <phase1Path> <r1csPath> <outputPhase2> <#constraints> <#R1C> <batchSize>",
Description: "initialize phase 2 for the given circuit parted R1CS",
Action: p2np,
},
/* --------------------------- Phase 2 Contribute --------------------------- */
{
Name: "p2c",
Usage: "p2c <inputPath> <outputPath>",
Description: "contribute phase 2 randomness for Groth16",
Action: p2c,
},
/* ----------------------------- Phase 2 Verify ----------------------------- */
{
Name: "p2v",
Usage: "p2v <inputPath> <originPath>",
Description: "verify phase 2 contributions for Groth16",
Action: p2v,
},
/* ----------------------------- Keys Extraction ---------------------------- */
{
Name: "key",
Usage: "key <inputPath>",
Description: "extract proving and verifying keys",
Action: extract,
},
{
Name: "keys",
Usage: "keys <inputPath> <session>",
Description: "extract proving and verifying keys split",
Action: extracts,
},
{
Name: "sol",
Usage: "sol <session>",
Description: "export verifier smart contract from verifying key",
Action: exportSol,
},
},
}
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}