scieee AI-readable full text Open interactive document viewer

Platform for expressing the opinion of citizens through e-voting based on blockchain

Slaina Nasty, Mircea

Abstract

As the electoral system is an essential element for the survival of democracy, this paper aims to research different implementations of blockchain e-voting systems, but also to develop one that is convenient, reliable, transparent, and secure. Considering all the security problems that might occur using current technologies, it is difficult, not to say impossible, to develop an impenetrable system as every component may be a potential failure point and exposed to malicious external or internal attacks. This paper presents an e-vote system based on blockchain - the state of the art, the architecture of my solution, technologies used and the first stage of the product. This solution is responsible for ensuring the accuracy, the privacy, the verifiability, the convenience, and the democracy of a large-scale electoral process. In this work we develop an application that integrates NEAR Blockchain Platform to be able to highlight the problems that may arise using an e-voting system based on blockchain technology

Full text

Master thesis Master in Innovation and Research in Informatics (MIRI) Platform for expressing the opinion of citizens through e-voting based on blockchain REPORT Author: Slaina Mircea-Nasty Director: Felix Freitag (DAC - DSG) Supervisor: Alina Nirvana Popescu (UPB) Date: 01/07/2022 1 Abstract As the electoral system is an essential element for the survival of democracy, this paper aims to research different implementations of blockchain e-voting systems, but also to develop one that is convenient, reliable, transparent, and secure. Considering all the security problems that might occur using current technologies, it is difficult, not to say impossible, to develop an impenetrable system as every component may be a potential failure point and exposed to malicious external or internal attacks. This paper presents an e-vote system based on blockchain - the state of the art, the architecture of my solution, technologies used and the first stage of the product. This solution is responsible for ensuring the accuracy, the privacy, the verifiability, the convenience, and the democracy of a large-scale electoral process. In this work we develop an application that integrates NEAR Blockchain Platform to be able to highlight the problems that may arise using an e-voting system based on blockchain technology. 2 Report Contents 1 Introduction 5 1.1 Motivation ..................................................................................................................... 5 1.2 Problem statement ...................................................................................................... 6 1.3 Contribution ................................................................................................................. 7 1.4 Context .......................................................................................................................... 7 1.5 Thesis Outline .............................................................................................................. 7 1.6 Objectives and expected results ................................................................................. 7 1.7 Remarks and research plan ........................................................................................ 8 2 Background and Related work 9 2.1 Research questions ...................................................................................................... 9 2.2 State of the art .............................................................................................................. 9 2.3 Study case – the stage of fulfilling the international recommendations regarding electronic voting in Romania .................................................................................... 9 2.4 Related work ................................................................................................................ 11 3 Algorithms used in blockchain technologies 12 3.1 E-voting using blockchain ........................................................................................ 12 3.2 Hash encryption ......................................................................................................... 12 4 Usage cases 13 4.1 Identifying the use cases ........................................................................................... 13 4.2 Details of use cases .................................................................................................... 13 5 Architecture of the system 15 5.1 Schema of the system ................................................................................................. 15 5.2 Modules of the system ................................................................................................ 15 5.3 Implementation details ................................................................................................. 19 6 Technologies 22 6.1 NPM ............................................................................................................................. 22 6.2 Typescript ................................................................................................................... 22 6.3 React ............................................................................................................................ 22 6.4 Jest JS .......................................................................................................................... 23 6.5 NEAR ........................................................................................................................... 23 7 Security and testing 24 7.1 Concluding remarks .................................................................................................. 24 7.2 Attacking ..................................................................................................................... 25 7.3 Testing ......................................................................................................................... 25 8 Conclusions 25 8.1 Concluding remarks .................................................................................................. 25 8.2 Future work ................................................................................................................ 26 References 27 3 List of Figures 1 Communication module .............................................................................................................. 11 2 Blockchain structure for e-voting ....................................................................................... 12 3 Structure of a polling station .............................................................................................. 12 4 Encryption algorithm – hash computation ...................................................................... 13 5 Workflow summary .............................................................................................................. 15 6 Architecture schema. ........................................................................................................... 19 7 Creating a poll page. ............................................................................................................. 19 8 Listing polls page .................................................................................................................. 20 9 Login page in testing environment .................................................................................... 20 10 Transaction details of one account .................................................................................... 21 11 Transactions logs .................................................................................................................. 21 4 Report List of Tables 1 Research plan ......................................................................................................................... 8 2 Necessary conditions for e-voting and their fulfillment in Romania ............................. 9 5 1 Introduction 1.1 Motivation Electronic voting has been proposed for the first time since the 1960s, this method was initially designed to reduce the possibility of fraud in an electoral process, and then, due to increased Internet access, and to increase the number of citizens with the right to vote. elections, respectively, to allow citizens of the Diaspora of a country, or citizens who cannot travel to the polling stations, to vote. [1] Implementing an online voting system seems to be a challenge beyond the capacity of today's technology. The initial goal, the manual counting of votes, a thorough and vulnerable process, remains an ideal candidate for the digitization process. These ideas were the basis for the initiative to adopt electronic voting in several countries. Some of them held elections in which electronic voting systems were used, and others carried out research and testing projects on electronic voting systems but did not use them in real elections. Most of these experiments led to decisions not to use online electronic voting or electronic voting in polling stations. Electronic counting of votes is seen as the only reasonable candidate for the digitization process. There is an international consensus in the scientific community that international voting systems (expressed on the internet or in polling stations) are not resilient to systemic fraud and are vulnerable to cyber-attacks. The consensus is based on both security considerations and a cost analysis of implementation. [1] The main features of e-democracy are the dissemination of political information, e-voting and participation in e-decision making. So, when we try to categorize e-voting systems into one of the categories of e-government, it fits best in the G2C (Government-to-citizens) model. [13] The application that I intend to develop in this research topic will have, in addition to the existing ones, the possibility to see at a certain time the statistics regarding the percentage of the population that expressed their vote, but also about partial results. 6 Report 1.2 Problem statement The term "e-Voting" is the process by which an individual can express his option to vote electronically, while - given the ease of counting votes - also facilitates the production of statistics, all from the desire for automation. Given the context of voting in electronic format, the issue of the integrity of the vote is raised so that the elimination of fraud is sought, be it by buying votes, electronic attacks, social constraints, etc. The object of the mentioned research topic is the study of similar systems (articles) that propose implementation methods, but also technologies necessary to create an e-voting platform that meets the security requirements. According to [2], an e-voting system is considered secure if it cumulatively meets the following requirements: - Ensures accessibility and usability for all eligible voters - Assures the voter that his / her vote has been added correctly and successfully to the system - Provides techniques to prevent the association of an expressed vote with its identity - Defends the democratic values of the vote (single vote, anonymous, correctly expressed) - Independence from the platform used - The devices and technologies used must be publicly documented - Allow audit and evaluation by authorized persons - To be available for the entire duration of the electoral process - To ensure the verification of the identity of a voter, as well as the fact that he has the right to vote - The counting process must consider only the votes cast by eligible voters. Moreover, according to [3], an electronic voting system should be customizable, out of a desire to be reused for different types of elections. When we talk about e-voting systems on a large scale, in addition to the democratic values of voting, we must also consider the performance of the system. Thus, in addition to the verification, validation of votes and compliance with the legislation in force, there is also a need for modern infrastructure that can ensure the necessary storage capacity, back-up methods, but also the reduction of redundancy. It is also in this context that it must be borne in mind that several elections can exist at the same time, a strategy for resolving this situation considered. 7 1.3 Contribution The contribution is the development of an application based on blockchain to highlight the main functionalities of an e-voting system, the challenges in implementation and the maintenance of this kind of systems. Once implemented, we highlight the main challenges encountered and possible actions to be able to solve them. In the future (not implemented yet), the goal will be to scale the application to handle a real-world scenario with hundreds of thousands of users and multiple election processes at the same time – thus deploying it to a real-world environment. 1.4 Context The research topic is part of the field of electronic voting. Electronic voting or Internet voting means methods that use an electronic device connected to the Internet to record, count, or transmit votes. It can be used both for elections for political office and for democratic decisions, censuses, public opinion polls and more. One of the most important factors behind the development of an e-voting system is the preservation of a secret identity of the voter. Furthermore, another factor was the limitation of unintentional human mistakes that may occur, the organization of elections in an optimal way, the fight against fraud, but also the counting of votes quickly and accurately. [9] The questioning of the use of new voting techniques must be doubled, in addition to extensive research, practical testing given that electronic voting is not perceived as safe by the public, according to [10]. Thus, the voting process must be unequivocally considered democratic so that the result does not put the elections in suspicion. 1.5 Objectives and expected results The objectives and results set for this Master thesis are: - Studying similar systems / articles / proposing solving models - Studying the technologies needed to create an e-voting platform - Studying the ways of securing (specific algorithms) of electronic voting - Development of an application to demonstrate the effectiveness of these voting systems The expected results for this Master thesis are: - Development of an application with the following functionalities (preliminary): o The application will have a login mode o The voting options will be presented on the main page o A user will be able to vote only once o After voting, the page will be updated in real time with a possible display of the intermediate results - Analyzing possible ways of attacks that may cause malfunction of the e-voting process 1.6 Remarks and Research plan During the 4 semesters, the research plan is presented in the table 2. For each semester there is a goal to be achieved to have the agreed results at the end of the research period. The research for the first 3 semester was done at Polytechnic University of Bucharest and the 4th semester was researched at Polytechnic University of Catalonia. 14 Report o Actors: citizen, managing authority at local / regional and national level o Precondition: The application must be running; the user needs a web browser and internet connection. The web address of the application must be entered in the browser. o Postcondition: The user is authenticated and depending on his role he has access to specific functionalities o Success scenario: When accessing the address, the login page is displayed in which you are required to enter your username and password. The system verifies the data provided and redirects the user to the area of the application that corresponds to his role. • Use case: Visualization of the electoral processes in which he is enrolled • Actors: citizen, managing authority at local / regional and national level • Precondition: The application must run; the user needs a web browser and internet connection. The web address of the application must be entered in the browser. • Postcondition: The user is authenticated and depending on his role he has access to specific functionalities. • Success scenario: When accessing the address, the page with the existing electoral processes for which the citizen has access or which are managed by an authority is displayed • Use case: Apply for vote view • Description: The citizen will be able to fill in a form to be able to view his / her vote / voting history • Actors: Citizen • Precondition: The application must run, and the user (actor) must be logged into the system. • Postcondition: The request has been added to the system - it is to be processed • Success scenario: The citizen navigates to the page dedicated to this section, fills in a formula, then presses a button to be processed. • Use case: Adding a citizen in an electoral process • Description: Adding a citizen to an electoral process in the system database. • Actors: Management authority at local / regional level • Precondition: The application must run, and the user (actor) must be logged into the system. • Postcondition: A new user (citizen) has been added to the system - enrolled in order to be 15 able to express his vote, along with his data. • Success scenario: Managing authority at local / regional level navigates to the page of an electoral process that has not ended, uses the add user button, then clicks on a user - the data is filled in automatically. • Use case: Administration and generation of reports • Description: Users who manage the electoral process both locally / regionally and nationally will be able to export statistical data to generate reports. • Actors: Management authority at local / regional and national level • Precondition: The application must run and the user (actor) must be logged in to the system and have access to the data needed to generate a certain report. • Postcondition: The user selects the chart type • Success scenario: Generating the chart and exporting it in PDF format. The following diagram, figure 5, represents the workflow of the application, the mode of interaction between the actors, as well as the functionalities that underlie the development of the electronic voting system. Figure 5. Workflow summary 16 Report 5 Architecture of the system 5.1 Schema of the system To facilitate a way of developing, integrating, and implementing the mechanisms under a modular format (easy to extend), the application will be developed according to a web architecture based on REST services. To separate the application levels (e.g., View, Controller, services, etc.) and to respect the “Open / Closed” principle, the application was designed considering the principles of abstraction. Thus, we have components dedicated to working with the database and data modeling, there are controllers and components that allow them to be linked to the data source and the view is separate from the backend. Also, to simplify the development process, but also to improve performance and loading times, the architecture has backend components in the form of REST endpoints and a frontend system that presents this data to the customer, loading and aggregating. information in the form of AJAX requests. The application is presented in the form of a SPA (Single Page Application). AJAX allows data / information to be uploaded only when it is needed, thus avoiding overloading the network and endpoint components (and, consequently, database connections). An asynchronous mechanism is preferred, with the pages loading component by component. Modules of the system 5.2 Modules of the application The system architecture must be: - Modular - components with well-defined roles and characteristics / properties - Open - new components can be added, new properties). The modules (components) of the solution have general characteristics, adaptable according to customer requirements - Multi-level - client-server architecture, separated on several layers At the logical level, the basic application will be organized on 3 basic functional levels, to which are added 3 auxiliary areas of infrastructure and applications: - Database level - stores and provides information on legislative documents in a structured format - Logic Application Level - implements the functionalities of managing the legislative database in everything related to document management, introduction of new documents, marking of expired documents or portions of expired documents, marking the relationships between documents (by documents are meant data related to the electronic voting process). Also at this level, the administration of users, roles and access rights is performed - Presentation level - at this level the documents stored at the application level to the users are published, on different communication channels (portal, web services) o Virtualization Area - with a role in optimizing the technological infrastructure o Monitoring, Audit and Compliance Area - with a role in obtaining information on the use of the application and the changes suffered by the computer system o Rescue and Restoration Zone - with a role in securing the legislative database, as well as the application configuration The proposed application is divided into 5 modules, as follows: Authentication Module - is the module in which users are authenticated and redirected to the dedicated page depending on their role. This module is the component that manages authentication (setting user identity) and authorization (setting user permissions on resources) in the application. This module also manages the 17 account creation or signup process and the password reset process. In the authentication process, this component calls the module for managing the interaction with the application's database to check if the email address entered by the user exists in the system. If the email address does not exist in the database, the HTTP 401 Unauthorized status will be answered to indicate that the user cannot access the system. If the email address is identified in the system, user data will be retrieved, and the stored and user-entered password will be compared using the compare () function in the BCrypt library. If the passwords match, a JWT access token will be created with the user's data and role, and it will be sent to the Gateway API and further to the client along with the HTTP 200 OK status to signify the success of the request. This access token will be further stored in the "localStorage" section of the browser and will be attached to all requests subsequently initiated by the user in the graphical interface. If any of the microservices involved or the application database does not respond to the request, the HTTP 500 Internal Server Error code will be transmitted indicating a server-level error. In the authorization process, the request sent by the client is redirected from the Gateway API to this microservice to verify that the user has permission to access the specified resource. To perform this verification, the authorization header is extracted from the application and the JWT access token is taken over, if any. If the token is not present, it is answered with the HTTP code 401 to indicate that the user is not authorized to receive a response to that request. If there is an access token, its properties and validity are verified, and if the token is correct and valid, the microservice sends the confirmation with the user to the Gateway API is authorized. With this confirmation, the application can go further and be properly served by other microservices involved. The entire authorization process will take place at each request issued by the customer, regardless of whether the user has previously been authorized. When the user logs out of the application, the access token will be invalidated and deleted from the "localStorage" section of the web browser used. During the account creation process in the application, the user enters data such as name, email address, CNP (national ID), address, city, county, phone number and desired password. The password and CNP are validated from the interface (if the number of characters is correct, if the password is strong enough, etc.) and hashed in the microservice before being sent to the microservice responsible for the interaction with the database. The user will not have to select a specific role because the role of citizen will be automatically assigned to him. Within the microservice that communicates with the database, the information entered by the user will be inserted in the application database, and the confirmation of the successful execution of the operation will be signaled by the HTTP code 201 Created. This code indicates the success of solving the request and creating a new resource, in this case, a new user. During the password reset process, the user will have to enter the email address used in the application, and it will be checked if it is stored in the database. Thus, the reset request will reach the API Gateway from the client, where it will be redirected to the authentication and authorization microservice and then to the microservice that manages the connection to the database. The latter will initiate an SQL query to the database to verify the email address received. If the address is valid, a multi-random reset code will be generated and sent to you by email at the specified address. The user will need to enter that password reset code as well as the new password to complete the password reset process. The user will not need to have an access token to initiate this action. Casting Electronic Vote Module - is the module at which a citizen can express his democratic right, namely the option to vote in an electoral process in which he is registered. The electronic voting module will manage all the operations related to the voting process: initiating a vote, filling in the details, attaching documents and their validation, performing the transaction, validating, and confirming the vote. For all these operations, it will be checked each time if the connected user is authorized to perform them by checking the respective requests in the module for authentication and authorization. Also, for inserting and retrieving data in and from the database, the module responsible for managing the interaction with the database will be called. Blockchain is a growing list of records called blocks that communicate with each other through encrypted messages, each block contains a cryptographic hash of the previous block, a timestamp and transaction data. In this application we chose to use NEAR-blockchain Platform because it provides various ways 18 Report that allow us to deploy easily both in the cloud and on their dedicated platform. This platform offers a full blockchain-as-a-service (BaaS) stack. NEAR-blockchain provides smart contracts in various forms: View Methods - these are read-only, do not change the status, but return values viewMethods: [ "getGreeting", "didParticipate", "getAllPrompts", "getVotes", "getUrl", "getCandidatePair", , ], Change Methods - these change the status, but do not return the value when called changeMethods: [ "addUrl", "addCandidatePair", "addToPromptArray", "addVote", "recordUser", "clearPromptArray", ], Electronic Vote Counting Module - is the module in which the data is centralized at the local / regional level, and then the centralization will be done at the national level based on them. Here, all the centralized data would be used to identify the winner of the electoral process, to create statistic about the demographic choices. Electronic Vote Administration - at the level of this module it will be possible to perform higher level actions, namely solving the requests for viewing a voter's history, accessing the logs of the other modules, as well as creating and validating electoral processes. Key Management Module - is the encryption module to ensure the integrity of the democratic process. At the level of this module, the encryption of the vote will be assured using the algorithm presented in more details in the section 3.2. The way of interaction and the actors involved in the electronic voting process is presented in figure 6. 19 Figure 6. Architecture schema 5.3 Implementation details Poll creating page – Here the admin can create a poll with 2 candidates by filling the following form. There is an option to add an URL to an image from internet and a prompt for the poll. The page concludes with a submit button. In the following figure 7 we can see the user interface for creating the poll. Figure 7. Creating a poll page List of Polls page – all the created polls will be listed on this page, here the user can vote only once for one candidate. 20 Report Figure 8. Listing polls page Login page – For the testing environment we will use the API exposed by NEAR as it integrates features such as logging transactions for account, details of the contracts and balance profile. Figure 9. Login page in testing environment Transactions details of one account page – for every account we can see the details of it such as transactions initiated, storage used, the balance, date, and the contract. 21 Figure 10. Transactions details of one account Transactions logs page – This page is used for auditing the transactions, we can see the methods called, the status and the timestamps. Figure 11. Transactions Logs 22 Report 6 Technologies 6.1 NPM It's a package manager for the JavaScript programming language maintained by npm, Inc. npm is the default package manager for the JavaScript runtime environment Node.js. It consists of a command line client, also called npm, and an online database of public and paid-for private packages, called the npm registry. The registry is accessed via the client, and the available packages can be browsed and searched via the npm website.[17] The advantage of using this technology: • Managing Dependencies: o npm can manage dependencies. o npm can (in one command line) install all the dependencies of a project. o Dependencies are also defined in package.json. • Sharing Your Software o if you want to share your own software in the npm registry • Publishing a Package o You can publish any directory from your computer as long as the directory has a package.json file 6.2 Typescript TypeScript is a programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript and adds optional static typing to the language. It is designed for the development of large applications and transpiles to JavaScript. As it is a superset of JavaScript, existing JavaScript programs are also valid TypeScript programs. TypeScript may be used to develop JavaScript applications for both client-side and server-side execution (as with Node.js or Deno). Multiple options are available for transpilation. The default TypeScript Compiler can be used, or the Babel compiler can be invoked to convert TypeScript to JavaScript.[16] 6.3 React React (also known as React.js or ReactJS) is a free and open-source front-end JavaScript library for building user interfaces based on UI components. It is maintained by Meta (formerly Facebook) and a community of individual developers and companies. React can be used as a base in the development of single-page, mobile, or server-rendered applications with frameworks like Next.js. However, React is only concerned with state management and rendering that state to the DOM, so creating React applications usually requires the use of additional libraries for routing, as well as certain client-side functionality.[19] The advantage of using this technology: • Declarative: React makes it painless to create interactive UIs. Design simple views for each state in your application and React will efficiently update and render just the right components when your data changes. Declarative views make your code more predictable and easier to debug. • Component-Based: Build encapsulated components that manage their own state, then 23 compose them to make complex UIs. Since component logic is written in JavaScript instead of templates, you can easily pass rich data through your app and keep state out of the DOM. • Learn Once, Write Anywhere: We don’t make assumptions about the rest of your technology stack, so you can develop new features in React without rewriting existing code. React can also render on the server using Node and power mobile apps using React Native. 6.4 JestJS Jest is a JavaScript testing framework built on top of Jasmine and maintained by Meta (formerly Facebook). It was designed and built by Christoph Nakazawa with a focus on simplicity and support for large web applications. It works with projects using Babel, TypeScript, Node.js, React, Angular, Vue.js and Svelte. Jest doesn't require a lot of configurations for first-time users of a testing framework.[18] The advantage of using this technology: • Zero config: Jest aims to work out of the box, config free, on most JavaScript projects. • Snapshots: Make tests which keep track of large objects with ease. Snapshots live either alongside your tests, or embedded inline. • Isolated: Tests are parallelized by running them in their own processes to maximize performance. • Great API: From it to expect - Jest has the entire toolkit in one place. Well documented, well maintained, well good. 6.5 NEAR NEAR is a blockchain that has been built from the ground up to be high-performant, incredibly secure, and infinitely scalable all while supporting sustainability. Simply put, NEAR is a layer one, sharded, proof-of-stake blockchain built for usability and scalability. The main advantage of using this technology is: • NEAR's proof of stake network is sustainable and certified carbon neutral. • Almost infinitely scalable and resilient to short-term usage spikes through sharding. • Human-readable account names (alice.near instead of 0x71C7656EC7ab88b098defB751B7401B5f6d8976F) • Fast. ~1.2 second block production time. • 1000x lower transaction fees for users. • 30% of gas fees are paid out to smart contract developers. • Interoperable with Ethereum using Rainbow Bridge (first trustless bridge ever created).