Implementation of Secure Voting System using Blockchain

Download Full-Text PDF Cite this Publication

Text Only Version

Implementation of Secure Voting System using Blockchain

Dipali Pawar, Pooja Sarode, Shilpa Santpure, Poonam Thore Department of Computer Engineering

JSPMs Imperial College of Engineering and Research Pune, India

AbstractIt is very challenging to build a secure voting system that offers fairness and privacy of current voting schemes. In this implementation paper, we evaluate an application of blockchain as a service to implement distributed electronic voting systems. Our objective is to provide a decentralized architecture to run and support a voting scheme that is open, fair, and independently verifiable. Our proposed solution implements the protocol which achieves fundamental e-voting properties as well as offer a degree of decentralization and allow for the voter to change/update their vote and the experimental result shows that our proposed solution is beneficial for the existing and upcoming voting system.

Keywords Blockchain; Cryptocurrency; SHA-3; E- Voting; Decentralized.


A fair and Transparent election is need for today's society according to the today's social environment. The current ballot system does not offer transparency in counting of votes. There are several threats of voting frauds, like fake voters, frauds in the polling booths etc. So, this need for establishment of secure decentralized fraud less, voting system came into existence. Decentralized voting system using blockchain can overcome all the issues in traditional voting systems. Blockchain provides various properties due to its decentralized ledger technology. Blockchain is a decentralized computational and information sharing platform which enables multiple authority domain who do not trust on each other but they cooperate and collaborate in certain decision making process. Blockchain uses add and append only strategy. We cannot delete the existing data in blockchain. Blockchain uses peer to peer network systems. Blockchain is a chain of blocks and it include all the information of user through distributed ledger technology. The concept of block interconnection was evaluated from Merkle tree by Ralph Merkle. Every node is labeled with a cryptographic hash of a block data. Thereby a non-leaf node is labeled with a cryptographic hash of labels of child nodes.As all the blocks are connected to each other,any change in blockchain can be easily detected.

To carry out a national election certain e voting system should ensure many of the security requirements.

Prof. Pravin Nimbalkar

Department of Computer Engineering

JSPMs Imperial College of Engineering and Research Pune, India

They can be listed as voting system should not be traceable The voting system should ensure whether the voters vote was counted & proof of vote should be provided.Voting system should not enable single entity to control systems. Only eligible individuals are allowed to participate in voting. The Election system should not be expensive. Depending on the role election system should provide limited access to participants.The use of blockchain Technology in E-Voting system can meet all the above needs as a blockchain is tamper proof and non- alterable.

Fig 1: Blockchain

    1. Key features of Blockchain :

      • High Availability

      • Verifiability

      • Transparency

      • Immutability

      • Distributed Ledgers

      • Decentralized

      • Enhanced Security

    2. Modules of Voting System

Typically it consist of two models :

  1. The Administrator Module

    The Administration module is made for the authorized person or admin of the organization. Admin has ability to handle the every function of the voter and the Candidate.The Admin can perform the functions such as Insertion of the name, Deletion of the name, updating the name and the authority to carry out the voting procedure.Admin will able to see if someone tampered the vote and he will take necessary action against it.

  2. The User or Voter Module

    In this module User or voter will able to see the names of all electing Candidates and vote the candidate.


      In proposed blockchain system we used ECC cryptography to provide security in the system. ECC cryptography contains a key pairs of two parts: (i) public key and (ii) private key. The public key is shared among everyone where anyone can view all the public details in the network. It is strongly tied with the private key for security purposes. These keys are helpful for encryption and decryption process. A private key is similar to a password and is linked with a public key. Private key is not publicly available to everyone and is not shared with anyone in order to provide security to an account. It is kept secret and known only to the account holder. The private key is used to provide authenticity actions for accounts. Unlike with normal account, to access and know the account details, or to take any important action, one must use the private key at the receiver end which is known to receiver only so that security can be provided to an account using ECC algorithm. In the graphic below one can see how public key and private key pairs work, when sender is sending a message to receiver. Initially the sender encrypts the message with the public key of the receiver and then sends encrypted message to the receiver safely, on the other side when this encrypted message reaches to the receiver then the receiver receives this message and decrypts that using the private key of the sender which is known to receiver only. In this way security is provided to the message using ECC cryptography.

      Fig 2: Public and Private key Encryption and Decryption process


      In this system we have used decentralize network in order to store voting data in the form of blocks. Blocks are interconnected with each other to creating the chain of voting records. In the proposed system the blockchain is used for security purpose and also we have created different levels of trusted contacts. If the higher authority allows the data to get stored in blocks then only it will be store in the blockchain database. Once the data gets stored it cannot be tamper as blockchain is so much securated. The blocks will contain the information as : username, previous hash value, timestamp.

      The block is one transaction of blockchain, which will broadcast in the whole system when it gets verify. Whenever new block is authenticated by the system, block is added at end of the blockchain with help of hash value and this structure is looks like LinkedList. This sequence of blockchain goes on increasing as the blocks get added. The primary block in the blockchain is called as the Genesis Block. It has value as zero for previous block because genesis block does not have any previous block. The next block will have the hash value of the previous

      block and this way the process of adding blocks in the system take place.

      Fig 3 :Use Case Diagram

      Fig 4: Data Flow Diagram


      The algorithms for processing our proposed work are as follows.

        1. ECC(Elliptic Curve Cryptography) Key Pair Generation:

          from Crypto.PublicKey import ECC key= ECC.generate(curve='P-256')

          private_key=key.export_key(format='PEM') print(private_key) public_key=key.public_key().export_key(format="PEM") print(public_key)

          This will give 256 bit key pair which is of PEM(Privacy Enhanced Mail) format.

        2. SHA3_256,DSS algoritm:

      SHA(Secure Hash Algorithm) is used for generating hash value. It is better than MD5 algorithm because when hash value generated from data using SHA it is not possible to get original data from that. SO it is secured.

      DSS(Digital Signature Standard) algorithm is used to create signature for security purpose.

      from Crypto.Hash import SHA3_256 from Crypto.PublicKey import ECC from Crypto.Signature import DSS try:

      priv_key =ECC.import_key(private_key_input) hash_string='utf-8')) signature=,'fips-186-3').sign(hash_string) print('\n signature: ', signature.hex())

      public_key= ECC.import_key(request.user.user_public_key) verifier =, 'fips-186-3') verifier.verify(hash_string, signature)

      status = 'The ballot is signed successfully.' error = False

      except Exception as e:

      status = 'The key is not registered.' error = True

      print("not matched") print(e)

      messages.warning(request, str(e))

      return render(request, 'create_vote.html)

      5.3 Merkle Tree:

      Merkle tree is a fundamental part of blockchain technology. It is a structure that allows for efficient and secure verification of content in large body of data. This structure helps to verify the consistency and content of the data.

      import datetime

      from uuid import uuid4

      from Crypto.Hash import SHA3_256 from Crypto.Signature import DSS from django.conf import settings from django.contrib import messages

      from django.contrib.auth.decorators import login_require import time

      from ballot.merkle.merkle_tool import MerkleTools def seal(request):

      if request.method == 'POST':

      ballot = request.POST.get('ballot_input') vote_id = request.POST.get('vote-id') ballot_byte = ballot.encode('utf-8'


      # Puzzle requirement: '0' * n (n leading zeros)

      puzzle, pcount = settings.PUZZLE, settings.PLENGTH nonce = 0

      block_transactions= Vote.objects.filter(id=vote_id).order_by('timestamp')

      # create Merkle hash

      root = MerkleTools()

      root.add_leaf([str(tx) for tx in block_transactions], True)


      merkle_hash = root.get_merkle_root()

      # Try to solve puzzle

      start_time = time.time() # benchmark

      timestamp = _get_timestamp()

      # mark the start of mining effort

      # get prev hash from prev block prev_hash = get_prev_block_hash() while True:

      block_hash ="{}{}{}".format(ballot,nonce,


      print('\ntrial hash: {}\n'.format(block_hash)) if block_hash[:pcount] == puzzle:

      stop_time = time.time() print("\n block is sealed in

      {} seconds\n".format(stop_time – start_time)) break

      nonce += 1 block=

      Block(prev_h=prev_hash,block_hash=block_hash, nonce=nonce,merkle_h=merkle_hash,timestamp=timestam p)

      # create block object

      context = {

      'prev_hash': prev_hash, 'transaction_hash': ballot_hash, 'nonce': nonce,

      'block_hash': block_hash, 'timestamp': timestamp,


      return render(request, 'seal.html', context) return redirect('/vote/')


      After implementing the project, the generated output is

      shown below.

      Fig 5 : Admin Panel

      Fig 6 : Voters Login Form

      Fig 7 : Voters Registration Form

      Fig 8: Voters Home Page

      Fig 9 : Ballot Creation Page

      Fig 10 : Transaction Page

      Fig 11 : List Of Blocks


Nowadays,Blockchain technology is used in various fields.It is gaining more popularity day by day.As a result with the help of blockchain, voting system needs to be more secure,advanced and reliable.This application will provide transparency and cost-effective election by guaranteeing the privacy of voter.Encryption is used in the system.No votes are tampered in the system,it will detect the tampered votes and resolve it.This leads to achieve transparency.The main reason behind this system is to present an idea of implementation of blockchain in voting system.


  1. Cosmas Krisna Adiputra, Rikard Hjort, and Hiroyuki Sato, A Proposal of Blockchain-based Electronic Voting System , Dept. of Electrical Engineering and Information Systems.Artis Mednis, Girts Strazdins, Reinholds Zviedris, Georgijs Kanonirs, Leo Selavo, Real Time Pothole Detection using Android Smartphones with Accelerometers.

  2. Fridrik P. Hjálmarsson, Gunnlaugur K. Hreidarsson, Mohammad Hamdaqa, Gísli Hjálmtýsson,Blockchain-Based E-Voting System .Available:

  3. Ali Kaan Koc,Umut Can abuk,Emre Yavuz ,Gokhan Dalkoloc,Towards Secure E-Voting Using Ethereum Blockchain.Available at:

  4. Henry Rossi Andrian, Novianto Budi Kurniawan, Suhardi,Blockchain Technology and Implementation : A Systematic Literature Review.2018 International Conference on Information Technology Systems and Innovation (ICITSI) October 22-25,2018.

  5. Ashish Singh,Kakali Chatterjee, Secure Electronic Voting System Using Blockchain Technology,2018 International Conference on Computing, Power and Communication Technologies (GUCON) Sep 28-29, 2018.

  6. Prakash K. Ukhalkar, Dr. Rajesh N. Phursule , Dr Devendra P Gadekar, Dr Nilesh P Sable. (2020). Business Intelligence and Analytics: Challenges and Opportunities. International Journal of Advanced Science and Technology, 29(12s), 2669-2676

  7. Nir Kshetri and Jeffrey Voas,Blockchain-Enabled E- Voting,https://Blockchain%20Papers/kshetri2018.pdf.

  8. ]Basit Shahzad and Jon Crowcraft,Trustworthy Electronic Voting Using Adjusted Blockchain Technology.

  9. Tareq Ahram,Aman Sargotzaei,Saman Sargotzaei,Jeff Daniels,Ben Amaba,Blockchain technology Innovations.

  10. Rishav Chatterjee,Rajdeep Chatterjee,An Overview of the Emerging Technology:Blockchain.Available at:

  11. Christopher G.Harris,The Risks and Challenges of Implementing Ethereum Smart Contracts.Available at:

  12. H Halpin,M Piekarska,Introduction to Security and Privacy on the Blockchain, 2017 IEEE European Symposium on 2017 –

  13. Sable Nilesh Popat*, Y. P. Singh, Efficient Research on the Relationship Standard Mining Calculations in Data Mining in Journal of Advances in Science and Technology | Science & Technology, Vol. 14, Issue No. 2, September-2017, ISSN 2230- 9659

  14. Dipali Pawar, Pooja Sarode, Shilpa Santpure, Poonam Thore, Prof. Pravin Nimbalkar, Secure Voting System Using Blockchain, Department of Computer Engineering, JSPMs Imperial College of Engineering and Research Pune,India.Available: using-blockchan

Leave a Reply

Your email address will not be published. Required fields are marked *