# Secure Voting Website Using Ethereum and Smart Contracts
## 2 Blockchain  
Blockchain can assist in implementing an immutable, transparent, and efficient system that cannot be hacked. Because blocks cannot be changed or deleted, blockchain can solve the problems in the traditional voting system. Blockchain is a distributed network composed of many interconnected nodes. A centralized approach does not control the network. If most nodes agree, the transaction allows users to be anonymous. Whenever there is a need for transparency and decentralized authentication and identification of users, we use blockchain. The transactions in a blockchain network are encrypted. In simpler words, blockchain is a shared database [15; 16]. Core components of Blockchain Architecture:  
* Node: Each user in a blockchain network is a node. A copy of the distributed ledger is shared with all the blockchain network nodes. * Transaction: is the foundation of blockchain. In a blockchain, transaction details (asset, price, and ownership) are recorded and verified across all nodes. * Block: numerous blocks in the blockchain network store information such as the hash of that block. Figure 1 represents blocks committed in a ledger with their hash Id. * Chain: blocks in a specific order. Blockchain ensures these blocks' order by storing the previous node's hash in the current node. * Miners: nodes that perform complex blockchain operations are responsible for verifying whether a transaction is valid. * Consensus: Blockchain follows some algorithms to reach an agreement among nodes participating in a transaction. It's proof of work. Some common terminologies in a blockchain are:  
1. Smart Contract: Smart contracts are a simple logical bit of programs stored on each block of blockchain that run when some conditions are proper. They follow \"if/when... then...\" statements written on the blockchain and help automate the verification of parties' agreement. Automated execution of an agreement is done with the help of smart contracts; it ensures that each participant can be sure of the transaction's outcome. The irreversibility and traceability of these transactions increase the trust of the nodes in the network. Some advantages of smart contracts are making faster and better decisions, saving time, and lowering cost and risk. 2. Wallet: Wallet is a collection of user identities. It allows users to store and manage their Bitcoin, Ether, and other cryptocurrencies. 3. Truffle: It's a blockchain development environment. It also provides a testing framework and asset pipeline for Ethereum. We have used Ganache, which provides 10 Ethereum test accounts with 100 ETH. Blockchain in Voting SystemBlockchain technology makes implementing e-voting more affordable, simple, and secure. This system ensures data integrity, availability, and fault tolerance by having a decentralized system. Computers(nodes) connected in a decentralized network are blockchain systems. Each node has a complete record of all the transactions on the network and validates all the transactions. They form blockchains, which are ledgers in which digital data is linked. Blockchain records are essentially unchangeable [17]. Benefits of the E-voting system over the current system:  
* User Participation: In blockchain-based voting systems, voting can be done anywhere and on any internet device to increase user participation. It is beneficial for disabled users. * User Motivation: By having a fair election, user motivation and trust in the voting system increase. * Security: It is decentralized and uses hashing functions to secure transactions. We need more than 50 affected nodes for a blockchain to be insecure. Figure 1: Blocks committed in a ledger. * Efficiency: In traditional e-voting systems, there is still some paperwork involved, so by using a blockchain-based e-voting system, the cost is significantly reduced, increasing the efficiency of election management. * Precision: There are no errors (or) miscalculations of votes in blockchain-based voting systems. So the results are accurate and timely. It also provides proof of vote to every voter.