go-snark/wasm/README.md
wasm/README.mdRaw
1# go-snark wasm
2*Warning: this is an ongoing experimentation*
3
4## Wasm usage
5To compile to wasm, inside the `wasm` directory, execute:
6```
7GOARCH=wasm GOOS=js go build -o go-snark.wasm go-snark-wasm-wrapper.go
8```
9
10Add the file `wasm_exec.js` in the directory:
11```
12cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" .
13```
14
15Call the library from javascript:
16```js
17let r = generateProofs(
18 JSON.stringify(circuit),
19 JSON.stringify(setup),
20 JSON.stringify(px),
21 JSON.stringify(inputs),
22);
23```
24
25Run the http server that allows to load the `.wasm` file:
26```
27node server.js
28```