This commit is contained in:
poma 2019-07-13 17:45:08 +03:00
parent d48a17f5d9
commit 890e2fd78b
4 changed files with 397 additions and 73 deletions

116
cli.js
View File

@ -1,40 +1,55 @@
#!/usr/bin/env node #!/usr/bin/env node
const assert = require('assert');
const snarkjs = require("snarkjs"); const snarkjs = require("snarkjs");
const bigInt = snarkjs.bigInt; const bigInt = snarkjs.bigInt;
const utils = require("./scripts/utils"); const utils = require("./scripts/utils");
const merkleTree = require('./lib/MerkleTree'); const merkleTree = require('./lib/MerkleTree');
const contract = require("truffle-contract"); const Web3 = require('web3')
const Mixer = contract(require('./build/contracts/Mixer.json'));
const sender = "";//accounts[0]; let web3, mixer;
const amount = "1 ether"; async function init() {
web3 = new Web3('http://localhost:8545', null, {transactionConfirmationBlocks: 1});
let netId = await web3.eth.net.getId()
const json = require('./build/contracts/Mixer.json');
mixer = new web3.eth.Contract(json.abi, json.networks[netId].address);
const tx = await web3.eth.getTransaction(json.networks[netId].transactionHash);
mixer.deployedBlock = tx.blockNumber;
}
function createDeposit(nullifier, secret) {
let deposit = {nullifier, secret};
deposit.preimage = Buffer.concat([deposit.nullifier.leInt2Buff(32), deposit.secret.leInt2Buff(32)]);
deposit.commitment = utils.pedersenHash(deposit.preimage);
return deposit;
}
async function deposit() { async function deposit() {
let deposit = { await init();
nullifier: utils.rbigint(31), const deposit = createDeposit(utils.rbigint(31), utils.rbigint(31));
secret: utils.rbigint(31),
};
const preimage = Buffer.concat([deposit.nullifier.leInt2Buff(32), deposit.secret.leInt2Buff(32)]);
deposit.commitment = utils.pedersenHash(preimage);
console.log("Submitting deposit transaction"); console.log("Submitting deposit transaction");
const mixer = await Mixer.deployed(); await mixer.methods.deposit("0x" + deposit.commitment.toString(16)).send({ value: web3.utils.toWei("1", "ether"), from: (await web3.eth.getAccounts())[0], gas:1e6 });
await mixer.deposit(deposit.commitment, { value: amount, from: sender });
return preimage.toString('hex'); const note = "0x" + deposit.preimage.toString('hex');
console.log("Your note:", note);
return note;
} }
async function withdraw(note, receiver) { async function withdraw(note, receiver) {
await init();
let buf = Buffer.from(note.slice(2), "hex"); let buf = Buffer.from(note.slice(2), "hex");
let deposit = { let deposit = createDeposit(bigInt.leBuff2int(buf.slice(0, 32)), bigInt.leBuff2int(buf.slice(32, 64)));
nullifier: bigInt.leBuff2int(buf.slice(0, 32)),
secret: bigInt.leBuff2int(buf.slice(32, 64)),
};
console.log("Getting current state from mixer contract"); console.log("Getting current state from mixer contract");
const mixer = await Mixer.deployed(); const events = await mixer.getPastEvents('LeafAdded', {fromBlock: mixer.deployedBlock, toBlock: 'latest'});
const leaves = events.sort(e => e.returnValues.leaf_index).map(e => e.returnValues.leaf);
const tree = new merkleTree(16, 0, leaves);
const validRoot = await mixer.methods.isKnownRoot(await tree.root()).call();
assert(validRoot === true);
const {root, path_elements, path_index} = await tree.path(1); const leafIndex = leaves.indexOf(deposit.commitment.toString());
assert(leafIndex > 0);
const {root, path_elements, path_index} = await tree.path(leafIndex);
// Circuit input // Circuit input
const input = { const input = {
// public // public
@ -53,17 +68,17 @@ async function withdraw(note, receiver) {
const { pi_a, pi_b, pi_c, publicSignals } = await utils.snarkProof(input); const { pi_a, pi_b, pi_c, publicSignals } = await utils.snarkProof(input);
console.log("Submitting withdraw transaction"); console.log("Submitting withdraw transaction");
await mixer.withdraw(pi_a, pi_b, pi_c, publicSignals, { from: sender }) await mixer.methods.withdraw(pi_a, pi_b, pi_c, publicSignals).send({ from: (await web3.eth.getAccounts())[0], gas: 1e6 });
console.log("Done");
} }
function printHelp() { function printHelp(code = 0) {
console.log(` console.log(`Usage:
Usage:
Submit a deposit from default eth account and return the resulting note Submit a deposit from default eth account and return the resulting note
$ ./cli.js deposit $ ./cli.js deposit
Withdraw a note to 'receiver' account Withdraw a note to 'receiver' account
$ ./cli.js withdraw <note <receiver $ ./cli.js withdraw <note> <receiver>
Example: Example:
$ ./cli.js deposit $ ./cli.js deposit
@ -72,38 +87,29 @@ Example:
$ ./cli.js withdraw 0x1941fa999e2b4bfeec3ce53c2440c3bc991b1b84c9bb650ea19f8331baf621001e696487e2a2ee54541fa12f49498d71e24d00b1731a8ccd4f5f5126f3d9f400 0xee6249BA80596A4890D1BD84dbf5E4322eA4E7f0 $ ./cli.js withdraw 0x1941fa999e2b4bfeec3ce53c2440c3bc991b1b84c9bb650ea19f8331baf621001e696487e2a2ee54541fa12f49498d71e24d00b1731a8ccd4f5f5126f3d9f400 0xee6249BA80596A4890D1BD84dbf5E4322eA4E7f0
`); `);
process.exit(0); process.exit(code);
} }
(async () => { const args = process.argv.slice(2);
const dep = await deposit(); if (args.length === 0) {
console.log(`Your note: 0x${dep}`); printHelp();
} else {
switch (args[0]) {
case 'deposit':
if (args.length === 1)
deposit().then(() => process.exit(0)).catch(err => {console.log(err); process.exit(1)});
else
printHelp(1);
break;
const acc = "0xee6249BA80596A4890D1BD84dbf5E4322eA4E7f0";//accounts[1]; case 'withdraw':
await withdraw(dep, acc); if (args.length === 3 && /^0x[0-9a-fA-F]{128}$/.test(args[1]) && /^0x[0-9a-fA-F]{40}$/.test(args[2]))
})(); withdraw(args[1], args[2]).then(() => process.exit(0)).catch(err => {console.log(err); process.exit(1)});
else
printHelp(1);
break;
default:
// const args = process.argv.slice(2); printHelp(1);
// if (args.length === 0) { }
// printHelp(); }
// }
//
// switch (args[0]) {
// case 'deposit':
// if (args.length === 1)
// deposit().then(() => process.exit(0));
// else
// printHelp();
// break;
//
// case 'withdraw':
// if (args.length === 3 && /^[0-9a-fA-F]{128}$/.test(args[1]) && /^[0-9a-fA-F]{64}$/.test(args[2]))
// withdraw(args[1], args[2]).then(() => process.exit(0));
// else
// printHelp();
// break;
//
// default:
// printHelp();
// }

318
package-lock.json generated
View File

@ -866,6 +866,39 @@
"eslint": "^5.3.0", "eslint": "^5.3.0",
"yargs": "^12.0.2" "yargs": "^12.0.2"
} }
},
"web3": {
"version": "1.0.0-beta.55",
"resolved": "https://registry.npmjs.org/web3/-/web3-1.0.0-beta.55.tgz",
"integrity": "sha512-yJpwy4IUA3T/F9hWzYQVn0GbJCrAaZ0KTIO3iuqkhaYH0Y09KV7k4GzFi4hN7hT4cFTj4yIKaeVCwQ5kzvi2Vg==",
"requires": {
"@babel/runtime": "^7.3.1",
"@types/node": "^10.12.18",
"web3-core": "1.0.0-beta.55",
"web3-eth": "1.0.0-beta.55",
"web3-eth-personal": "1.0.0-beta.55",
"web3-net": "1.0.0-beta.55",
"web3-providers": "1.0.0-beta.55",
"web3-shh": "1.0.0-beta.55",
"web3-utils": "1.0.0-beta.55"
}
},
"web3-utils": {
"version": "1.0.0-beta.55",
"resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.55.tgz",
"integrity": "sha512-ASWqUi8gtWK02Tp8ZtcoAbHenMpQXNvHrakgzvqTNNZn26wgpv+Q4mdPi0KOR6ZgHFL8R/9b5BBoUTglS1WPpg==",
"requires": {
"@babel/runtime": "^7.3.1",
"@types/bn.js": "^4.11.4",
"@types/node": "^10.12.18",
"bn.js": "4.11.8",
"eth-lib": "0.2.8",
"ethjs-unit": "^0.1.6",
"lodash": "^4.17.11",
"number-to-bn": "1.7.0",
"randombytes": "^2.1.0",
"utf8": "2.1.1"
}
} }
} }
}, },
@ -7674,6 +7707,25 @@
"web3-providers": "1.0.0-beta.55", "web3-providers": "1.0.0-beta.55",
"web3-shh": "1.0.0-beta.55", "web3-shh": "1.0.0-beta.55",
"web3-utils": "1.0.0-beta.55" "web3-utils": "1.0.0-beta.55"
},
"dependencies": {
"web3-utils": {
"version": "1.0.0-beta.55",
"resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.55.tgz",
"integrity": "sha512-ASWqUi8gtWK02Tp8ZtcoAbHenMpQXNvHrakgzvqTNNZn26wgpv+Q4mdPi0KOR6ZgHFL8R/9b5BBoUTglS1WPpg==",
"requires": {
"@babel/runtime": "^7.3.1",
"@types/bn.js": "^4.11.4",
"@types/node": "^10.12.18",
"bn.js": "4.11.8",
"eth-lib": "0.2.8",
"ethjs-unit": "^0.1.6",
"lodash": "^4.17.11",
"number-to-bn": "1.7.0",
"randombytes": "^2.1.0",
"utf8": "2.1.1"
}
}
} }
}, },
"web3-bzz": { "web3-bzz": {
@ -7698,6 +7750,25 @@
"web3-core-method": "1.0.0-beta.55", "web3-core-method": "1.0.0-beta.55",
"web3-providers": "1.0.0-beta.55", "web3-providers": "1.0.0-beta.55",
"web3-utils": "1.0.0-beta.55" "web3-utils": "1.0.0-beta.55"
},
"dependencies": {
"web3-utils": {
"version": "1.0.0-beta.55",
"resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.55.tgz",
"integrity": "sha512-ASWqUi8gtWK02Tp8ZtcoAbHenMpQXNvHrakgzvqTNNZn26wgpv+Q4mdPi0KOR6ZgHFL8R/9b5BBoUTglS1WPpg==",
"requires": {
"@babel/runtime": "^7.3.1",
"@types/bn.js": "^4.11.4",
"@types/node": "^10.12.18",
"bn.js": "4.11.8",
"eth-lib": "0.2.8",
"ethjs-unit": "^0.1.6",
"lodash": "^4.17.11",
"number-to-bn": "1.7.0",
"randombytes": "^2.1.0",
"utf8": "2.1.1"
}
}
} }
}, },
"web3-core-helpers": { "web3-core-helpers": {
@ -7710,6 +7781,25 @@
"web3-core": "1.0.0-beta.55", "web3-core": "1.0.0-beta.55",
"web3-eth-iban": "1.0.0-beta.55", "web3-eth-iban": "1.0.0-beta.55",
"web3-utils": "1.0.0-beta.55" "web3-utils": "1.0.0-beta.55"
},
"dependencies": {
"web3-utils": {
"version": "1.0.0-beta.55",
"resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.55.tgz",
"integrity": "sha512-ASWqUi8gtWK02Tp8ZtcoAbHenMpQXNvHrakgzvqTNNZn26wgpv+Q4mdPi0KOR6ZgHFL8R/9b5BBoUTglS1WPpg==",
"requires": {
"@babel/runtime": "^7.3.1",
"@types/bn.js": "^4.11.4",
"@types/node": "^10.12.18",
"bn.js": "4.11.8",
"eth-lib": "0.2.8",
"ethjs-unit": "^0.1.6",
"lodash": "^4.17.11",
"number-to-bn": "1.7.0",
"randombytes": "^2.1.0",
"utf8": "2.1.1"
}
}
} }
}, },
"web3-core-method": { "web3-core-method": {
@ -7725,6 +7815,25 @@
"web3-core-helpers": "1.0.0-beta.55", "web3-core-helpers": "1.0.0-beta.55",
"web3-core-subscriptions": "1.0.0-beta.55", "web3-core-subscriptions": "1.0.0-beta.55",
"web3-utils": "1.0.0-beta.55" "web3-utils": "1.0.0-beta.55"
},
"dependencies": {
"web3-utils": {
"version": "1.0.0-beta.55",
"resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.55.tgz",
"integrity": "sha512-ASWqUi8gtWK02Tp8ZtcoAbHenMpQXNvHrakgzvqTNNZn26wgpv+Q4mdPi0KOR6ZgHFL8R/9b5BBoUTglS1WPpg==",
"requires": {
"@babel/runtime": "^7.3.1",
"@types/bn.js": "^4.11.4",
"@types/node": "^10.12.18",
"bn.js": "4.11.8",
"eth-lib": "0.2.8",
"ethjs-unit": "^0.1.6",
"lodash": "^4.17.11",
"number-to-bn": "1.7.0",
"randombytes": "^2.1.0",
"utf8": "2.1.1"
}
}
} }
}, },
"web3-core-promievent": { "web3-core-promievent": {
@ -7840,6 +7949,25 @@
"web3-net": "1.0.0-beta.55", "web3-net": "1.0.0-beta.55",
"web3-providers": "1.0.0-beta.55", "web3-providers": "1.0.0-beta.55",
"web3-utils": "1.0.0-beta.55" "web3-utils": "1.0.0-beta.55"
},
"dependencies": {
"web3-utils": {
"version": "1.0.0-beta.55",
"resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.55.tgz",
"integrity": "sha512-ASWqUi8gtWK02Tp8ZtcoAbHenMpQXNvHrakgzvqTNNZn26wgpv+Q4mdPi0KOR6ZgHFL8R/9b5BBoUTglS1WPpg==",
"requires": {
"@babel/runtime": "^7.3.1",
"@types/bn.js": "^4.11.4",
"@types/node": "^10.12.18",
"bn.js": "4.11.8",
"eth-lib": "0.2.8",
"ethjs-unit": "^0.1.6",
"lodash": "^4.17.11",
"number-to-bn": "1.7.0",
"randombytes": "^2.1.0",
"utf8": "2.1.1"
}
}
} }
}, },
"web3-eth-abi": { "web3-eth-abi": {
@ -7851,6 +7979,25 @@
"ethers": "^4.0.27", "ethers": "^4.0.27",
"lodash": "^4.17.11", "lodash": "^4.17.11",
"web3-utils": "1.0.0-beta.55" "web3-utils": "1.0.0-beta.55"
},
"dependencies": {
"web3-utils": {
"version": "1.0.0-beta.55",
"resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.55.tgz",
"integrity": "sha512-ASWqUi8gtWK02Tp8ZtcoAbHenMpQXNvHrakgzvqTNNZn26wgpv+Q4mdPi0KOR6ZgHFL8R/9b5BBoUTglS1WPpg==",
"requires": {
"@babel/runtime": "^7.3.1",
"@types/bn.js": "^4.11.4",
"@types/node": "^10.12.18",
"bn.js": "4.11.8",
"eth-lib": "0.2.8",
"ethjs-unit": "^0.1.6",
"lodash": "^4.17.11",
"number-to-bn": "1.7.0",
"randombytes": "^2.1.0",
"utf8": "2.1.1"
}
}
} }
}, },
"web3-eth-accounts": { "web3-eth-accounts": {
@ -7877,6 +8024,23 @@
"version": "3.3.2", "version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
},
"web3-utils": {
"version": "1.0.0-beta.55",
"resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.55.tgz",
"integrity": "sha512-ASWqUi8gtWK02Tp8ZtcoAbHenMpQXNvHrakgzvqTNNZn26wgpv+Q4mdPi0KOR6ZgHFL8R/9b5BBoUTglS1WPpg==",
"requires": {
"@babel/runtime": "^7.3.1",
"@types/bn.js": "^4.11.4",
"@types/node": "^10.12.18",
"bn.js": "4.11.8",
"eth-lib": "0.2.8",
"ethjs-unit": "^0.1.6",
"lodash": "^4.17.11",
"number-to-bn": "1.7.0",
"randombytes": "^2.1.0",
"utf8": "2.1.1"
}
} }
} }
}, },
@ -7896,6 +8060,25 @@
"web3-eth-accounts": "1.0.0-beta.55", "web3-eth-accounts": "1.0.0-beta.55",
"web3-providers": "1.0.0-beta.55", "web3-providers": "1.0.0-beta.55",
"web3-utils": "1.0.0-beta.55" "web3-utils": "1.0.0-beta.55"
},
"dependencies": {
"web3-utils": {
"version": "1.0.0-beta.55",
"resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.55.tgz",
"integrity": "sha512-ASWqUi8gtWK02Tp8ZtcoAbHenMpQXNvHrakgzvqTNNZn26wgpv+Q4mdPi0KOR6ZgHFL8R/9b5BBoUTglS1WPpg==",
"requires": {
"@babel/runtime": "^7.3.1",
"@types/bn.js": "^4.11.4",
"@types/node": "^10.12.18",
"bn.js": "4.11.8",
"eth-lib": "0.2.8",
"ethjs-unit": "^0.1.6",
"lodash": "^4.17.11",
"number-to-bn": "1.7.0",
"randombytes": "^2.1.0",
"utf8": "2.1.1"
}
}
} }
}, },
"web3-eth-ens": { "web3-eth-ens": {
@ -7915,6 +8098,25 @@
"web3-net": "1.0.0-beta.55", "web3-net": "1.0.0-beta.55",
"web3-providers": "1.0.0-beta.55", "web3-providers": "1.0.0-beta.55",
"web3-utils": "1.0.0-beta.55" "web3-utils": "1.0.0-beta.55"
},
"dependencies": {
"web3-utils": {
"version": "1.0.0-beta.55",
"resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.55.tgz",
"integrity": "sha512-ASWqUi8gtWK02Tp8ZtcoAbHenMpQXNvHrakgzvqTNNZn26wgpv+Q4mdPi0KOR6ZgHFL8R/9b5BBoUTglS1WPpg==",
"requires": {
"@babel/runtime": "^7.3.1",
"@types/bn.js": "^4.11.4",
"@types/node": "^10.12.18",
"bn.js": "4.11.8",
"eth-lib": "0.2.8",
"ethjs-unit": "^0.1.6",
"lodash": "^4.17.11",
"number-to-bn": "1.7.0",
"randombytes": "^2.1.0",
"utf8": "2.1.1"
}
}
} }
}, },
"web3-eth-iban": { "web3-eth-iban": {
@ -7925,6 +8127,25 @@
"@babel/runtime": "^7.3.1", "@babel/runtime": "^7.3.1",
"bn.js": "4.11.8", "bn.js": "4.11.8",
"web3-utils": "1.0.0-beta.55" "web3-utils": "1.0.0-beta.55"
},
"dependencies": {
"web3-utils": {
"version": "1.0.0-beta.55",
"resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.55.tgz",
"integrity": "sha512-ASWqUi8gtWK02Tp8ZtcoAbHenMpQXNvHrakgzvqTNNZn26wgpv+Q4mdPi0KOR6ZgHFL8R/9b5BBoUTglS1WPpg==",
"requires": {
"@babel/runtime": "^7.3.1",
"@types/bn.js": "^4.11.4",
"@types/node": "^10.12.18",
"bn.js": "4.11.8",
"eth-lib": "0.2.8",
"ethjs-unit": "^0.1.6",
"lodash": "^4.17.11",
"number-to-bn": "1.7.0",
"randombytes": "^2.1.0",
"utf8": "2.1.1"
}
}
} }
}, },
"web3-eth-personal": { "web3-eth-personal": {
@ -7940,6 +8161,25 @@
"web3-net": "1.0.0-beta.55", "web3-net": "1.0.0-beta.55",
"web3-providers": "1.0.0-beta.55", "web3-providers": "1.0.0-beta.55",
"web3-utils": "1.0.0-beta.55" "web3-utils": "1.0.0-beta.55"
},
"dependencies": {
"web3-utils": {
"version": "1.0.0-beta.55",
"resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.55.tgz",
"integrity": "sha512-ASWqUi8gtWK02Tp8ZtcoAbHenMpQXNvHrakgzvqTNNZn26wgpv+Q4mdPi0KOR6ZgHFL8R/9b5BBoUTglS1WPpg==",
"requires": {
"@babel/runtime": "^7.3.1",
"@types/bn.js": "^4.11.4",
"@types/node": "^10.12.18",
"bn.js": "4.11.8",
"eth-lib": "0.2.8",
"ethjs-unit": "^0.1.6",
"lodash": "^4.17.11",
"number-to-bn": "1.7.0",
"randombytes": "^2.1.0",
"utf8": "2.1.1"
}
}
} }
}, },
"web3-net": { "web3-net": {
@ -7954,6 +8194,25 @@
"web3-core-method": "1.0.0-beta.55", "web3-core-method": "1.0.0-beta.55",
"web3-providers": "1.0.0-beta.55", "web3-providers": "1.0.0-beta.55",
"web3-utils": "1.0.0-beta.55" "web3-utils": "1.0.0-beta.55"
},
"dependencies": {
"web3-utils": {
"version": "1.0.0-beta.55",
"resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.55.tgz",
"integrity": "sha512-ASWqUi8gtWK02Tp8ZtcoAbHenMpQXNvHrakgzvqTNNZn26wgpv+Q4mdPi0KOR6ZgHFL8R/9b5BBoUTglS1WPpg==",
"requires": {
"@babel/runtime": "^7.3.1",
"@types/bn.js": "^4.11.4",
"@types/node": "^10.12.18",
"bn.js": "4.11.8",
"eth-lib": "0.2.8",
"ethjs-unit": "^0.1.6",
"lodash": "^4.17.11",
"number-to-bn": "1.7.0",
"randombytes": "^2.1.0",
"utf8": "2.1.1"
}
}
} }
}, },
"web3-providers": { "web3-providers": {
@ -7972,6 +8231,25 @@
"web3-utils": "1.0.0-beta.55", "web3-utils": "1.0.0-beta.55",
"websocket": "^1.0.28", "websocket": "^1.0.28",
"xhr2-cookies": "1.1.0" "xhr2-cookies": "1.1.0"
},
"dependencies": {
"web3-utils": {
"version": "1.0.0-beta.55",
"resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.55.tgz",
"integrity": "sha512-ASWqUi8gtWK02Tp8ZtcoAbHenMpQXNvHrakgzvqTNNZn26wgpv+Q4mdPi0KOR6ZgHFL8R/9b5BBoUTglS1WPpg==",
"requires": {
"@babel/runtime": "^7.3.1",
"@types/bn.js": "^4.11.4",
"@types/node": "^10.12.18",
"bn.js": "4.11.8",
"eth-lib": "0.2.8",
"ethjs-unit": "^0.1.6",
"lodash": "^4.17.11",
"number-to-bn": "1.7.0",
"randombytes": "^2.1.0",
"utf8": "2.1.1"
}
}
} }
}, },
"web3-providers-http": { "web3-providers-http": {
@ -8201,8 +8479,8 @@
"web3-net": "1.0.0-beta.55", "web3-net": "1.0.0-beta.55",
"web3-providers": "1.0.0-beta.55", "web3-providers": "1.0.0-beta.55",
"web3-utils": "1.0.0-beta.55" "web3-utils": "1.0.0-beta.55"
}
}, },
"dependencies": {
"web3-utils": { "web3-utils": {
"version": "1.0.0-beta.55", "version": "1.0.0-beta.55",
"resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.55.tgz", "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.55.tgz",
@ -8219,6 +8497,44 @@
"randombytes": "^2.1.0", "randombytes": "^2.1.0",
"utf8": "2.1.1" "utf8": "2.1.1"
} }
}
}
},
"web3-utils": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0.tgz",
"integrity": "sha512-zm0gdLXLk54ldwxxBMNPS62EuqHI2PaJohEGijTowacNS0BS2vEXdriNA8gp1+EplP2WgoHE0uRVmQIfpAyV+Q==",
"requires": {
"bn.js": "4.11.8",
"eth-lib": "0.2.7",
"ethjs-unit": "0.1.6",
"number-to-bn": "1.7.0",
"randomhex": "0.1.5",
"underscore": "1.9.1",
"utf8": "3.0.0"
},
"dependencies": {
"eth-lib": {
"version": "0.2.7",
"resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz",
"integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=",
"requires": {
"bn.js": "^4.11.6",
"elliptic": "^6.4.0",
"xhr-request-promise": "^0.1.2"
}
},
"underscore": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz",
"integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg=="
},
"utf8": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz",
"integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ=="
}
}
}, },
"websnark": { "websnark": {
"version": "0.0.4", "version": "0.0.4",

View File

@ -11,7 +11,8 @@
"build:circuit": "mkdir -p build/circuits && npm run build:circuit:compile && npm run build:circuit:setup && npm run build:circuit:bin && npm run build:circuit:contract", "build:circuit": "mkdir -p build/circuits && npm run build:circuit:compile && npm run build:circuit:setup && npm run build:circuit:bin && npm run build:circuit:contract",
"build:contract": "npx truffle compile", "build:contract": "npx truffle compile",
"test": "npx truffle test", "test": "npx truffle test",
"migrate": "npx truffle migrate --network kovan --reset" "migrate": "npx truffle migrate --network kovan --reset",
"migrate:dev": "npx truffle migrate --network development --reset"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",
@ -29,6 +30,7 @@
"truffle-artifactor": "^4.0.23", "truffle-artifactor": "^4.0.23",
"truffle-contract": "^4.0.24", "truffle-contract": "^4.0.24",
"truffle-hdwallet-provider": "^1.0.14", "truffle-hdwallet-provider": "^1.0.14",
"web3": "^1.0.0-beta.55",
"web3-utils": "^1.0.0-beta.55", "web3-utils": "^1.0.0-beta.55",
"websnark": "0.0.4" "websnark": "0.0.4"
} }

View File

@ -23,12 +23,12 @@ module.exports = {
// You should run a client (like ganache-cli, geth or parity) in a separate terminal // You should run a client (like ganache-cli, geth or parity) in a separate terminal
// tab if you use this network and you must also set the `host`, `port` and `network_id` // tab if you use this network and you must also set the `host`, `port` and `network_id`
// options below to some value. // options below to some value.
//
// development: { development: {
// host: "127.0.0.1", // Localhost (default: none) host: "127.0.0.1", // Localhost (default: none)
// port: 8545, // Standard Ethereum port (default: none) port: 8545, // Standard Ethereum port (default: none)
// network_id: "*", // Any network (default: none) network_id: "*", // Any network (default: none)
// }, },
// Another network with more advanced options... // Another network with more advanced options...
// advanced: { // advanced: {