From 6a592154d26b3e0dc0db42ee2c1273d635d8ba95 Mon Sep 17 00:00:00 2001 From: Alexey Date: Fri, 28 Feb 2020 13:42:46 +0300 Subject: [PATCH] make it work with ganache --- README.md | 9 +++++++++ minimal-demo.js | 7 ++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0b90135..29f3707 100644 --- a/README.md +++ b/README.md @@ -84,3 +84,12 @@ If you want, you can point the app to existing tornado contracts on Mainnet or K Special thanks to @barryWhiteHat and @kobigurk for valuable input, and to @jbaylina for awesome [Circom](https://github.com/iden3/circom) & [Websnark](https://github.com/iden3/websnark) framework + +## Minimal demo example +1. `npm i` +1. `ganache-cli -d` +1. `npm run downloadKeys` +1. `npm build:contract` +1. `cp .env.example .env` +1. `npm run migrate:dev` +1. `node minimal-demo.js` diff --git a/minimal-demo.js b/minimal-demo.js index 6c2553a..533360d 100644 --- a/minimal-demo.js +++ b/minimal-demo.js @@ -11,10 +11,10 @@ const { toWei } = require('web3-utils') let web3, contract, netId, circuit, proving_key, groth16 const RPC_URL = 'http://localhost:8545' -const CONTRACT_ADDRESS = '0x47CE0C6eD5B0Ce3d3A51fdb1C52DC66a7c3c2936' +const CONTRACT_ADDRESS = '0x9561C133DD8580860B6b7E504bC5Aa500f0f06a7' const MERKLE_TREE_HEIGHT = 20 -const AMOUNT = '1' -const DEPLOYED_BLOCK = 9117609 +const AMOUNT = '0.1' +const DEPLOYED_BLOCK = 0 /** Generate random number of specified byte length */ const rbigint = nbytes => bigInt.leBuff2int(crypto.randomBytes(nbytes)) @@ -157,6 +157,7 @@ async function main() { console.log('Deposited note:', note) await withdraw(note, web3.eth.defaultAccount) console.log('Done') + process.exit() } main()