You are on the right track with this question. It needs to be open source, as well as decentralised. It needs to be possible for anyone to audit it, and also provide privacy. I have heard of projects moving in this direction, some look fairly good (can't remember what it was called right now). The last I heard about it was that it needs to grow through grass roots usage. So before it is ready for a highly publicised national election with tons of contention, it needs to be good enough for your school board election, or in your clubs, or gatherings. Then, as it gains awareness and proven stability, it can grow to larger and larger elections. Its not that it can't be done, its that nothing has established itself, yet.
I could imagine something where each citizen gets their digital ballot, and then for the election, submits their voting ballot for their candidate. Their entry is completely private, yet viewable by them. And, everyone can see their vote selection.