Course Content
Blockchain Series #1
About Lesson

Welcome to this brand new course about blockchain. In this course, and in the upcoming ones, we will make you familiar with everything you need to know about blockchain. We will also teach you some of the latest blockchain coding skills so that you can enter the fascinating world of decentralized applications.

In this video, we will learn about simple vote smart contract. The Voting smart contract provides a simple and decentralized way to conduct voting on the Ethereum blockchain. It maintains two important mappings: hasVoted and voteCount. The hasVoted mapping keeps track of whether an address has already cast a vote, preventing duplicate voting. The voteCount mapping stores the number of votes received by each candidate, with the candidate’s name being the key. The contract exposes a vote function that allows users to cast their vote for a specific candidate by providing the candidate’s name as an argument. The function verifies if the sender has not already voted before incrementing the vote count for the specified candidate and marking the sender as having voted. This smart contract enables transparent and immutable voting processes, where the votes are securely recorded on the blockchain and cannot be altered or tampered with.

Github Repository:

Join the conversation