Skip to content

Commit

Permalink
Explain the wasm modules first
Browse files Browse the repository at this point in the history
  • Loading branch information
naure committed Jun 20, 2019
1 parent 400e363 commit fbe1e18
Showing 1 changed file with 71 additions and 46 deletions.
117 changes: 71 additions & 46 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<a href="https://github.com/QED-it/zkinterface-wasm" class="github-corner" aria-label="View source on GitHub" style="z-index: 1;"><svg viewBox="0 0 250 250" style="fill:#1E2429; color:#fff; position: absolute; top: 0; border: 0; left: 0; transform: scale(-1, 1);z-index: 1;" aria-hidden="true" width="150" height="150"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style></a>

<div class="position-relative overflow-hidden p-3 p-md-5 m-md-3 bg-light">
<div class="position-relative overflow-hidden px-3 px-md-5 m-md-3 bg-light">
<div class="col-md-5 p-lg-5 mx-auto">
<h1 class="display-4 font-weight-normal pb-5">ZkInterface:<br/>ZoKrates ➞ Bulletproofs</h1>
<p class="lead">
Expand Down Expand Up @@ -64,6 +64,74 @@ <h1 class="display-4 font-weight-normal pb-5">ZkInterface:<br/>ZoKrates ➞ Bull
<!-- <div class="product-device product-device-2 shadow-sm d-none d-md-block"></div> -->
</div>

<div class="position-relative overflow-hidden px-3 px-md-5 m-md-3 bg-light">
<div class="col-md-5 p-lg-5 mx-auto">
<h1 class="font-weight-normal">WebAssembly Modules</h1>
<p class="lead">
The modules compile and run independently.<br/>
The application moves ZkInterface messages between modules.
</p>
</div>
</div>

<div class="d-md-flex flex-md-equal w-100 my-md-3 pl-md-3">
<div class="bg-dark-q p-3 p-md-5 overflow-hidden">
<div class="text-center text-white mb-3 pb-3">
<h2>ZoKrates.wasm</h2>
<p class="lead">
The frontend module generates the constraints, prover's witnesses, and verifier's inputs,
and store them in ZkInterface messages.
</p>
</div>
<pre class="code-block bg-light-q shadow-sm mx-auto"><code>
let constraints = zkif_zokrates.make_constraint_system(code);

let {prover_msg, verifier_msg} = zkif_zokrates.make_witness(code, x, y);
</code></pre>
</div>

<div class="border-dark-q arrow-right my-auto"></div>

<div class="bg-light-q mr-md-3 p-3 p-md-5 overflow-hidden">
<div class="text-center mb-3 pb-3">
<h2>Bulletproofs.wasm</h2>
<p class="lead">
The proving system reads the ZkInterface messages to generate proofs.
<br/>&nbsp;
</p>
</div>
<pre class="code-block bg-dark-q text-white shadow-sm mx-auto"><code>
let proof = zkif_bulletproofs.prove(constraints, prover_msg);

let valid = zkif_bulletproofs.verify(constraints, verifier_msg, proof);
</code></pre>
</div>
</div>

<!-- Separator -->
<div class="position-relative overflow-hidden mx-md-3 mt-5"></div>

<div class="position-relative overflow-hidden px-3 px-md-5 m-md-3 bg-light">
<div class="col-md-5 p-lg-5 mx-auto">
<h1 class="font-weight-normal">ZkInterface messages</h1>
<p>
There are three types of messages:
</p><p>
<ul>
<li><b>Circuit:</b> describes the input variables of the circuit.</li>
<li><b>R1CSConstraints:</b> describes the constraints between variables.</li>
<li><b>Witness:</b> contains values to assign to variables.</li>
</ul>
</p><p>
See the
<a href="https://github.com/QED-it/zkinterface/blob/master/zkinterface.fbs">interface definition</a>
and the
<a href="https://github.com/QED-it/zkinterface/blob/master/zkinterface.fbs">paper</a>
for details.
</p>
</div>
</div>

<div class="d-md-flex flex-md-equal w-100 pl-md-3">
<div class="bg-dark-q p-3 p-md-5 overflow-hidden">
<div class="text-center text-white mb-3 pb-3">
Expand Down Expand Up @@ -131,51 +199,8 @@ <h2 class="display-5">Verifier's View</h2>
</div>
</div>

<div class="position-relative overflow-hidden mx-md-3 mt-5 text-center bg-light"></div>

<div class="position-relative overflow-hidden mx-md-3 mt-5 text-center bg-light">
<div class="col-md-5 p-lg-4 mx-auto">
<h1 class="font-weight-normal">WebAssembly Modules</h1>
<p class="lead">
The modules compile and run independently.<br/>
The application moves ZkInterface messages between modules.
</p>
</div>
</div>

<div class="d-md-flex flex-md-equal w-100 my-md-3 pl-md-3">
<div class="bg-dark-q p-3 p-md-5 overflow-hidden">
<div class="text-center text-white mb-3 pb-3">
<h2>ZoKrates.wasm</h2>
<p class="lead">
The frontend module generates the constraints, prover's witnesses, and verifier's inputs,
and store them in ZkInterface messages.
</p>
</div>
<pre class="code-block bg-light-q shadow-sm mx-auto"><code>
let constraints = zkif_zokrates.make_constraint_system(code);

let {prover_msg, verifier_msg} = zkif_zokrates.make_witness(code, x, y);
</code></pre>
</div>

<div class="border-dark-q arrow-right my-auto"></div>

<div class="bg-light-q mr-md-3 p-3 p-md-5 overflow-hidden">
<div class="text-center mb-3 pb-3">
<h2>Bulletproofs.wasm</h2>
<p class="lead">
The proving system reads the ZkInterface messages to generate proofs.
<br/>&nbsp;
</p>
</div>
<pre class="code-block bg-dark-q text-white shadow-sm mx-auto"><code>
let proof = zkif_bulletproofs.prove(constraints, prover_msg);

let valid = zkif_bulletproofs.verify(constraints, verifier_msg, proof);
</code></pre>
</div>
</div>
<!-- Separator -->
<div class="position-relative m-5 p-5"></div>

<!-- <script src="node_modules/jquery/dist/jquery.slim.min.js" integrity="sha256-pasqAKBDmFT4eHoN2ndd6lN370kFiGUFyTiUHWhU7k8=" crossorigin="anonymous"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.bundle.min.js" integrity="sha384-xrRywqdh3PHs8keKZN+8zzc5TX0GRTLCcmivcbNJWm2rs5C8PRhcEn3czEjhAO9o" crossorigin="anonymous"></script> -->
Expand Down

0 comments on commit fbe1e18

Please sign in to comment.