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:
- Commit phase: if Alice wants to commit to a value
x, she has to generate a random
rshould be more than 100bits) and send
His a cryptographically secure hash funciton and
||stands for concatenation). Since
His 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
- Reveal phase: Alice reveals her choice
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.
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.