Blockchain anonymous voting method, device and storage medium based on homomorphic encryption
By applying homomorphic encryption technology in blockchain anonymous voting, generating and verifying ciphertexts, the problem of not being able to achieve complete anonymity in the existing technology is solved, and the true anonymization and security of the voting process is achieved.
Patent Information
- Application Number
- CN202210107046.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-28
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2042-01-28
AI Technical Summary
The existing blockchain anonymous voting scheme cannot achieve complete anonymity. The voting initiator can see the specific voting situation of each address, resulting in impaired anonymity.
Homomorphic encryption technology is used to ensure anonymity during the voting process by generating and verifying ciphertexts. The specific steps include receiving and verifying the KV map, generating a homomorphic encryption voting decision, updating the KV map, and finally ensuring the verifiability of the voting through blockchain evidence storage.
The true anonymization of the voting process has been achieved. The voting initiator can only know the number of votes the candidate receives, but cannot know the voting situation of the node in detail, ensuring the anonymity and security of the voting.
Smart Images

Figure CN114491635B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer technology, and in particular relates to a blockchain anonymous voting method, device, and storage medium based on homomorphic encryption. Background Art
[0002] Homomorphic encryption involves performing ring-based addition and multiplication on plaintext before encryption. The results are equivalent to performing the corresponding operations on the encrypted ciphertext. For two numbers A and B, if A + B = C, then ciphertext A + ciphertext B = ciphertext C. The same applies to multiplication. Blockchains are often used in many scenarios where anonymous voting is required. Due to the decentralized nature of blockchains, there is no central authority to tally votes. While some existing anonymous voting schemes maintain relative anonymity, the initiator of the vote can see the specific voting status of each address, making it less than fully anonymous. Once voting information is made public, if someone learns the identity of the person behind the anonymous address (or anonymous ID), the vote loses its anonymity. Summary of the Invention
[0003] In order to solve the above problems, the present invention provides a blockchain anonymous voting method, device and storage medium based on homomorphic encryption. The voting process is truly anonymized through homomorphic encryption technology. The voting initiator can only know the number of votes for each candidate, but cannot know the specific voting situation of the node.
[0004] The present invention adopts the following technical solutions.
[0005] In a first aspect, the present invention provides a blockchain anonymous voting method based on homomorphic encryption, the method being applicable to voting nodes, the method comprising:
[0006] Receive a first version of the KV map, which is generated and initialized by the voting initiating node based on the set S of nodes participating in the vote and the number of votes. The first version of the KV map is generated by updating the previous voting node after voting;
[0007] Calling the verification function corresponding to the first version of the KV map to verify the first version of the KV map, where the verification function is generated by the voting initiator;
[0008] Obtain the first vote statistics ciphertext from the first block, calculate the vote statistics ciphertext of the first version of the KV map, compare it with the first vote statistics ciphertext, and send it to the voting initiating node for verification and comparison. If the comparison is consistent, voting is carried out; the first vote statistics ciphertext is calculated by the previous voting node based on the first version of the KV map and uploaded to the blockchain for evidence storage;
[0009] Call the voting function to generate a homomorphically encrypted voting decision, fill the homomorphically encrypted voting decision into the corresponding position in the first version of the KV map, and delete the corresponding node information from the node set S of the first version of the KV map to update the first version of the KV map to generate the second version of the KV map;
[0010] Determine whether the node set S of the second version of the KV map is an empty set. If so, send the second version of the KV map to the voting initiating node. Otherwise, send the second version of the KV map to the next voting node, and count the votes of the second version of the KV map to obtain the second vote statistics ciphertext. The second vote statistics ciphertext is last stored in the blockchain for verification of the second version of the KV map by the voting initiating node.
[0011] Preferably, the method for the voting initiating node to verify the second version of the KV map includes:
[0012] The voting initiating node generates a verification function corresponding to the second version of the KV map, obtains the second vote statistics ciphertext from the second block based on the verification function, and obtains the first vote statistics ciphertext from the first block. The voting initiating node decrypts the second vote statistics ciphertext and the first vote statistics ciphertext to obtain the second vote statistics and the first vote statistics, and determines whether the difference between the two is within a preset range. If yes, the verification passes; otherwise, the verification fails.
[0013] In a second aspect, a computer device is provided, comprising one or more processors;
[0014] a memory for storing one or more programs,
[0015] When the one or more programs are executed by the one or more processors, the one or more processors are caused to perform the method as described in the first aspect above.
[0016] In a third aspect, a storage medium storing a computer program is provided, which, when executed by a processor, implements the method described in the first aspect above.
[0017] The beneficial effect of this invention lies in combining homomorphic encryption and blockchain technology to achieve completely anonymous voting, preventing the disclosure of personal privacy and preferences, while ensuring the anonymity of voting while ensuring security and reliability. Because the voting process is peer-to-peer, the initiating node cannot perceive the voting status of each node. At the same time, due to homomorphic encryption, the node cannot know the voting status of the previous node or the real-time vote count, and is not affected by the current voting situation. The blockchain's evidence storage ensures the verifiability of the entire voting process. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1A flowchart of a blockchain anonymous voting method based on homomorphic encryption provided by one embodiment of the present invention;
[0019] Figure 2 A schematic diagram of the structure of a computer device provided in one embodiment of the present invention. DETAILED DESCRIPTION
[0020] The present invention will be further described in detail below in conjunction with specific embodiments and the accompanying drawings. Those of ordinary skill in the art will be able to implement the present invention based on these descriptions. In addition, the embodiments of the present invention involved in the following description are generally only embodiments of a part of the present invention, rather than all embodiments. Therefore, based on the embodiments in the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative work should fall within the scope of protection of the present invention. It should be noted that, unless there is a conflict, the embodiments in this application and the features in the embodiments can be combined with each other. Unless otherwise specified, the methods briefly described in the embodiments of the present invention are methods mastered by those skilled in the art.
[0021] Figure 1 A flowchart of a blockchain anonymous voting method based on homomorphic encryption is provided in one embodiment of the present invention.
[0022] like Figure 1 As shown, this embodiment provides a blockchain anonymous voting method based on homomorphic encryption, which is applicable to voting nodes and includes:
[0023] Receive a first version of the KV map, which is generated and initialized by the voting initiating node based on the set S of nodes participating in the vote and the number of votes. The first version of the KV map is generated by updating the previous voting node after voting;
[0024] Calling the verification function corresponding to the first version of the KV map to verify the first version of the KV map, where the verification function is generated by the voting initiator;
[0025] Obtain the first vote statistics ciphertext from the first block, calculate the vote statistics ciphertext of the first version of the KV map, compare it with the first vote statistics ciphertext, and send it to the voting initiating node for verification and comparison. If the comparison is consistent, voting is carried out; the first vote statistics ciphertext is calculated by the previous voting node based on the first version of the KV map and uploaded to the blockchain for evidence storage;
[0026] Call the voting function to generate a homomorphically encrypted voting decision, fill the homomorphically encrypted voting decision into the corresponding position in the first version of the KV map, and delete the corresponding node information from the node set S of the first version of the KV map to update the first version of the KV map to generate the second version of the KV map;
[0027] Determine whether the node set S of the second version of the KV map is an empty set. If so, send the second version of the KV map to the voting initiating node. Otherwise, send the second version of the KV map to the next voting node, and count the votes of the second version of the KV map to obtain the second vote statistics ciphertext. The second vote statistics ciphertext is last stored in the blockchain for verification of the second version of the KV map by the voting initiating node.
[0028] Specifically, the method for the voting initiating node to verify the second version of the KV map includes:
[0029] The voting initiating node generates a verification function corresponding to the second version of the KV map, obtains the second vote statistics ciphertext from the second block based on the verification function, and obtains the first vote statistics ciphertext from the first block. The voting initiating node decrypts the second vote statistics ciphertext and the first vote statistics ciphertext to obtain the second vote statistics and the first vote statistics, and determines whether the difference between the two is within a preset range. If yes, the verification passes; otherwise, the verification fails.
[0030] To avoid loss of generality, we will analyze a specific case below. First, the initiator votes. The initiator Zhao Liu initiates voting through his node, and circles the voting nodes Zhang San, Li Si, and Wang Wu. Initialization<name,number> This is a KV map of candidates and votes. The votes are initially all 0, and these 0s are the ciphertext 0s after homomorphic encryption. For example, Zhang San: 80998786, Li Si: 12313890, and Wang Wu: 72314090. Zhao Liu's node is the voting initiator. Zhao Liu generates the voting function, called vote(), which returns the homomorphically encrypted 0 and 1, with 0 representing a no vote and 1 representing a vote. Voters call the vote() function and receive the ciphertext 0 or 1. They then add the ciphertext to the corresponding position in the map. They add 1 to the value of a candidate they want to vote for and 0 to a candidate they don't want to vote for. They then pass the map to the next node, removing themselves from the set S. Because the voting function uses homomorphic encryption, each encrypted ciphertext uses a different property. Therefore, each node receives different data when calling vote(), making it impossible to infer the previous vote based on the data it receives.
[0031] To prevent voters from over-voting or voting randomly, a verification mechanism is also provided in this invention. The current voter adds up the votes of all previous voters to obtain the total vote sum, which is publicly stored on the blockchain. The voting initiator generates a verification function auth. Before the next node initiates a vote, it first calls the auth function to verify whether the previous node's vote is valid. The specific method for the voting initiator to generate the verification function includes two aspects:
[0032] (1) The voting initiating node obtains the ciphertext of the total number of votes corresponding to the current version of the KV map after the current node votes, and the total number of votes corresponding to the previous version of the KV map generated after the previous node votes, from the corresponding block, to check whether they comply with the rules (because the voting initiating node can decrypt the ciphertext of the difference between the sums of the two blocks to obtain the plaintext, and then know the actual number of votes at that point. If the number of votes is within the preset range, it means that the vote of the current node is standardized. For example, 0 represents no vote and 1 represents vote. The difference between the two can only be 0 or 1. In order to achieve anonymity, the node adopts anonymous submission when submitting the total number of votes. It only needs to mark the corresponding vote with the submitted total number of votes. This method is a prior art and will not be described in detail in this application).
[0033] (2) After the next node receives the KV map, it verifies whether the total number of votes in the received map is consistent with the total number of votes stored in the corresponding evidence on the blockchain.
[0034] The above two points can ensure that nodes do not vote randomly or over-vote.
[0035] When a voting node removes itself and the set S is empty, it returns its updated KV map to the voting initiating node. The voting initiating node can then receive the complete voting results and decrypt them to obtain the plaintext of the voting results.
[0036] The above embodiment combines homomorphic encryption and blockchain technology to achieve completely anonymous voting, preventing the disclosure of personal privacy and preferences, while ensuring the anonymity of voting while ensuring security and reliability. Because the voting process is peer-to-peer, the initiating node cannot perceive the voting status of each node. At the same time, due to homomorphic encryption, the node cannot know the voting status of the previous node or the real-time vote count, and is not affected by the current voting situation. The blockchain's evidence storage ensures the verifiability of the entire voting process.
[0037] Figure 2 A schematic structural diagram of a device provided in one embodiment of the present invention.
[0038] like Figure 2As shown, as another aspect, the present application also provides a computer device 500, including one or more central processing units (CPUs) 501, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 502 or programs loaded from a storage portion 508 into a random access memory (RAM) 503. Various programs and data required for the operation of the device 500 are also stored in the RAM 503. The CPU 501, ROM 502, and RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0039] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, and the like; an output section 507 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card or a modem. The communication section 509 performs communication processing via a network such as the Internet. A driver 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, and the like, is mounted on the driver 510 as needed, so that a computer program read therefrom can be installed into the storage section 508 as needed.
[0040] In particular, according to the embodiments disclosed herein, the method described in Embodiment 1 above can be implemented as a computer software program. For example, the embodiments disclosed herein include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for executing the method described in any of the embodiments above. In such embodiments, the computer program can be downloaded and installed from a network via the communication portion 509 and / or installed from the removable medium 511.
[0041] As another aspect, the present application further provides a computer-readable storage medium, which may be the computer-readable storage medium included in the apparatus of the above-described embodiment, or a standalone computer-readable storage medium not incorporated into the apparatus. The computer-readable storage medium stores one or more programs, which are used by one or more processors to execute the method described in the present application.
[0042] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, program segment or a part of code, and the module, program segment or a part of code contains one or more executable instructions for realizing the prescribed logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the prescribed function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.
[0043] The units or modules involved in the embodiments described in this application may be implemented in software or hardware. The units or modules described may also be provided in a processor. For example, each of the units may be a software program provided in a computer or mobile smart device, or a separately configured hardware device. The names of these units or modules do not, in certain circumstances, constitute limitations on the units or modules themselves.
[0044] The above description is merely a preferred embodiment of the present application and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also encompasses other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the concept of this application. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this application.
Claims
1. A blockchain anonymous voting method based on homomorphic encryption, characterized in that: The method is applicable to a voting node, and the method comprises: Receive a first version of the KV map, where the KV map is generated and initialized by the voting initiating node based on the set of nodes S participating in the voting and the number of votes, and the first version of the KV map is generated by updating after the previous voting node votes; Calling a verification function corresponding to the first version of the KV map to verify the first version of the KV map, where the verification function is generated by the voting initiator; Obtain the first vote statistics ciphertext from the first block, count the vote statistics ciphertext of the first version of the KV map and compare it with the first vote statistics ciphertext, and send it to the voting initiating node for verification and comparison. If the comparison is consistent, voting is carried out; the first vote statistics ciphertext is calculated by the previous voting node according to the first version of the KV map and uploaded to the blockchain for evidence storage; Call the voting function to generate a homomorphically encrypted voting decision, fill the homomorphically encrypted voting decision into the corresponding position in the first version of the KV map, and delete the corresponding node information from the node set S of the first version of the KV map, so as to update the first version of the KV map to generate the second version of the KV map; Determine whether the node set S of the second version of the KV map is an empty set. If so, send the second version of the KV map to the voting initiating node. Otherwise, send the second version of the KV map to the next voting node, and count the votes of the second version of the KV map to obtain the second vote statistics ciphertext. The second vote statistics ciphertext is stored in the blockchain for verification by the voting initiating node.
2. According to the blockchain anonymous voting method based on homomorphic encryption according to claim 1, it is characterized in that: The method for the voting initiating node to verify the second version of the KV map includes: The voting initiating node generates a verification function corresponding to the second version of the KV map, obtains the second vote statistics ciphertext from the second block based on the verification function, obtains the first vote statistics ciphertext from the first block, and decrypts the second vote statistics ciphertext and the first vote statistics ciphertext to obtain the second vote statistics and the first vote statistics, and determines whether the difference between the two is within a preset range. If so, the verification passes, otherwise the verification fails.
3. A computer device, characterized in that: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors are caused to perform the method according to claim 1 or 2.
4. A storage medium storing a computer program, characterized in that: When the program is executed by a processor, the method according to claim 1 or 2 is implemented.
Citation Information
Patent Citations
Electronic voting method and device based on block chain and storage medium
CN110958107A
K-out-of-m anonymous voting method based on alliance chain
CN112995136A