How to create a system of e-voting on the blockchain?

In the last article we talked about the data exchange system, built using blockchain technology. The successful experience encouraged us to create another product using this technology – voting system. In this article we describe the implementation details of the system.

the

why we need a blockchain voting system?


The vote as a decision-making process on important social issues, is known to mankind for thousands of years. There was a time when decisions were made by a narrow circle of persons authorised by throwing colored balls in a special amphora or by gesture. However, the population grew, the society has developed and in the process of decision-making began to participate more and more people – hundreds of thousands and even millions. Then in place of such simple methods of counting the votes came more complex: they created the polls, amphorae were replaced by ballot boxes, and balls on the ballot. Although this approach to voting has allowed to consider the opinion of the vast masses of the population, it has several drawbacks:

the

    Technical: the possibility of ballot stuffing; the use of vanishing ink on the areas to falsification of results; falsification of records; violation of the secrecy of voting; deliberate error in the calculations; low speed calculation of results.

    Social: bribery ("carousel", etc.); administrative pressure on voters.

    Cost: the high cost for the state budget. For example, the 2015 elections in Russia cost almost 100 000 000$.



Some of the described problems solve e-voting system (applicable in countries such as India, Brazil, Estonia, Netherlands, USA and Germany), although their use also carries a number of disadvantages:

    the
  1. security Problems (electronic system can be hacked, often related scandals)
  2. the
  3. problems with the verification of election results (unlike paper ballots that can be counted)
  4. the
  5. Possibility of incorrect operation of the system because of errors

In this context, electronic voting devices and electronic voting itself did not become a worldwide practice. Moreover, many countries (Netherlands, UK, Germany), which initially e-voting is widespread, eventually restricted their use because of imperfections in technology and returned to a more robust analog to the method of voting.

However, the development of technology and society is pushing humanity to the search for cheaper and more reliable voting methods. The use of blockchain technology in the voting can solve most of the problems of the existing electoral systems.

The core of the technology lies in the blockchain transactional model: each user has a wallet, with a unique public and private keys, which he confirms any change to the data. All information about transactions is stored in a sequentially written blocks, so a hash of the previous block is included in the following data. This ensures the immutability of data – change any block will automatically make invalid all subsequent. The blockchain stores all the information about all transactions in full at the same time on all nodes, and it cannot be changed or deleted. The most widely used blockchain found in the field recording data on movement of property rights for some digital objects this idea is based all modern cryptocurrencies. These objects, usually called "coins" or "tokens" that can either be generated automatically according to a predetermined algorithm, the operation of the system ("Melnitsa") or be produced with the right member of the system.

The idea of using the blockchain in the system of voting suggests itself: the blockchain allows you to replace the old technology of voting by passing someone of their vote, expressed physical object (the ball of the right color, paper newsletter, etc.), for the transmission of digital token. In this case, as in many other cases, the transition of the business process from the physical world to digital, dramatically reduced transaction costs and increased system availability. In addition, the use of the blockchain provides additional benefits:
    the
  1. the integrity of the results. The results of the voting, organized with the use of blockchain technology, it is impossible to forge. You can always check how many votes was released in early voting, how they were distributed on the purses and what time was the transaction
  2. the
  3. the transparency of the process. The blockchain enables monitoring of the voting process, as any interested person may expand with a full copy of all data and to perform them at the level of the blockchain.
  4. the
  5. Anonymity. Each voter has the opportunity to create a public and private key on the local machine and no one but he will not know that a particular wallet belongs to him. Thus, one cannot know how to vote this party, except when the participant announced that the wallet belongs to him.
  6. the
  7. the Speed of data processing. The vote in the city, region, country or Corporation with offices in different countries can be associated with considerable costs and organizational difficulties and time losses – both for voting and for data processing. Decentralization will allow you to see the results of the vote across the country as a whole, despite the fact that each region/city/district can operate its own node system to distribute the load.

Before us there were attempts to implement a voting system on a blockchain, but the wide distribution they received. In our opinion, is associated with a number of reasons:

    the
  1. Many existing projects are based on a developed platform like Ethereum or Bitcoin. Although in recent years the exchange rate of the cryptocurrency is very volatile, the same Air is impressively increased in comparison with the beginning of the year, making a vote based on this platform are quite expensive.
  2. Most of these systems use a proof of work algorithm, making the computation of results in large-scale voting is very slow (details of the above described problems SDAs:
    the

  3. They are moving exclusively as an independent platform for voting (i.e. voting or participation in it, you must go through an explicit registration process in the platform).
  4. the
  5. Most of them remained at the level of ideas or ceased to grow

the

About the voting process


Voting in our system is a transaction. Each of the options for which you can vote is your wallet, on which the participants vote (each of which also has a purse), translate golosovaniya tokens. For each vote is issued a unique token, so the token is issued, for example, to vote on your favorite tea, you can not vote for the construction of the Parking lot instead of a Playground.

In the final version of the application we want to implement different types of votes: majority (decision to be taken by a simple majority), alternative (select a few options from the offer) and rating (each option is assigned a specific "weight" depending on his preference). They can be public (can connect anyone) and closed (to participate you need an invitation). Areas in which such a vote may be useful, can be very different: the election of the head of the HOA, voting on any competition, a vote for the decision under joint-stock companies, etc.

At the prototype stage we decided to limit the majority scenario of voting for an open circuit. This is done to demonstrate the capabilities of the platform and to understand how this topic is interesting to the public and business.

In the prototype creation process of voting consists of several stages:

    the
  1. the User registers in the system and on the local machine generates a key pair of the purse. The system asks the user for the code word and the data it encrypts the wallet, and then stores the encrypted wallet on the same blockchain, in order to relieve the user from having to install specialized software wallet. At the same time, the purse in the open is processed only on the client side that ensures the availability of access only purse his master. However, it is important to understand that the loss of code words, the user will lose access to your wallet, and in this case to help him would be impossible.
  2. the
  3. Cost of creating the voting system is 1IDV. Thus, when a user creates a vote, the system will check the balance and, if sufficient funds, debits 1 token and prepares voting: creates purses for voting and emits a number of unique golosovali tokens. The results of creating a vote (whether it was created successfully, if not, why) are recorded in a special log which is also stored in the blockchain.

When the user wants to take part in the voting, the following occurs:

    the
  1. It selects the desired vote from the General list and request permission to participate in it.
  2. the
  3. , the System checks whether the user can participate in the vote and, if so, shall calculate a unique token of this vote.
  4. the
  5. User votes for one of the options, then the system will check whether the user can vote and if so, groovelily token is transferred from his wallet to the purse of the selected voting option.

The verification of the voting results is possible in several ways. First, the profile of each participant has the option “My Transactions”, where you can see all transactions since the creation of the wallet. Second, in the list of polls you can go to the specific screen of the ballot and details of voting is to find the transaction from your wallet to the wallet of the option chosen. Thirdly, there is always the possibility to deploy a Read only node and to verify the results and the system at block-level.

the

a Bit about the selected technology


Before we talk about the technological component of the project, note the following: the main objective of the project, we see the provision of convenient means for embedding a reliable voting on the blockchain the platform to any third-party application. That is why we pay special attention to the development of user-friendly API. Of course, we will give private customers to vote, but we develop them in the first place to demonstrate the capabilities of our platform for voting. Below we consider the technological side of the project.
As in past projects, we took Mulitchain blockchain. We proceeded from the following considerations:

    Security. One of the vulnerabilities of the majority of blockchain systems lies in her dignity of anonymity. When anyone can deploy any number of writing nodes, there is a risk that he will deploy 51% of the total number of nodes with changed information and the other nodes will take her to record, because it will be the longest block chain. This is called a 51% attack. To prevent such attacks in the most public of algorithms algorithm confirm Proof of Work — every node solves a difficult math problem, for which he receives a fee ("mines coins"). The solution of the problem requires time and considerable computing power. It makes this kind of attack is too expensive and impractical. The main feature of Multichain is that it is specially created for the blockchain on the principle of the consortium, i.e. to a limited circle of persons who know each other, i.e. not anonymous. In our implementation all the nodes that connect to the block chain, which by default are Read only nodes. That is, they store all the data, but does not have rights to write new data. To be eligible for entry, the node must obtain the appropriate rights from the Master node. Thus, we will ensure the entry of new data into the system only authenticated nodes and will reduce the risk of fraud. At the same time, Read only the nodes get the full copy of the blockchain data and can analyze the data on the voting on the consistency.

    Resource. As noted above, in applying the algorithm Proof of Work requires significant processing, and with the growth in the number of users and time resources. To solve this problem, we abandon the algorithm Proof of Work in favor of Proof of Authority, in this case we give the right to write information only to identify yourself to the nodes. Thus, the new information gets into the blockchain much faster and the "price of entry" becomes the minimum.


Let's look at the technical part in details. Block diagram of the voting are as follows:

The structure of the system is divided into 3 segments:

UI – the end user applications that connect to public REST API (Common Area segment) or directly to a read node of the warhead (not shown). In the prototype to demonstrate the functionality we have implemented the UI of web site as a SPA in Angular. Anyone can implement your UI on any available technology, using our REST API or Read only node Multichain as a data source.

Common Area is the N system nodes, which are deployed Multichain recording and Web server API.

REST API web site, written in ASP.NET Core 1.1. Implemented to work with the metadata of the vote, the archive metadata by the voting process (the choice of variant and return of the votes for it) and a purse. Detailed description of the API can be viewed here.

Private Area – restricted access (write) part of the system, which includes the processing server and the authorization server users.
In the proprietary part we have learned, the processing server and the authorization server users:

Processing Server

Implemented as well as Common REST API APS.NET Core 1.1. The prototype is responsible for:
the
    the
  • Charging IDV tokens for user registration (for payment created voting)
  • the
  • Create a vote
  • the
  • state Management vote (for the opening and closing according to the specified conditions)
  • the
  • Charging user golosovali tokens.

All actions performed by the processing server, written in Multichain. Therefore, any node (including the reader) can these steps to see.

Identity Server

The server identifying users of the system. Implemented on ASP.NET Core 1.1 by using the IdentityServer 4.

Features:

the
    the
  • user Registration;
  • the
  • user Authentication;
  • the
  • Authorization;

The user profiles are stored also in the Multichain encrypted.

the

Limitations of the prototype


Our system is developed to conduct polls and surveys of various types. However, to demonstrate the capabilities of the prototype, we decided to limit the script is simple majority voting with an open list of participants, i.e. to such a vote that anyone can join. Therefore, in this article we will not consider scenarios of inviting people to participate in a closed voting, rating and alternative voting. Also in the prototype we did not implement strict authentication mechanisms. This was done deliberately, with the aim that anyone was able to try them.

the

Prototype


To see the prototype and test the creation of the voting here. If you want to deploy a Read only node — contact us via the form on the website — we will send you instructions how to do it.
Article based on information from habrahabr.ru

Комментарии

Популярные сообщения из этого блога

Integration of PostgreSQL with MS SQL Server for those who want faster and deeper

Custom database queries in MODx Revolution

Parse URL in Zend Framework 2