I understand that every transaction is visible on the blockchain but would it be possible to create a DApp that allows people to vote in disguise? not showcasing their vote till the votingprocess is over?


You are looking for commitment schemes. Generally a commitment scheme has two phases: commit and reveal phase. A simple commitment scheme is the following:

  1. Commit phase: if Alice wants to commit to a value x, she has to generate a random r (let's say r should be more than 100bits) and send H(x||r), where H is a cryptographically secure hash funciton and || stands for concatenation). Since H is cryptographically secure, it is computationally infeasible to find a preimage of H(x||r) (i.e. it has a negligible probability). This property is called computational binding. This property ensures that no one (not even Alice) can alter Alice's commitment value x.
  2. Reveal phase: Alice reveals her choice x' and r'. Bob checks whether H(x||r)==H(x'||r'). If it matches then accept, otherwise reject.

Other more elaborate commitment schemes could be built using the discrete log problem.

  • Let's say I have 5 people placed in hot chairs and they need to vote 'yes' or 'no'. All but one individual places the vote 'yes'. After x amount of time, I want those votes to be visible and not till then. – NemesisChain Sep 27 '17 at 14:14
  • Well, you need to reveal all of them, otherwise you won't be able to tell which one is 'yes' or 'no'. Just looking at the commitments you can not distinguish between votes. That is the point of commitments... – István András Seres Sep 27 '17 at 14:18
  • Oh yeah, sorry maybe i worded it wrongly that was perfectly clear to me. What I meant was that the votes should not be decryptable untill revealed. Once a vote is commited it should stay secret till revealed and then everything commited is revealed at once. I think using commitment schemes might be the way to go in my case then – NemesisChain Sep 27 '17 at 14:25

This is possible, but not directly. The most simple way would probably to store the hash of the single vote for each voter. You can use the hash property hiding to hide the vote: If you have possibilities "Yes" and "No", each voter appends a random secret string to either "Yes" or "No" and uploads the hash of the resulting string. That way, the hash does not reveal the vote, until the voter reveals the secret appended string and his vote. If revealed, everyone can confirm that the vote was not altered by checking the hash.

A more sophisticated solution can be build with homomorphic encryption. That removes the need for each user to reveal the secret after the vote has ended, but is a little bit more complicated.

So in the end it depends on you application.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.