Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
naure committed May 10, 2019
0 parents commit 5709c00
Show file tree
Hide file tree
Showing 16 changed files with 5,923 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/target
**/*.rs.bk
Cargo.lock
bin/
pkg/
target/
wasm-pack.log
25 changes: 25 additions & 0 deletions LICENSE_MIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Copyright (c) 2019 QED-it, Aurélien Nicolas <[email protected]>

Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build:
wasm-pack build --out-dir ../www/pkg/zkif-wasm-example/ zkif-wasm-example
wasm-pack build --out-dir ../www/pkg/zkif-wasm-bulletproofs/ zkif-wasm-bulletproofs

web-dev:
cd www && npm run start
2 changes: 2 additions & 0 deletions www/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
5 changes: 5 additions & 0 deletions www/bootstrap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// A dependency graph that contains any wasm must all be imported
// asynchronously. This `bootstrap.js` file does the single async import, so
// that no one else needs to worry about it again.
import("./index.js")
.catch(e => console.error("Error importing `index.js`:", e));
11 changes: 11 additions & 0 deletions www/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello zkInterface!</title>
</head>
<body>
<script src="./bootstrap.js"></script>
<h4 id="status">Open the dev console.</h4>
</body>
</html>
16 changes: 16 additions & 0 deletions www/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import * as zkif_example from "./pkg/zkif-wasm-example";
import * as zkif_bulletproofs from "./pkg/zkif-wasm-bulletproofs";

// Common circuit.
let x = 3, y = 4, zz = x*x + y*y;
let circuit = zkif_example.make_circuit(x, y, zz);

// Prove.
let witness = zkif_example.make_witness(x, y);
let proof = zkif_bulletproofs.prove(circuit, witness);

// Verify.
let verif = zkif_bulletproofs.verify(circuit, proof);

let status = `The statement ${x}^2 + ${y}^2 = ${zz} is ${verif && "proven" || "NOT proven"}.`;
document.getElementById("status").innerText = status;
Loading

0 comments on commit 5709c00

Please sign in to comment.