How I Built My First Smart Contract: A Simple Voting App in Solidity

I’ve just started learning Solidity to become a smart contract developer and to finally improve my coding skills. This post shares my first project — a simple voting app written and deployed using Remix. Project Summary Users can vote for a candidate. Each wallet can vote only once. Votes are stored on the blockchain. Smart contract written in Solidity 0.8.x Key Features struct Candidate { string name; uint voteCount; } We use an array of candidates and a mapping to prevent double-voting. require(!hasVoted[msg.sender], "Already voted!"); This line ensures no address can vote twice. What I Learned Solidity types and structures Basic contract deployment on Remix Using constructor() for initialization Importance of access control and validation What’s Next I plan to: Add a simple frontend (React + Ethers.js) Move to Hardhat for testing and local dev Explore how elections are built in real DeFi protocols

May 29, 2025 - 18:00
 0
How I Built My First Smart Contract: A Simple Voting App in Solidity

I’ve just started learning Solidity to become a smart contract developer and to finally improve my coding skills. This post shares my first project — a simple voting app written and deployed using Remix.

Project Summary

  • Users can vote for a candidate.
  • Each wallet can vote only once.
  • Votes are stored on the blockchain.
  • Smart contract written in Solidity 0.8.x

Key Features

struct Candidate {
string name;
uint voteCount;
}

We use an array of candidates and a mapping to prevent double-voting.

require(!hasVoted[msg.sender], "Already voted!");

This line ensures no address can vote twice.

What I Learned

  • Solidity types and structures
  • Basic contract deployment on Remix
  • Using constructor() for initialization
  • Importance of access control and validation

What’s Next

I plan to:

  • Add a simple frontend (React + Ethers.js)
  • Move to Hardhat for testing and local dev
  • Explore how elections are built in real DeFi protocols