Skip to content

Instantly share code, notes, and snippets.

@didil
Last active December 28, 2017 17:08
Show Gist options
  • Save didil/1eb47dad048bfd0b6c88b418986eae51 to your computer and use it in GitHub Desktop.
Save didil/1eb47dad048bfd0b6c88b418986eae51 to your computer and use it in GitHub Desktop.
$ truffle console --network=c
# company C 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(c)> SecretBallot.deployed().then((instance) => instance.vote(2, {privateFor: ["BULeR8JyUWhiuuCMU/HLA0Q5pzkYT+cHII3ZKBey3Bo="]}))
# Check vote count for option 1
truffle(c)> SecretBallot.deployed().then((instance) => instance.getTotalVotes(1)).then((result) => result.toNumber())
0
# Check vote count for option 2
truffle(c)> SecretBallot.deployed().then((instance) => instance.getTotalVotes(2)).then((result) => result.toNumber())
1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment