Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iden3/go-circom-witnesscalc
Witness Calculator in go, calling WASM
https://github.com/iden3/go-circom-witnesscalc
Last synced: 3 months ago
JSON representation
Witness Calculator in go, calling WASM
- Host: GitHub
- URL: https://github.com/iden3/go-circom-witnesscalc
- Owner: iden3
- License: gpl-3.0
- Created: 2020-04-02T10:51:56.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-03-14T15:58:15.000Z (over 1 year ago)
- Last Synced: 2024-07-16T07:39:35.426Z (4 months ago)
- Language: Go
- Size: 869 KB
- Stars: 8
- Watchers: 7
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-circom - go-circom-witnesscalc - Witness Calculator in go, calling WASM (Provers / Cryptographic primitives in other languages)
README
# go-circom-witnesscalc
[![GoDoc](https://godoc.org/github.com/iden3/go-witnesscalc?status.svg)](https://godoc.org/github.com/iden3/go-witnesscalc)
Witness Calculator in go, calling WASM generated from circom.
## Example
```go
package mainimport (
"encoding/json"
"io/ioutil"wasm3 "github.com/iden3/go-wasm3"
"github.com/stretchr/testify/assert"
)func Test(t *testing.T) {
wasmFilename := "test_files/mycircuit.wasm"
inputsFilename := "test_files/mycircuit-input2.json"runtime := wasm3.NewRuntime(&wasm3.Config{
Environment: wasm3.NewEnvironment(),
StackSize: 64 * 1024,
})
defer runtime.Destroy()wasmBytes, err := ioutil.ReadFile(wasmFilename)
require.Nil(t, err)module, err := runtime.ParseModule(wasmBytes)
require.Nil(t, err)module, err = runtime.LoadModule(module)
require.Nil(t, err)inputsBytes, err := ioutil.ReadFile(inputsFilename)
require.Nil(t, err)inputs, err := ParseInputs(inputsBytes)
require.Nil(t, err)witnessCalculator, err := NewWitnessCalculator(runtime, module)
require.Nil(t, err)w, err := witnessCalculator.CalculateWitness(inputs, false)
require.Nil(t, err)wJSON, err := json.Marshal(WitnessJSON(w))
require.Nil(t, err)
fmt.Print(string(wJSON))
}
```# License
GPLv3