You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
566 B

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