diff --git a/README.md b/README.md index 1304eba..ce0d419 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,16 @@ -# go-snark [![Go Report Card](https://goreportcard.com/badge/github.com/arnaucube/go-snark)](https://goreportcard.com/report/github.com/arnaucube/go-snark) [![Build Status](https://travis-ci.org/arnaucube/go-snark.svg?branch=master)](https://travis-ci.org/arnaucube/go-snark) [![Gitter](https://badges.gitter.im/go-snark/community.svg)](https://gitter.im/go-snark/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) +### Warning +Implementation of the zkSNARK [Pinocchio protocol](https://eprint.iacr.org/2013/279.pdf) and [Groth16 protocol](https://eprint.iacr.org/2016/260.pdf) from scratch in Go done in my free time to understand the concepts. Do not use in production. -zkSNARK library implementation in Go +If you want to generate proofs & verify them from Go, you can try https://github.com/vocdoni/go-snark, which is implemented using the [bn256](https://github.com/ethereum/go-ethereum/tree/master/crypto/bn256/cloudflare) for the Pairing curve operations for the Groth16 zkSNARK, and it is compatible with [circom](https://github.com/iden3/circom). +# go-snark-study [![Go Report Card](https://goreportcard.com/badge/github.com/arnaucube/go-snark-study)](https://goreportcard.com/report/github.com/arnaucube/go-snark-study) [![GoDoc](https://godoc.org/github.com/arnaucube/go-snark-study?status.svg)](https://godoc.org/github.com/arnaucube/go-snark-study) + +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 - `Pinocchio: Nearly practical verifiable computation`, Bryan Parno, Craig Gentry, Jon Howell, Mariana Raykova https://eprint.iacr.org/2013/279.pdf - `On the Size of Pairing-based Non-interactive Arguments`, Jens Groth https://eprint.iacr.org/2016/260.pdf -## Caution & Warning -Implementation of the zkSNARK [Pinocchio protocol](https://eprint.iacr.org/2013/279.pdf) and [Groth16 protocol](https://eprint.iacr.org/2016/260.pdf) from scratch in Go done in my free time to understand the concepts. Do not use in production. - -## zkSNARKs in Go -If you need to use zkSNARKs in Go, I would recommend to take a look at [go-circom-prover-verifier](https://github.com/iden3/go-circom-prover-verifier), which I've wrote using the [bn256](https://github.com/ethereum/go-ethereum/tree/master/crypto/bn256/cloudflare) for the Pairing curve operations for the Groth16 zkSNARK, and it is compatible with [circom](https://github.com/iden3/circom). - ## Features Currently allows to do the complete path with [Pinocchio protocol](https://eprint.iacr.org/2013/279.pdf) and [Groth16 protocol](https://eprint.iacr.org/2016/260.pdf) : @@ -36,15 +34,15 @@ Minimal complete flow implementation: - [x] verify proofs with BN128 pairing ## WASM usage -Experimentation with go-snark compiled to wasm: https://github.com/arnaucube/go-snark/tree/master/wasm +Experimentation with go-snark-study compiled to wasm: https://github.com/arnaucube/go-snark-study/tree/master/wasm ## Usage -- [![GoDoc](https://godoc.org/github.com/arnaucube/go-snark?status.svg)](https://godoc.org/github.com/arnaucube/go-snark) zkSnark -- [![GoDoc](https://godoc.org/github.com/arnaucube/go-snark/groth16?status.svg)](https://godoc.org/github.com/arnaucube/go-snark/groth16) zkSnark Groth16 -- [![GoDoc](https://godoc.org/github.com/arnaucube/go-snark/bn128?status.svg)](https://godoc.org/github.com/arnaucube/go-snark/bn128) bn128 (more details: https://github.com/arnaucube/go-snark/tree/master/bn128) -- [![GoDoc](https://godoc.org/github.com/arnaucube/go-snark/fields?status.svg)](https://godoc.org/github.com/arnaucube/go-snark/fields) Finite Fields operations -- [![GoDoc](https://godoc.org/github.com/arnaucube/go-snark/r1csqap?status.svg)](https://godoc.org/github.com/arnaucube/go-snark/r1csqap) R1CS to QAP (more details: https://github.com/arnaucube/go-snark/tree/master/r1csqap) -- [![GoDoc](https://godoc.org/github.com/arnaucube/go-snark/circuitcompiler?status.svg)](https://godoc.org/github.com/arnaucube/go-snark/circuitcompiler) Circuit Compiler +- [![GoDoc](https://godoc.org/github.com/arnaucube/go-snark-study?status.svg)](https://godoc.org/github.com/arnaucube/go-snark-study) zkSnark +- [![GoDoc](https://godoc.org/github.com/arnaucube/go-snark-study/groth16?status.svg)](https://godoc.org/github.com/arnaucube/go-snark-study/groth16) zkSnark Groth16 +- [![GoDoc](https://godoc.org/github.com/arnaucube/go-snark-study/bn128?status.svg)](https://godoc.org/github.com/arnaucube/go-snark-study/bn128) bn128 (more details: https://github.com/arnaucube/go-snark-study/tree/master/bn128) +- [![GoDoc](https://godoc.org/github.com/arnaucube/go-snark-study/fields?status.svg)](https://godoc.org/github.com/arnaucube/go-snark-study/fields) Finite Fields operations +- [![GoDoc](https://godoc.org/github.com/arnaucube/go-snark-study/r1csqap?status.svg)](https://godoc.org/github.com/arnaucube/go-snark-study/r1csqap) R1CS to QAP (more details: https://github.com/arnaucube/go-snark-study/tree/master/r1csqap) +- [![GoDoc](https://godoc.org/github.com/arnaucube/go-snark-study/circuitcompiler?status.svg)](https://godoc.org/github.com/arnaucube/go-snark-study/circuitcompiler) Circuit Compiler ### CLI usage *The cli still needs some improvements, such as seting input files, etc.* @@ -197,7 +195,7 @@ assert.True(t, VerifyProof(*circuit, setup, proof, publicSignalsVerif, true)) ``` ##### Verify Proof generated from [snarkjs](https://github.com/iden3/snarkjs) -Is possible with `go-snark` to verify proofs generated by `snarkjs` +Is possible with `go-snark-study` to verify proofs generated by `snarkjs` Example: ```go @@ -219,7 +217,7 @@ go test ./... -v ``` ## vim/nvim circuit syntax highlighter -For more details and installation instructions see https://github.com/arnaucube/go-snark/tree/master/vim-syntax +For more details and installation instructions see https://github.com/arnaucube/go-snark-study/tree/master/vim-syntax --- diff --git a/bn128/README.md b/bn128/README.md index 174fa83..8b1cc6b 100644 --- a/bn128/README.md +++ b/bn128/README.md @@ -1,5 +1,5 @@ ## Bn128 -[![GoDoc](https://godoc.org/github.com/arnaucube/go-snark/bn128?status.svg)](https://godoc.org/github.com/arnaucube/go-snark/bn128) bn128 +[![GoDoc](https://godoc.org/github.com/arnaucube/go-snark-study/bn128?status.svg)](https://godoc.org/github.com/arnaucube/go-snark-study/bn128) bn128 Implementation of the bn128 pairing in Go. diff --git a/bn128/bn128.go b/bn128/bn128.go index ebef4ee..cb29050 100644 --- a/bn128/bn128.go +++ b/bn128/bn128.go @@ -4,7 +4,7 @@ import ( "errors" "math/big" - "github.com/arnaucube/go-snark/fields" + "github.com/arnaucube/go-snark-study/fields" ) // Bn128 is the data structure of the BN128 diff --git a/bn128/g1.go b/bn128/g1.go index 0f5b9e0..99c4b4e 100644 --- a/bn128/g1.go +++ b/bn128/g1.go @@ -3,7 +3,7 @@ package bn128 import ( "math/big" - "github.com/arnaucube/go-snark/fields" + "github.com/arnaucube/go-snark-study/fields" ) type G1 struct { diff --git a/bn128/g2.go b/bn128/g2.go index 0c05a3a..2c266ed 100644 --- a/bn128/g2.go +++ b/bn128/g2.go @@ -3,7 +3,7 @@ package bn128 import ( "math/big" - "github.com/arnaucube/go-snark/fields" + "github.com/arnaucube/go-snark-study/fields" ) type G2 struct { diff --git a/circuitcompiler/circuit.go b/circuitcompiler/circuit.go index 7f4b0af..737533e 100644 --- a/circuitcompiler/circuit.go +++ b/circuitcompiler/circuit.go @@ -5,7 +5,7 @@ import ( "math/big" "strconv" - "github.com/arnaucube/go-snark/r1csqap" + "github.com/arnaucube/go-snark-study/r1csqap" ) // Circuit is the data structure of the compiled circuit diff --git a/cli/main.go b/cli/main.go index e589b77..6882143 100644 --- a/cli/main.go +++ b/cli/main.go @@ -11,11 +11,11 @@ import ( "math/big" "os" - snark "github.com/arnaucube/go-snark" - "github.com/arnaucube/go-snark/circuitcompiler" - "github.com/arnaucube/go-snark/groth16" - "github.com/arnaucube/go-snark/r1csqap" - "github.com/arnaucube/go-snark/utils" + snark "github.com/arnaucube/go-snark-study" + "github.com/arnaucube/go-snark-study/circuitcompiler" + "github.com/arnaucube/go-snark-study/groth16" + "github.com/arnaucube/go-snark-study/r1csqap" + "github.com/arnaucube/go-snark-study/utils" "github.com/urfave/cli" ) diff --git a/externalVerif/README.md b/externalVerif/README.md index a75fdc5..91178a7 100644 --- a/externalVerif/README.md +++ b/externalVerif/README.md @@ -1,8 +1,8 @@ -# go-snark /externalVerif +# go-snark-study /externalVerif Utilities to verify zkSNARK proofs generated by other tools. ## Verify Proof generated from [snarkjs](https://github.com/iden3/snarkjs) -Is possible with `go-snark` to verify proofs generated by `snarkjs` +Is possible with `go-snark-study` to verify proofs generated by `snarkjs` Example: ```go diff --git a/externalVerif/circomVerifier.go b/externalVerif/circomVerifier.go index 5e835eb..e9bebd3 100644 --- a/externalVerif/circomVerifier.go +++ b/externalVerif/circomVerifier.go @@ -5,8 +5,8 @@ import ( "fmt" "io/ioutil" - "github.com/arnaucube/go-snark/groth16" - "github.com/arnaucube/go-snark/utils" + "github.com/arnaucube/go-snark-study/groth16" + "github.com/arnaucube/go-snark-study/utils" ) type CircomProof struct { diff --git a/go.mod b/go.mod index 4127df9..d715d05 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/arnaucube/go-snark +module github.com/arnaucube/go-snark-study require ( github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/groth16/groth16.go b/groth16/groth16.go index e095b7b..def54de 100644 --- a/groth16/groth16.go +++ b/groth16/groth16.go @@ -6,10 +6,10 @@ import ( "fmt" "math/big" - "github.com/arnaucube/go-snark/bn128" - "github.com/arnaucube/go-snark/circuitcompiler" - "github.com/arnaucube/go-snark/fields" - "github.com/arnaucube/go-snark/r1csqap" + "github.com/arnaucube/go-snark-study/bn128" + "github.com/arnaucube/go-snark-study/circuitcompiler" + "github.com/arnaucube/go-snark-study/fields" + "github.com/arnaucube/go-snark-study/r1csqap" ) type Pk struct { // Proving Key diff --git a/groth16/groth16_test.go b/groth16/groth16_test.go index cb9562c..13f2223 100644 --- a/groth16/groth16_test.go +++ b/groth16/groth16_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "github.com/arnaucube/go-snark/circuitcompiler" - "github.com/arnaucube/go-snark/r1csqap" + "github.com/arnaucube/go-snark-study/circuitcompiler" + "github.com/arnaucube/go-snark-study/r1csqap" "github.com/stretchr/testify/assert" ) diff --git a/r1csqap/README.md b/r1csqap/README.md index 21c6054..1bf449a 100644 --- a/r1csqap/README.md +++ b/r1csqap/README.md @@ -1,5 +1,5 @@ ## R1CS to Quadratic Arithmetic Program -[![GoDoc](https://godoc.org/github.com/arnaucube/go-snark/r1csqap?status.svg)](https://godoc.org/github.com/arnaucube/go-snark/r1csqap) R1CS to QAP +[![GoDoc](https://godoc.org/github.com/arnaucube/go-snark-study/r1csqap?status.svg)](https://godoc.org/github.com/arnaucube/go-snark-study/r1csqap) R1CS to QAP - `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 - Vitalik Buterin blog post about QAP https://medium.com/@VitalikButerin/quadratic-arithmetic-programs-from-zero-to-hero-f6d558cea649 - Ariel Gabizon in Zcash blog https://z.cash/blog/snark-explain5 diff --git a/r1csqap/r1csqap.go b/r1csqap/r1csqap.go index 7429b74..401b3d5 100644 --- a/r1csqap/r1csqap.go +++ b/r1csqap/r1csqap.go @@ -4,7 +4,7 @@ import ( "bytes" "math/big" - "github.com/arnaucube/go-snark/fields" + "github.com/arnaucube/go-snark-study/fields" ) // Transpose transposes the *big.Int matrix diff --git a/r1csqap/r1csqap_test.go b/r1csqap/r1csqap_test.go index 54dba62..a64a366 100644 --- a/r1csqap/r1csqap_test.go +++ b/r1csqap/r1csqap_test.go @@ -5,7 +5,7 @@ import ( "math/big" "testing" - "github.com/arnaucube/go-snark/fields" + "github.com/arnaucube/go-snark-study/fields" "github.com/stretchr/testify/assert" ) diff --git a/snark.go b/snark.go index 2c4fe61..7abc951 100644 --- a/snark.go +++ b/snark.go @@ -7,10 +7,10 @@ import ( "math/big" "os" - "github.com/arnaucube/go-snark/bn128" - "github.com/arnaucube/go-snark/circuitcompiler" - "github.com/arnaucube/go-snark/fields" - "github.com/arnaucube/go-snark/r1csqap" + "github.com/arnaucube/go-snark-study/bn128" + "github.com/arnaucube/go-snark-study/circuitcompiler" + "github.com/arnaucube/go-snark-study/fields" + "github.com/arnaucube/go-snark-study/r1csqap" ) type Pk struct { // Proving Key pk:=(pkA, pkB, pkC, pkH) diff --git a/snark_test.go b/snark_test.go index 638b813..cc2fbd0 100644 --- a/snark_test.go +++ b/snark_test.go @@ -8,9 +8,9 @@ import ( "testing" "time" - "github.com/arnaucube/go-snark/circuitcompiler" - "github.com/arnaucube/go-snark/groth16" - "github.com/arnaucube/go-snark/r1csqap" + "github.com/arnaucube/go-snark-study/circuitcompiler" + "github.com/arnaucube/go-snark-study/groth16" + "github.com/arnaucube/go-snark-study/r1csqap" "github.com/stretchr/testify/assert" ) diff --git a/utils/base10parsers.go b/utils/base10parsers.go index 06464c4..e51a9fd 100644 --- a/utils/base10parsers.go +++ b/utils/base10parsers.go @@ -4,9 +4,9 @@ import ( "errors" "math/big" - snark "github.com/arnaucube/go-snark" - "github.com/arnaucube/go-snark/circuitcompiler" - "github.com/arnaucube/go-snark/groth16" + snark "github.com/arnaucube/go-snark-study" + "github.com/arnaucube/go-snark-study/circuitcompiler" + "github.com/arnaucube/go-snark-study/groth16" ) // []*big.Int diff --git a/utils/hexparsers.go b/utils/hexparsers.go index 848e273..f6c9147 100644 --- a/utils/hexparsers.go +++ b/utils/hexparsers.go @@ -5,9 +5,9 @@ import ( "fmt" "math/big" - snark "github.com/arnaucube/go-snark" - "github.com/arnaucube/go-snark/circuitcompiler" - "github.com/arnaucube/go-snark/groth16" + snark "github.com/arnaucube/go-snark-study" + "github.com/arnaucube/go-snark-study/circuitcompiler" + "github.com/arnaucube/go-snark-study/groth16" ) // []*big.Int diff --git a/vim-syntax/README.md b/vim-syntax/README.md index 663c6d0..6948291 100644 --- a/vim-syntax/README.md +++ b/vim-syntax/README.md @@ -3,8 +3,8 @@ ## Installation in vim/nvim using plug Using [Plug](https://github.com/junegunn/vim-plug), add this lines into the `.vimrc`/`init.vim`: ``` -Plug 'arnaucube/go-snark' -Plug 'arnaucube/go-snark', {'rtp': 'vim-syntax'} +Plug 'arnaucube/go-snark-study' +Plug 'arnaucube/go-snark-study', {'rtp': 'vim-syntax'} ``` -![screenshot-vim](https://raw.githubusercontent.com/arnaucube/go-snark/master/vim-syntax/screenshot.png "screenshot-vim") +![screenshot-vim](https://raw.githubusercontent.com/arnaucube/go-snark-study/master/vim-syntax/screenshot.png "screenshot-vim") diff --git a/wasm/README.md b/wasm/README.md index a46fb91..dceaa26 100644 --- a/wasm/README.md +++ b/wasm/README.md @@ -1,4 +1,4 @@ -# go-snark wasm +# go-snark-study wasm *Warning: this is an ongoing experimentation* WASM wrappers for zkSNARK Pinocchio & Groth16 protocols. diff --git a/wasm/go-snark-wasm-wrapper.go b/wasm/go-snark-wasm-wrapper.go index 3b3a76a..11420ed 100644 --- a/wasm/go-snark-wasm-wrapper.go +++ b/wasm/go-snark-wasm-wrapper.go @@ -5,10 +5,10 @@ import ( "math/big" "syscall/js" - "github.com/arnaucube/go-snark" - "github.com/arnaucube/go-snark/circuitcompiler" - "github.com/arnaucube/go-snark/groth16" - "github.com/arnaucube/go-snark/utils" + "github.com/arnaucube/go-snark-study" + "github.com/arnaucube/go-snark-study/circuitcompiler" + "github.com/arnaucube/go-snark-study/groth16" + "github.com/arnaucube/go-snark-study/utils" ) func main() {