January 21, 2026

Capitalizations Index – B ∞/21M

How it works – Jackson Ng –

How it works – Jackson Ng –

To do so in Remix, switch back to the Chairman’s wallet account and press [countVote]. The contract will not allow anyone other than the contract creator (which is the chairman) to execute this step.

Once counting is done, results are released and the contract’s state becomes 2 which means that voting has ended.

How does the Ballot contract implement the principles of voting?

Secret Ballot

In the ballot contract, only wallet addresses and names are stored. Every voter is identified by their MetaMask wallet address. Other than the chairman who was the person who created the new instance of the ballot contract, no one else can tell who voted yes or no. For the technical folks among us, I meant to say that the votes array is declared private so no one can read the contents of the votes array.

OK, the truth is a little more complicated than this. On a Blockchain, even private variables are readable if you try hard enough, as explained here. For this to truly be private, users of the contract will need to encrypt the values before writing them to the smart contract.

One man one vote

The voters array stores a list of voters who have voted. It ensures that no one can vote the second time. Once a voter votes, his status changes to “voted” and the ballot contract checks to ensure that he does not vote again.

Voter eligibility

Voter eligibility is determined by assembling a voters’ array of wallet address before voting begins. You need to vote with your MetaMask Wallet whose address matches the one that the chairman registers before voting begins.

Wait a moment, doesn’t that mean that someone who have stolen my MetaMask wallet will be able to vote on my behalf! That’s correct, on a Blockchain, the only thing that separates you from an identity thief is your wallet’s private key.

But how does the chairman ensure that it’s really me who’s casting the vote? Facial recognition? That’s definitely a possibility — build a ballet app to allow the wallet to be unlocked to vote only if you pass a fingerprint or facial recognition test will work.

Transparency

This is one of the things that Blockchain does extremely well. Every action taken and every record etched on the Blockchain is immutable. On a public Blockchain, collusion is close to impossible as described here.

Votes accurately recorded and counted

In the ballot smart contract, the ballot goes through several states, from the point it is created, open for voting to the point where ballot is closed and votes are counted.

In each of these states, the contract dictates what the chairman and voters is allowed or not allowed to do. For example, the contract does not allow voting to start until the chairman kick-starts the voting process. It does not allow the chairman to stuff the voting box with new voters once voting begins.

Reliability

There is no single point of failure on a Blockchain as every node participates in keeping the Blockchain running. A smart contract, once deployed on the Blockchain is immutable. The business logic of the smart contract once deployed is cast in stone. There’s no way the chairman can change the rules, say, from a one man one vote to one man two vote once the contract is deployed.

In fact, the source code to the smart contract can be published for everyone to inspect. Don’t participate if you do not like how it is coded!

What’s Next?

In the next part, I will walk through ballot.sol, the smart contract for the balloting process.

Icons made by Freepik from www.flaticon.com is licensed by CC 3.0 BY
Icons made by Smashicons from www.flaticon.com is licensed by CC 3.0 BY

Published at Sat, 27 Apr 2019 10:52:21 +0000

Previous Article

Bitcoin Bulls Drive $20 Million into New York-based Crypto Trust

Next Article

Bitcoin To Bank Exchange Bitcoin To Bank Account instantly

You might be interested in …

Ox fina (ox) price alert, chart & news on bitscreener. Com

OX Fina (OX) Price Alert, Chart & News on BitScreener.com

OX Fina (OX) Price Alert, Chart & News on BitScreener.com More detail: https://bitscreener.com/coins/ox-fina OX Fina (Symbol: OX) is an autonomous, decentralized and democratic organization that exists on blockchain as a series of smart-contracts. OX Fina […]