mirror of
https://github.com/arnaucube/go-snark-study.git
synced 2026-02-02 17:26:41 +01:00
update README.md
This commit is contained in:
33
README.md
33
README.md
@@ -6,36 +6,35 @@ zkSNARK library implementation in Go
|
|||||||
- `Succinct Non-Interactive Zero Knowledge for a von Neumann Architecture`, Eli Ben-Sasson, Alessandro Chiesa, Eran Tromer, Madars Virza https://eprint.iacr.org/2013/879.pdf
|
- `Succinct Non-Interactive Zero Knowledge for a von Neumann Architecture`, Eli Ben-Sasson, Alessandro Chiesa, Eran Tromer, Madars Virza https://eprint.iacr.org/2013/879.pdf
|
||||||
- `Pinocchio: Nearly practical verifiable computation`, Bryan Parno, Craig Gentry, Jon Howell, Mariana Raykova https://eprint.iacr.org/2013/279.pdf
|
- `Pinocchio: Nearly practical verifiable computation`, Bryan Parno, Craig Gentry, Jon Howell, Mariana Raykova https://eprint.iacr.org/2013/279.pdf
|
||||||
|
|
||||||
## Caution, Warning
|
## Caution & Warning
|
||||||
Implementation of the zkSNARK [Pinocchio protocol](https://eprint.iacr.org/2013/279.pdf) from scratch in Go to understand the concepts. Do not use in production.
|
Implementation of the zkSNARK [Pinocchio protocol](https://eprint.iacr.org/2013/279.pdf) from scratch in Go to understand the concepts. Do not use in production.
|
||||||
|
|
||||||
Not finished, implementing this in my free time to understand it better, so I don't have much time.
|
Not finished, implementing this in my free time to understand it better, so I don't have much time.
|
||||||
|
|
||||||
Currently allows to do the complete path with [Pinocchio protocol](https://eprint.iacr.org/2013/279.pdf) :
|
Currently allows to do the complete path with [Pinocchio protocol](https://eprint.iacr.org/2013/279.pdf) :
|
||||||
- compile circuuit
|
1. compile circuuit
|
||||||
- parsers
|
2. generate trusted setup
|
||||||
- R1CS
|
3. calculate witness
|
||||||
- QAP
|
4. generate proofs
|
||||||
- generate trusted setup
|
5. verify proofs
|
||||||
- calculate witness
|
|
||||||
- generate proofs
|
|
||||||
- verify proofs
|
|
||||||
- with BN128 pairing
|
|
||||||
|
|
||||||
Current implementation status:
|
Minimal complete flow implementation:
|
||||||
- [x] Finite Fields (1, 2, 6, 12) operations
|
- [x] Finite Fields (1, 2, 6, 12) operations
|
||||||
- [x] G1 and G2 curve operations
|
- [x] G1 and G2 curve operations
|
||||||
- [x] BN128 Pairing
|
- [x] BN128 Pairing
|
||||||
- [x] circuit code compiler
|
- [x] circuit flat code compiler
|
||||||
- [ ] code to flat code (improve circuit compiler)
|
|
||||||
- [x] flat code compiler
|
|
||||||
- [x] circuit to R1CS
|
- [x] circuit to R1CS
|
||||||
- [x] polynomial operations
|
- [x] polynomial operations
|
||||||
- [x] R1CS to QAP
|
- [x] R1CS to QAP
|
||||||
- [x] generate trusted setup
|
- [x] generate trusted setup
|
||||||
- [x] generate proofs
|
- [x] generate proofs
|
||||||
- [x] verify proofs with BN128 pairing
|
- [x] verify proofs with BN128 pairing
|
||||||
- [ ] move witness calculation outside the setup phase
|
|
||||||
|
Improvements from the minimal implementation:
|
||||||
|
- [ ] allow `import` in circuits language
|
||||||
|
- [ ] allow `for` in circuits language
|
||||||
|
- [ ] code to flat code (improve circuit compiler)
|
||||||
|
- [ ] move witness values calculation outside the setup phase
|
||||||
- [ ] Groth16
|
- [ ] Groth16
|
||||||
- [ ] multiple optimizations
|
- [ ] multiple optimizations
|
||||||
|
|
||||||
@@ -48,6 +47,9 @@ Current implementation status:
|
|||||||
- [](https://godoc.org/github.com/arnaucube/go-snark/circuitcompiler) Circuit Compiler
|
- [](https://godoc.org/github.com/arnaucube/go-snark/circuitcompiler) Circuit Compiler
|
||||||
|
|
||||||
### CLI usage
|
### CLI usage
|
||||||
|
*The cli still needs some improvements, such as seting input files, etc.*
|
||||||
|
|
||||||
|
In this example we will follow the equation example from [Vitalik](https://medium.com/@VitalikButerin/quadratic-arithmetic-programs-from-zero-to-hero-f6d558cea649)'s article: `y = x^3 + x + 5`, where `y==35` and `x==3`. So we want to prove that we know a secret `x` such as the result of the equation is `35`.
|
||||||
|
|
||||||
#### Compile circuit
|
#### Compile circuit
|
||||||
Having a circuit file `test.circuit`:
|
Having a circuit file `test.circuit`:
|
||||||
@@ -105,7 +107,6 @@ This will return a `true` if the proofs are verified, or a `false` if the proofs
|
|||||||
|
|
||||||
|
|
||||||
### Library usage
|
### Library usage
|
||||||
Warning: not finished.
|
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
```go
|
```go
|
||||||
|
|||||||
Reference in New Issue
Block a user