Skip to content

Instantly share code, notes, and snippets.

@didil
Last active December 28, 2017 17:08
Show Gist options
  • Save didil/b42133379f1fa5030a8c9813f85452f3 to your computer and use it in GitHub Desktop.
Save didil/b42133379f1fa5030a8c9813f85452f3 to your computer and use it in GitHub Desktop.
$ truffle console --network=b
# company B votes, while making the transaction private and only visible by the regulator, "BULeR8JyUWhiuuCMU/HLA0Q5pzkYT+cHII3ZKBey3Bo=" is the Regulator Node's key in our setup
truffle(b)> SecretBallot.deployed().then((instance) => instance.vote(1, {privateFor: ["BULeR8JyUWhiuuCMU/HLA0Q5pzkYT+cHII3ZKBey3Bo="]}))
# Check vote count for option 1
truffle(b)> SecretBallot.deployed().then((instance) => instance.getTotalVotes(1)).then((result) => result.toNumber())
1
# Check vote count for option 2
truffle(b)> SecretBallot.deployed().then((instance) => instance.getTotalVotes(2)).then((result) => result.toNumber())
0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment