1
0
Fork 0
mirror of synced 2025-09-23 12:18:44 +00:00
ZoKrates/zokrates_js
2020-01-20 17:23:02 +01:00
..
src into_tuple fix, up version to 1.0.20 2020-01-20 17:23:02 +01:00
tests Add dockerfile for building zokrates_js, modify ci steps 2020-01-14 02:51:29 +01:00
.dockerignore make imports public in core, remove ci steps for zokrates_js 2020-01-06 20:55:54 +01:00
.gitignore add zokrates_js crate 2019-11-21 17:17:00 +01:00
build.sh Add dockerfile for building zokrates_js, modify ci steps 2020-01-14 02:51:29 +01:00
Cargo.lock into_tuple fix, up version to 1.0.20 2020-01-20 17:23:02 +01:00
Cargo.toml into_tuple fix, up version to 1.0.20 2020-01-20 17:23:02 +01:00
Dockerfile Add dockerfile for building zokrates_js, modify ci steps 2020-01-14 02:51:29 +01:00
gulpfile.js move readme to zokrates_book, remove custom serializer on SetupKeypair, remove docker files 2019-11-22 14:53:16 +01:00
index.d.ts Add dockerfile for building zokrates_js, modify ci steps 2020-01-14 02:51:29 +01:00
index.js Add dockerfile for building zokrates_js, modify ci steps 2020-01-14 02:51:29 +01:00
package-lock.json into_tuple fix, up version to 1.0.20 2020-01-20 17:23:02 +01:00
package.json into_tuple fix, up version to 1.0.20 2020-01-20 17:23:02 +01:00
publish.sh Add dockerfile for building zokrates_js, modify ci steps 2020-01-14 02:51:29 +01:00
README.md Add dockerfile for building zokrates_js, modify ci steps 2020-01-14 02:51:29 +01:00
utils.js Add dockerfile for building zokrates_js, modify ci steps 2020-01-14 02:51:29 +01:00

zokrates.js

JavaScript bindings for ZoKrates project.

npm install zokrates-js

API

Function Description
initialize Loads binding wasm module and returns a promise with ZoKrates provider
compile Compiles source code into ZoKrates internal representation of arithmetic circuits
computeWitness Computes a valid assignment of the variables, which include the results of the computation
setup Generates a trusted setup for the compiled program
exportSolidityVerifier Generates a Solidity contract which contains the generated verification key and a public function to verify a solution to the compiled program
generateProof Generates a proof for a computation of the compiled program

Usage

import { initialize } from 'zokrates-js';

function importResolver(location, path) {
  // implement your resolving logic here
  return { 
    source: "def main() -> (): return", 
    location: path 
  };
}

initialize().then((zokratesProvider) => {
    // we have to initialize the wasm module before calling api functions
    zokratesProvider.compile("def main(private field a) -> (field): return a", "main", importResolver)
});