make it work with ganache

This commit is contained in:
Alexey 2020-02-28 13:42:46 +03:00
parent 49bdd1bb6f
commit 6a592154d2
2 changed files with 13 additions and 3 deletions

View File

@ -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, 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 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`

View File

@ -11,10 +11,10 @@ const { toWei } = require('web3-utils')
let web3, contract, netId, circuit, proving_key, groth16 let web3, contract, netId, circuit, proving_key, groth16
const RPC_URL = 'http://localhost:8545' const RPC_URL = 'http://localhost:8545'
const CONTRACT_ADDRESS = '0x47CE0C6eD5B0Ce3d3A51fdb1C52DC66a7c3c2936' const CONTRACT_ADDRESS = '0x9561C133DD8580860B6b7E504bC5Aa500f0f06a7'
const MERKLE_TREE_HEIGHT = 20 const MERKLE_TREE_HEIGHT = 20
const AMOUNT = '1' const AMOUNT = '0.1'
const DEPLOYED_BLOCK = 9117609 const DEPLOYED_BLOCK = 0
/** Generate random number of specified byte length */ /** Generate random number of specified byte length */
const rbigint = nbytes => bigInt.leBuff2int(crypto.randomBytes(nbytes)) const rbigint = nbytes => bigInt.leBuff2int(crypto.randomBytes(nbytes))
@ -157,6 +157,7 @@ async function main() {
console.log('Deposited note:', note) console.log('Deposited note:', note)
await withdraw(note, web3.eth.defaultAccount) await withdraw(note, web3.eth.defaultAccount)
console.log('Done') console.log('Done')
process.exit()
} }
main() main()