Added JS style syntaxing to README

This commit is contained in:
Ghilia Weldesselasie 2018-09-14 08:27:36 -04:00 committed by GitHub
parent 3343981187
commit 280cdd7787
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -8,7 +8,7 @@ This library uses the compiled circuits generated by the jaz compiler.
## Install.
```
```sh
npm install zksnark
```
@ -16,13 +16,13 @@ npm install zksnark
### Import.
```
```js
const zkSnark = require("zksnark");
```
### Load a circuit.
```
```js
// "myCircuit.cir" is the output of the jaz compiler
const circuitDef = JSON.parse(fs.readFileSync("myCircuit.cir", "utf8"));
@ -31,7 +31,7 @@ const circuit = new zkSnark.Circuit(circuitDef);
### Inspect the circuit.
```
```js
// `signalId` can always be a number or an alias string
circuit.nConstraints; // number of constraints
@ -77,7 +77,7 @@ const circuit = new zkSnark.Circuit(circuitDef);
### Trusted setup.
```
```js
const setup = zkSnark.setup(circuit);
fs.writeFileSink("myCircuit.vk_proof", JSON.stringify(setup.vk_proof), "utf8");
fs.writeFileSink("myCircuit.vk_verifier", JSON.stringify(setup.vk_verifier), "utf8");
@ -86,7 +86,7 @@ setup.toxic // Must be discarded.
### Generate proof.
```
```js
const circuitDef = JSON.parse(fs.readFileSync("myCircuit.cir", "utf8"));
const circuit = new zkSnark.Circuit(circuitDef);
const input = {
@ -101,7 +101,7 @@ const {proof, publicSignals} = zkSnark.genProof(vk_proof, witness);
### Verifier.
```
```js
const vk_verifier = JSON.parse(fs.readFileSync("myCircuit.vk_verifier", "utf8"));
if (zkSnark.isValid(vk_verifier, proof, publicSignals)) {