arnaucube
arnaucube/miksi-appPublic Self-hosted repository
miksi-app/index.html
index.htmlRaw
  1<!DOCTYPE html>
  2<html lang="en">
  3
  4<head>
  5  <meta charset="utf-8">
  6  <title>miksi-app</title>
  7  <link rel="icon" type="image/png" href="miksi-logo00-square-pink.png">
  8  <meta name="viewport" content="width=device-width, initial-scale=1">
  9
 10  <meta name="viewport" content="width=device-width, user-scalable=no" />
 11  <!-- <link rel="manifest" href="manifest.json" /> -->
 12
 13  <link rel="stylesheet" href="css/style.css">
 14  <link rel="stylesheet" href="css/utils.css">
 15  <link rel="stylesheet" href="css/dark-theme.css">
 16  <!-- <link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css"> -->
 17  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
 18  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css"
 19    integrity="sha256-NuCn4IvuZXdBaFKJOAcsU2Q3ZpwbdFisd5dux4jkQ5w=" crossorigin="anonymous" />
 20
 21  <!-- toastr -->
 22  <!-- <link href="node_modules/toastr/build/toastr.css" rel="stylesheet" /> -->
 23  <link href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css" rel="stylesheet" />
 24
 25  <!-- to delete and use another in the future -->
 26</head>
 27
 28<body class="dark-theme">
 29  <a target="_blank" href="https://github.com/arnaucube/miksi-core" class="github-corner" aria-label="View source on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#fff; color:#151513; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><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></a><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>
 30
 31  <div id="wallet-maincard" class="card mainBox">
 32    <!-- menu -->
 33    <ul class="nav nav-tabs nav-fill" id="myTab" role="tablist">
 34      <li class="nav-item">
 35        <a class="nav-link active" id="deposit-tab" data-toggle="tab" href="#deposit" role="tab" aria-controls="deposit"
 36          aria-selected="false" onclick="onHistoryTabActivated()" title="Deposit">
 37          <i class="fa fa-lock fa-2x" aria-hidden="true"></i>
 38        </a>
 39      </li>
 40      <li class="nav-item">
 41        <a class="nav-link " onclick="onConfigTabActivated()" id="config-tab" data-toggle="tab" href="#config"
 42          role="tab" aria-controls="receive" aria-selected="true">
 43          <i class="fa fa-cog fa-2x" aria-hidden="true"></i>
 44        </a>
 45      </li>
 46    </ul>
 47    <div class="card-body">
 48      <!-- menu -->
 49      <div class="tab-content" id="myTabContent">
 50        <div class="float-right" style="text-align:right;">
 51        <button onclick="connectMetamask()" class="btn color_primary-o">Connect Metamask</button>
 52        <br><br>
 53        Current miksi address: <div id="contractAddr"></div>
 54        Version: v0.0.1
 55        </div>
 56        <h2><i>miksi</i></h2>
 57        <i>From Esperanto, <b>miksi</b> (miks·i): to mingle, to blend, to mix, to shuffle</i>
 58        <br>
 59	<br>
 60	<div class="explainer">
 61          Ethereum trustless <b>zk-mixer</b>.  Computations and Merkle tree reconstructions are done offchain and then proved inside a zkSNARK to the smart-contract.  This approach requires only <code>~325.000 gas</code> to deposit, compared to <code>~1M gas</code> for an onchain computation approach (as currently implemented in tornado.cash).
 62	  </div>
 63        <br><br>
 64        <div class="alertBox"><b>WARNING</b>: experimental code, use only in Göerli testnet. Do not use with real ETH.</div>
 65        <br><br>
 66
 67        <!-- deposit -->
 68        <div class="tab-pane fade show active" id="deposit" role="tabpanel" aria-labelledby="deposit-tab">
 69          <div class="row">
 70            <div class="col-md">
 71              <h5 class="card-title">Deposit</h5>
 72              <hr>
 73              Under the hood, we'll generate a zkSNARK proof that proves you know a <i>secret</i> for a <i>commitment</i>. And that this commitment has been correctly added to the MerkleTree containing all the commitments in the mixer.
 74              </br>
 75	      </br>
 76		We'll send this proof, along with the new <i>commitment</i> and the hash of the updated MerkleTree, to the <b>miksi</b> smart-contract. The contract will then verify the proof. If the proof is valid, both the new <i>root</i> and the <i>commitment</i> will be added to the contract, and the ETH will be deposited.
 77	      
 78              <br><br>
 79              <button onclick="deposit('deposit')" class="btn color_primary float-right">Deposit 1 ETH</button>
 80              <br><br>
 81              <div id="depositRes"></div>
 82              <br><br>
 83            </div>
 84            <div class="col-md">
 85              <h5 class="card-title">Withdraw</h5>
 86              <hr>
 87              Under the hood, we'll generate a zkSNARK proof that proves you know a <i>secret</i> for a <i>commitment</i> in the MerkleTree that you wish to withdraw from.
 88              </br>
 89	      </br>
 90              We'll send this proof, along with your withdrawal address, to the <b>miksi</b> smart-contract. The contract will then verify the proof. If the proof is valid, and it's the first time it's been correctly verified for this <i>commitment</i>, the contract will send the associated ETH to your withdrawal address.
 91              <br><br>
 92              <textarea id="jsonWithdraw" class="form-control" style="width:100%;" placeholder="{''secret'': <secret>, ''nullifier'': <nullifier>, ''key'', <key>}"></textarea>
 93              <br>
 94              <input id="withdrawAddress" class="form-control" placeholder="withdrawal address"></input>
 95              <br>
 96              <button onclick="withdraw('withdraw')" class="btn color_primary float-right">Withdraw 1 ETH</button>
 97              <br>
 98	      <br>
 99              <div id="withdrawRes"></div>
100            </div>
101          </div>
102          <div id="logs" class="logs">
103            <b>> Logs</b><br>
104          </div>
105          <br><br>
106          <h5 class="card-title">Stats</h5>
107          <hr>
108          <img src="miksi-logo00-square-pink.png" style="width:300px;" class="float-right">
109          <div id="stats">Please connect Metamask</div>
110
111          <br>
112        </div>
113        <!-- config -->
114        <div class="tab-pane fade" id="config" role="tabpanel" aria-labelledby="config-tab">
115
116          <h5><i class="fa fa-info" aria-hidden="true"></i> Info</h5>
117          <hr>
118          Specs and core code: <a href="https://github.com/arnaucube/miksi-core" target="_blank">https://github.com/arnaucube/miksi-core</a>
119          <br>
120	  </br>
121          What is a <a href="https://en.wikipedia.org/wiki/Cryptocurrency_tumbler" target="_blank">mixer</a>? A mixer is a tool to increase transaction privacy by breaking the on-chain link between the recipient and destination addresses. It uses a smart contract that accepts ETH deposits that can be withdrawn by a different address. Whenever a new address withdraws ETH, the link between the withdrawal and the deposit is obfuscated.
122          <br><br><br>
123          <h5><i class="fa fa-sliders" aria-hidden="true"></i> Config</h5>
124          <hr>
125          Theme:
126          <div class="onoffswitch" style="display:inline-block;margin: 10px;" title="change theme">
127            <input onclick="switchThemeClick()" type="checkbox" name="onoffswitch" class="onoffswitch-checkbox"
128              id="themeSwitcher" checked>
129            <label class="onoffswitch-label" for="themeSwitcher"></label>
130          </div>
131          </div>
132          <br><br>
133        
134        </div>
135      </div>
136    </div>
137  </div>
138
139
140
141  <!-- <script src="node_modules/jquery/dist/jquery.min.js"></script> -->
142  <!-- <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> -->
143  <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
144  <!-- [> <script src="node_modules/toastr/build/toastr.min.js"></script> <] -->
145  <script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js"></script>
146
147  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js"
148    integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut"
149    crossorigin="anonymous"></script>
150  <!-- <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script> -->
151  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
152
153
154  <script>
155    let theme = localStorage.getItem("theme");
156    if (theme === "light") {
157      document.getElementById("themeSwitcher").checked = false;
158      document.body.className = theme;
159    }
160
161    function switchThemeClick() {
162      theme = localStorage.getItem("theme");
163      if (theme === "light") {
164        document.getElementById("themeSwitcher").checked = true;
165        theme = "dark-theme";
166        localStorage.setItem("theme", theme);
167      } else {
168        document.getElementById("themeSwitcher").checked = false;
169        theme = "light";
170        localStorage.setItem("theme", theme);
171      }
172      document.body.className = theme;
173    }
174
175    toastr.options = {
176      "closeButton": false,
177      "debug": false,
178      "newestOnTop": false,
179      "progressBar": true,
180      "positionClass": "toast-bottom-right",
181      "preventDuplicates": false,
182      "onclick": null,
183      "showDuration": "300",
184      "hideDuration": "1000",
185      "timeOut": "5000",
186      "extendedTimeOut": "1000",
187      "showEasing": "swing",
188      "hideEasing": "linear",
189      "showMethod": "fadeIn",
190      "hideMethod": "fadeOut"
191    };
192  </script>
193
194  <!-- <script src="node_modules/axios/dist/axios.min.js"></script> -->
195  <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
196  <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.bundle.min.js"></script> -->
197
198  <script src="libs/wasmsnark_bn128.js"></script>
199  <script src="libs/snarkjs.js"></script>
200  <!-- <script src="node_modules/web3/dist/web3.min.js"></script> -->
201  <script src="libs/web3.min.js"></script>
202  <script src="libs/miksi-browser.js"></script>
203
204  <script src="index.js"></script>
205
206
207</body>
208
209</html>