On-chain voting methods, devices, electronic equipment, and media for blockchain governance
By generating voting public keys on the blockchain and verifying them using smart contracts, combined with Schnorr zero-knowledge proofs and Merkle trees, the problems of high cost and insufficient security of on-chain voting on the blockchain are solved, and an efficient and secure voting process is achieved.
Patent Information
- Application Number
- CN202211398934.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-09
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2042-11-09
AI Technical Summary
On-chain voting on blockchain suffers from high costs, insufficient security, and low robustness. In particular, in decentralized networks, voting costs are exorbitant, privacy protection is inadequate, and users dropping out midway can cause the vote counting process to fail.
By acquiring users who meet the preset voting qualifications, generating voting public keys and verifying them using smart contracts, combining Schnorr zero-knowledge proofs and Merkle tree qualification proofs, generating encrypted votes, and storing and counting the votes in the smart contract, a recovery phase is added to ensure the smooth conduct of voting, and some on-chain computations are transferred to off-chain.
It reduces the cost of on-chain voting, improves the security and robustness of voting, and ensures the smooth conduct of the voting process and privacy protection.
Smart Images

Figure CN115761973B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of blockchain technology, and in particular to an on-chain voting method, device, electronic device, and medium for blockchain governance. Background Technology
[0002] To enable blockchain governance to be conducted in a decentralized manner, on-chain voting is currently the main way for blockchain systems to carry out on-chain governance. However, this voting method does not have a trusted third party and requires the resolution of a series of security issues.
[0003] For decentralized networks, a voting scheme has been proposed that is self-counting, provides maximum protection for voter privacy, and ensures verifiable voting results. However, as the voting scale increases, the computational load on each voter also increases linearly. Another related technology has proposed a new scheme that reduces the computational complexity for voters, but the number of voting rounds also increases.
[0004] Building upon this foundation, a new open voting network has been proposed, balancing voting efficiency with the computational complexity of voting nodes. The open voting network is a group-based encrypted voting scheme that does not require a trusted third party and features decentralization, privacy protection, and self-counting. It consists of four algorithms: GSet, GGen, GVote, and GTally. The GSet algorithm is used to set the voting parameters in the initial stage. Then, participating users run the GGen algorithm to generate voting keys. During the voting process, the GVote and GTally algorithms are used for voting and counting, respectively.
[0005] Suppose there are n users V1, V2, ..., V n The specific algorithm for participating in the voting process and using the open voting network is described below:
[0006] 1. Set the voting parameters using GSet():
[0007] 1. Generate voting-related parameters in It is a cyclic group of order q with generator g;
[0008] 2. Output parameters
[0009] II. Key generation GGen(param):
[0010] 1. Each user V i Select private key calculate Use as a public key and publish the PK i ;
[0011] 2. Once all users have publicly shared their public keys, calculate Y. i =∏ j<i pk j / ∏ j>i pk j ;
[0012] 3. Output {Y} i},{pk i}
[0013] III. Voting GVote(param,sk i ,Y i ,v i ):
[0014] 1. Each user's vote is encrypted. And publicly disclosed c i , where v i ∈{0,1};
[0015] 2. Output {c i}
[0016] IV. Vote Counting GTally(param,c i ):
[0017] 1. Any user who can access voting data can calculate π. i c i The discrete logarithm is then calculated using an enumeration algorithm to obtain the sum of votes, s.
[0018] 2. Output s
[0019] The main problems with open voting networks are robustness and cost. Due to inherent limitations, if a user withdraws from the voting process midway, the vote counting process cannot proceed. One solution is a deposit mechanism, where users pay a deposit to participate in voting. Only users who vote correctly can get their deposit back after the voting ends; otherwise, the deposit is withheld. However, this mechanism only alleviates the problem to a certain extent; if the gains from attacking the vote exceed the deposit, the attack will still occur. Another problem with open voting networks is cost. Therefore, when implemented on Ethereum, voting costs are high because all computations are performed on-chain, and block size severely limits the scale of voting, accommodating only small votes of up to 40 people. A solution is to move these complex calculations off-chain in a verifiable manner, performed by a trustless administrator, thus reducing voting costs while ensuring voting security. This deposit mechanism addresses the robustness issues of open voting networks.
[0020] Therefore, the open voting network method in related technologies has the following specific problems:
[0021] 1. High cost of on-chain voting. Currently, most blockchain governance is conducted through voting. However, the on-chain computing and storage costs of blockchain are high. If all computing and storage are transferred to the chain, it will lead to high voting costs, making it difficult to carry out voting on a large scale and hindering blockchain governance.
[0022] 2. Insufficient security of on-chain voting. Although blockchain offers anonymity, transactions on the blockchain still need to remain confidential. For voting in blockchain governance, votes need to be encrypted to protect voters' ballots, prevent information leakage, and avoid unauthorized voting or pre-calculation of results, which could hinder the normal conduct of the voting process. Furthermore, on-chain voting is conducted in a decentralized manner, lacking a trusted third party to oversee the process.
[0023] 3. The on-chain voting scheme is not robust. Due to the inherent limitations of open voting networks, if a user withdraws from the voting process midway, the vote counting process cannot proceed. Summary of the Invention
[0024] This application provides an on-chain voting method, device, electronic device, and medium for blockchain governance, which solves the problems of high cost and insufficient security in blockchain on-chain voting, reduces the cost of on-chain voting, improves the security of on-chain voting, and ensures the smooth conduct of voting.
[0025] The first aspect of this application provides an on-chain voting method for blockchain governance, comprising the following steps: obtaining voting users who meet preset voting qualifications, generating a voting public key for the voting users based on a preset private key, and verifying the voting public key, Schnorr zero-knowledge proof, and Merkle tree qualification proof using a preset smart contract; after successful verification, generating encrypted votes for the voting users and storing them in the preset smart contract, determining whether there are any users who abstained from voting among the voting users; if there are no users who abstained from voting among the voting users, counting the encrypted votes on the preset smart contract, storing the vote count results in the preset smart contract, and storing and publishing the intermediate calculation results of the vote count results in the structure of the Merkle tree, so that when all voting users agree, the vote count results are used as the final voting results.
[0026] Optionally, after determining whether there are users who abstained from voting among the voting users, the method further includes: if there are users who abstained from voting among the voting users, obtaining the negotiation result of the voters who correctly executed the voting protocol; and continuing to execute the voting action based on the negotiation result.
[0027] Optionally, after storing and publishing the intermediate calculation results of the vote counting results in the structure of the Merkle tree, the method further includes: if one or more of the voting users disagree, then raise an objection to the preset smart contract based on the data of the Merkle tree, and the preset smart contract will verify it.
[0028] Optionally, before obtaining the voting users who meet the preset voting qualifications, the method further includes: initializing the running parameters of the current vote and deploying the preset smart contract; and constructing the Merkle tree based on the addresses of the voting users who meet the preset voting conditions.
[0029] Optionally, after obtaining the voting users who meet the preset voting qualifications, the method further includes: obtaining the voting deposit of the voting users.
[0030] Optionally, after using the vote count as the final voting result, the method further includes: if the voting process of the voting user meets the preset voting conditions, then the voting deposit is sent to the corresponding voting user based on the preset smart contract.
[0031] A second aspect of this application provides an on-chain voting device for blockchain governance, comprising: an acquisition module, configured to acquire voting users who meet preset voting qualifications, generate a voting public key for the voting users based on a preset private key, and verify the voting public key, Schnorr zero-knowledge proof, and Merkle tree qualification proof using a preset smart contract; a judgment module, configured to generate encrypted votes for the voting users after successful verification, store them in the preset smart contract, and determine whether there are any users who abstained from voting among the voting users; and a voting module, configured to count the encrypted votes on the preset smart contract if there are no users who abstained from voting, store the vote count results in the preset smart contract, and store and publish the intermediate calculation results of the vote count results in the structure of the Merkle tree, so that when all voting users agree, the vote count results are used as the final voting results.
[0032] Optionally, after determining whether there are users who abstained from voting among the voting users, the determining module is specifically used to: if there are users who abstained from voting among the voting users, obtain the negotiation result of the voters who correctly executed the voting protocol; and continue to execute the voting action based on the negotiation result.
[0033] Optionally, after storing and publishing the intermediate calculation results of the vote counting results in the structure of the Merkle tree, the voting module is specifically used to: if one or more of the voting users disagree, raise a challenge to the preset smart contract based on the data of the Merkle tree, and the preset smart contract will verify it.
[0034] Optionally, before obtaining voting users who meet the preset voting qualifications, the obtaining module is specifically used to: initialize the running parameters of the current vote and deploy the preset smart contract; and construct the Merkle tree based on the addresses of voting users who meet the preset voting conditions.
[0035] Optionally, after obtaining the voting users who meet the preset voting qualifications, the obtaining module is further configured to: obtain the voting deposit of the voting users.
[0036] Optionally, after using the vote count as the final voting result, the voting module is further configured to: if the voting process of the voting user meets the preset voting conditions, then send the voting deposit to the corresponding voting user based on the preset smart contract.
[0037] A third aspect of this application provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement an on-chain voting method for blockchain governance as described in the above embodiments.
[0038] A fourth aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which is executed by a processor to implement an on-chain voting method for blockchain governance as described in the above embodiments.
[0039] This application addresses the issues of high cost and insufficient security in blockchain on-chain voting by acquiring qualified voters and generating their public keys based on predefined private keys. A predefined smart contract verifies the public keys, Schnorr zero-knowledge proofs, and Merkle tree qualification proofs. Upon successful verification, encrypted votes from the voters are generated and stored in the predefined smart contract. The application then determines if any voters abstain. If no abstentions are found, the encrypted votes in the predefined smart contract are tallied and stored. Intermediate calculations of the vote count are stored and published in a Merkle tree structure. When all voters agree, the final vote count is adopted. This solves the problems of high cost and insufficient security in blockchain on-chain voting, reducing the cost and improving the security of on-chain voting, thus ensuring smooth voting processes.
[0040] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0041] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:
[0042] Figure 1 This is a flowchart illustrating an on-chain voting method for blockchain governance provided according to an embodiment of this application;
[0043] Figure 2 This is a flowchart of a voting scheme according to an embodiment of this application;
[0044] Figure 3 This is a block diagram of an on-chain voting device for blockchain governance according to an embodiment of this application;
[0045] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0046] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.
[0047] The following description, with reference to the accompanying drawings, outlines an on-chain voting method, apparatus, electronic device, and medium for blockchain governance based on embodiments of this application. Addressing the issues of high cost and insufficient security in blockchain on-chain voting mentioned in the background section, this application provides an on-chain voting method for blockchain governance. This method involves acquiring voting users who meet preset voting qualifications, generating voting public keys for these users based on preset private keys, and verifying the voting public keys, Schnorr zero-knowledge proofs, and Merkle tree qualification proofs using a preset smart contract. Upon successful verification, encrypted votes from the voting users are generated and stored in the preset smart contract. The method then determines whether any users abstain from voting. If no users abstain, the encrypted votes on the preset smart contract are tallied, and the vote count is stored in the preset smart contract. Intermediate calculations of the vote count are stored and published in a Merkle tree structure, so that the vote count is used as the final voting result when all voting users agree. This solves the problems of high cost and insufficient security in blockchain on-chain voting, reduces on-chain voting costs, improves on-chain voting security, and ensures smooth voting.
[0048] Before describing specific on-chain voting methods for blockchain governance, it is necessary to introduce some related concepts and algorithms. This application's embodiments involve several zero-knowledge proof algorithms, which will be described below.
[0049] I. Non-interactive Schnorr protocol
[0050] In the key generation phase of an open voting network, each user needs to publish their public key. To ensure that users know their private key, zero-knowledge proofs are performed using the Schnorr protocol. The interactive Schnorr protocol is an interactive zero-knowledge proof protocol operating between the prover and the verifier. Without revealing the private key x, the prover can prove to the verifier their knowledge of x. The prover and verifier need to interact three times: in the commitment phase, the challenge phase, and the challenge response phase. Applying the Fiat-Shamir transform to the interactive Schnorr protocol can make the protocol interaction-free.
[0051] Assumption It is a cyclic group of order q with generator g. in The prover needs to prove to the verifier that they know the discrete logarithm x without revealing it. This zero-knowledge proof protocol is denoted as ZKPDL(g,A;x).
[0052] 1. The algorithm for constructing the prover Prover(x) is as follows:
[0053] (1) Random selection
[0054] (2) Z = g w
[0055] (3) c = Hash(Z, A)
[0056] (4) r = w + c·x
[0057] (5) Send (Z,r)
[0058] 2. The verification algorithm for Verifier(Z,r) is as follows:
[0059] (1) Calculate c = Hash(Z, A)
[0060] (2) Verify g r =Z·A c
[0061] (3) If any verification fails, reject; otherwise accept.
[0062] II. Proof of the equality of discrete logarithms
[0063] In the specific design of this application embodiment, a recovery phase is added to prevent someone from giving up participation and affecting the entire voting process. This phase requires reconstructing the public key for voting and ensuring that the private key used in the two rounds of voting is the same, i.e., the discrete logarithm is equal.
[0064] Assumption It is a q-order cyclic group, where g and h are two distinct generators of this cyclic group. in The prover needs to prove to the verifier that the discrete logarithms of A and B are the same without revealing x. This zero-knowledge proof protocol is denoted as EqDL(g,A,h,B;x).
[0065] 1. The algorithm for constructing the prover Prover(x) is as follows:
[0066] (1) Random selection
[0067] (2) Z1=g w Z2=h w
[0068] (3) c = Hash(Z1, Z2)
[0069] (4) r = w + c·x
[0070] (5) Send (Z1,Z2,r)
[0071] 2. The verification algorithm for Verifier(Z1,Z2,r) is as follows:
[0072] (1) Calculate c = Hash(Z1, Z2)
[0073] (2) Verify g r =Z1·A c ,h r =Z2·B c
[0074] (3) If any verification fails, reject; otherwise accept.
[0075] III. Proof of the Validity of Encrypted Voting
[0076] As defined in open voting networks, each voter needs to provide a zero-knowledge proof to demonstrate that the vote construction format is correct, i.e., v∈{0,1}. This application embodiment can employ a zero-knowledge proof method, by... Treat it as a public key and use the previously published one. structure
[0077]
[0078] This is equivalent to using the public key on g or 1. and random value x i Perform ElGamal encryption, that is Verification using the OR operation shows that m0 = 1 or m1 = g.
[0079] (log g x = log h (y / m0))∨(log g x = log h y / m1)
[0080] This protocol is denoted as ZKPV(g,x,y,h;v). The zero-knowledge proof construction of the prover is determined by v, but the form is the same, and the verifier cannot discover it. The verifier uses the same verification algorithm for the proof.
[0081] In particular,
[0082] 1. When v = 0, the algorithm for constructing the zero-knowledge Prover(v) proof is as follows:
[0083] (1) Random selection
[0084] (2) a1=g w b1 = h w ,
[0085] (3)c=Hash(x,y,a1,b1,a2,b2);
[0086] (4) d1=c-d2, r1=wx i ·d1;
[0087] (5) Send (a1,a2,b1,b2,d1,d2,r1,r2).
[0088] 2. When v = 1, the algorithm for constructing the zero-knowledge Prover(v) proof is as follows:
[0089] (1) Random selection
[0090] (2) a2=g w b2 = h w ;
[0091] (3)c=Hash(x,y,a1,b1,a2,b2);
[0092] (4) d2=c-d1, r2=wx i ·d2;
[0093] (5) Send (a1,a2,b1,b2,d1,d2,r1,r2).
[0094] 3. The verification algorithm for Verifier(a1,a2,b1,b2,d1,d2,r1,r2) is as follows:
[0095] (1) Calculate c = Hash(x,y,a1,b1,a2,b2);
[0096] (2) Verify that c = d1 + d2.
[0097] (3) If any verification fails, reject; otherwise accept.
[0098] Specifically, Figure 1 This is a flowchart illustrating an on-chain voting method for blockchain governance provided in an embodiment of this application.
[0099] like Figure 1 As shown, this on-chain voting method for blockchain governance includes the following steps:
[0100] In step S101, voting users who meet the preset voting qualifications are obtained, and a voting public key for the voting users is generated based on the preset private key. The voting public key, Schnorr zero-knowledge proof, and Merkle tree qualification proof are verified using a preset smart contract.
[0101] Optionally, before obtaining voting users who meet the preset voting qualifications, the method further includes: initializing the running parameters of the current vote and deploying a preset smart contract; and constructing a Merkle tree based on the addresses of voting users who meet the preset voting conditions.
[0102] Understandably, administrators need to configure the voting scheme's runtime parameters and deploy the relevant contracts, including... The time intervals between each voting stage will be specified, and the addresses of eligible community members will be stored in the IPFS system as a Merkle tree, denoted as MT. ε The administrator also needs to set up MT ε tree root ε Initialize during contract deployment.
[0103] Optionally, after acquiring voting users who meet the preset voting qualifications, the method also includes: acquiring the voting deposits of the voting users.
[0104] Specifically, as shown in Table 1, voters need to pay a certain deposit and submit relevant qualification certificates and public keys, which are verified and stored by the smart contract. For members who are eligible to participate in voting, they first need to select a private key and generate a voting public key, and then combine the public key with the Schnorr zero-knowledge proof π. x And the qualification π of Merkle trees Voter Send the transaction to the smart contract, while staking a certain amount of tokens to prevent malicious disruption of the voting process. The smart contract will then process the transaction against π. x and π VoterVerification is required. In an open voting network, each voter needs to assign a unique identifier to calculate Y. i In specific implementation, the embodiments of this application may use the array index of the voter stored in the smart contract as the voter's number.
[0105] Table 1
[0106]
[0107] In step S102, after successful verification, encrypted votes from voting users are generated and stored in a preset smart contract, and it is determined whether there are any users who abstained from voting.
[0108] During the encrypted voting phase, voters need to calculate the voting public key based on the public keys submitted by all voters, encrypt the ballot, and submit it.
[0109] Specifically, as shown in Table 2, after the voting public key is registered, the voter's encrypted vote is generated. If the voter's voting public key is stored at index i in the array, then the following needs to be calculated:
[0110]
[0111] Voters' choice of v is encrypted Then send a transaction containing c, Y to the smart contract. i And zero-knowledge proof of the validity of c for π v The smart contract verifies the transaction upon receipt; if π... v If the verification is successful, it will be stored in the smart contract.
[0112] Table 2
[0113]
[0114] Optionally, after determining whether there are users who abstain from voting among the voting users, the method further includes: if there are users who abstain from voting among the voting users, obtaining the negotiation result from the voters who correctly executed the voting protocol; and continuing to execute the voting action based on the negotiation result.
[0115] If any registered voter abstains from voting during the voting phase, the voting restoration phase will begin, where voters who have correctly followed the voting agreement will renegotiate to ensure the voting proceeds normally.
[0116] Specifically, the open voting network requires all registered voters to participate in the entire voting process; otherwise, the correctness of the voting will be affected. If a registered voter withdraws midway, a recovery phase is initiated to ensure the smooth conduct of the voting.
[0117] During the restoration phase, as shown in Table 3, let the set of voters who submitted valid votes be . The remaining voters either submitted invalid ballots or abstained from voting. For the set... Voters need to perform the following steps; voters need to calculate...
[0118]
[0119] In calculation Afterwards, voters need to... The proof of equality with the discrete logarithm is sent to the smart contract for verification. This phase is equivalent to excluding voters who abstain midway by recalculating the encrypted public key, and the inclusion of the recovery phase does not affect the normal execution of the vote counting process.
[0120] Table 3
[0121]
[0122] In step S103, if there are no users who abstain from voting, the encrypted votes on the preset smart contract are counted, and the vote count results are stored in the preset smart contract. The intermediate calculation results of the vote count are stored and published in a Merkle tree structure so that the vote count results can be used as the final voting results when all voting users agree.
[0123] To reduce the cost of on-chain voting and improve the efficiency and scale of voting, this phase delegates vote counting to administrators in a verifiable manner for off-chain vote counting.
[0124] As shown in Table 4, when calculating the sum of the votes, This can be represented as a step-by-step product process, as shown in Table 5. This process can retain intermediate results at each step for verifying administrator behavior.
[0125] Table 4
[0126]
[0127]
[0128] Furthermore, the administrator constructs a Merkle tree. To store the result t of each row i The administrator then uses an enumeration algorithm to solve for the discrete logarithm to obtain the vote count result ∑. i v i =log g t n Finally, the administrator sends the Merkle tree root to the smart contract. c And the vote count results.
[0129] Table 5
[0130]
[0131] Optionally, after storing and publishing the intermediate calculation results of the vote count in the form of a Merkle tree, the method further includes: if one or more voting users disagree, then a challenge is raised to a preset smart contract based on the data of the Merkle tree, and the preset smart contract verifies the challenge.
[0132] Specifically, as shown in Table 6, when voters publish the Merkle tree MT c Any voter or other person can verify the correctness of the intermediate results of each iteration. For example, an administrator might maliciously set t. i =c i ′ ·t i-1 Then all subsequent results will be affected. Others can send i,t to the smart contract. i ,t i-1 And Merkle's proof of π i ,π i-1 To verify whether the intermediate result of step i is correct, where Merkle's proof is used to ensure t i ,t i-1 It is valid data stored in the Merkle tree, and the smart contract will use the previously stored voting information to verify whether there is a problem in this step.
[0133] Table 6
[0134]
[0135]
[0136] Optionally, after using the vote count as the final voting result, the method further includes: if the voting process of a voting user meets the preset voting conditions, then the voting deposit is sent to the corresponding voting user based on the preset smart contract.
[0137] It should be understood that after the vote counting and verification phase, each participant who correctly executed the voting protocol can send a transaction to the smart contract to redeem their staked tokens. If the sender is one of the voters, the smart contract will check whether the voter submitted a correctly generated cryptographic vote. If the sender is an administrator, the smart contract will check whether any user successfully challenged the voting results during the vote counting and verification phase. If the smart contract passes the check, it will send the staked tokens back to the sender of the transaction.
[0138] In summary, as Figure 2As shown, this application embodiment is divided into seven stages. The first stage is initialization, where the administrator needs to set relevant voting parameters and deploy relevant contracts, constructing a Merkle tree of eligible voting user addresses and making it public. In the identity registration stage, voters need to pay a deposit and submit qualification certificates and public keys, which are verified and stored by the smart contract. In the encrypted voting stage, voters need to calculate the voting public key based on the public keys submitted by all voters, encrypt the ballot, and submit it. In the voting stage, if a registered voter abstains from voting, the voting restoration stage is required, where voters who correctly executed the voting protocol renegotiate to ensure the voting proceeds normally. In the vote counting result submission stage, the administrator obtains the encrypted votes stored in the smart contract, counts the votes, stores the counting results in the smart contract, and publishes a Merkle tree composed of intermediate counting results for verification. In the vote counting result verification stage, if a user questions the administrator's vote counting results, they can raise a question to the smart contract based on the Merkle tree data, which the smart contract verifies. In the deposit redemption stage, if the user and administrator correctly executed the voting process, the deposit can be redeemed.
[0139] The beneficial effects of this application's embodiments are as follows: This application's embodiments transfer some complex on-chain computations to off-chain in a verifiable manner, reducing on-chain voting costs. The smart contract is only responsible for verifying the received transaction data, effectively reducing the time and cost complexity of computation. This application's embodiments mainly improve the registration, vote counting, and verification stages. In the registration stage, only the received public key needs to be verified and stored, without needing to calculate the voting public keys of all voters. In the vote counting stage, the vote counting process also does not require on-chain computation by the smart contract; instead, it is handled by the administrator off-chain and then submitted to the smart contract, greatly reducing the complexity of on-chain computation. This application's embodiments add a verification stage to verify the vote counting results, ensuring that the vote counting process is correctly executed by the administrator. Furthermore, this application's embodiments also include a recovery stage. If a voter withdraws midway, the remaining participants can execute the recovery stage to renegotiate the key, ensuring the smooth progress of the voting process.
[0140] The on-chain voting method for blockchain governance proposed in this application obtains voting users who meet preset voting qualifications and generates voting public keys for these users based on preset private keys. A preset smart contract verifies the voting public keys, Schnorr zero-knowledge proofs, and Merkle tree qualification proofs. Upon successful verification, encrypted votes from the voting users are generated and stored in the preset smart contract. The method then determines whether any users abstain from voting. If no users abstain, the encrypted votes in the preset smart contract are tallied, and the vote count is stored in the same smart contract. Intermediate calculations of the vote count are stored and published in a Merkle tree structure. When all voting users agree, the vote count is used as the final voting result. This solves the problems of high cost and insufficient security in blockchain on-chain voting, reduces on-chain voting costs, improves on-chain voting security, and ensures smooth voting.
[0141] Next, referring to the accompanying drawings, an on-chain voting device for blockchain governance is described according to an embodiment of this application.
[0142] Figure 3 This is a block diagram of an on-chain voting device for blockchain governance according to an embodiment of this application.
[0143] like Figure 3 As shown, the on-chain voting device 10 for blockchain governance includes: an acquisition module 100, a judgment module 200, and a voting module 300.
[0144] The acquisition module 100 is used to acquire voting users who meet the preset voting qualifications, and generate voting public keys for voting users based on preset private keys. It uses a preset smart contract to verify the voting public keys, Schnorr zero-knowledge proofs, and Merkle tree qualification proofs. The judgment module 200 is used to generate encrypted votes for voting users after successful verification and store them in the preset smart contract, and determine whether there are any users who abstained from voting. The voting module 300 is used to count the encrypted votes on the preset smart contract if there are no users who abstained from voting, and store the vote count results in the preset smart contract. It also stores and publishes the intermediate calculation results of the vote count results in a Merkle tree structure, so that the vote count results can be used as the final voting results when all voting users agree.
[0145] Optionally, after determining whether there are users who abstain from voting among the voting users, the determination module 200 is specifically used to: if there are users who abstain from voting among the voting users, obtain the negotiation result of the voter who correctly executes the voting protocol; and based on the negotiation result, continue to execute the voting action.
[0146] Optionally, after storing and publishing the intermediate calculation results of the vote counting results in a Merkle tree structure, the voting module 300 is specifically used to: if one or more voting users disagree, raise an objection to the preset smart contract based on the Merkle tree data, and the preset smart contract will verify it.
[0147] Optionally, before obtaining voting users who meet the preset voting qualifications, module 100 is used to: initialize the running parameters of the current vote and deploy the preset smart contract; and construct a Merkle tree based on the addresses of voting users who meet the preset voting conditions.
[0148] Optionally, after obtaining the voting users who meet the preset voting qualifications, the acquisition module 100 is also used to: obtain the voting deposit of the voting users.
[0149] Optionally, after the vote count is taken as the final voting result, the voting module 300 is further configured to: if the voting process of a voting user meets the preset voting conditions, send the voting deposit to the corresponding voting user based on the preset smart contract.
[0150] It should be noted that the foregoing explanation of the on-chain voting method embodiment for blockchain governance also applies to the on-chain voting device for blockchain governance in this embodiment, and will not be repeated here.
[0151] The on-chain voting device for blockchain governance proposed in this application obtains voting users who meet preset voting qualifications, generates voting public keys for voting users based on preset private keys, and verifies the voting public keys, Schnorr zero-knowledge proofs, and Merkle tree qualification proofs using a preset smart contract. Upon successful verification, it generates encrypted votes for the voting users and stores them in the preset smart contract. It then determines whether any voting users abstain from voting. If no abstaining users are found, it counts the encrypted votes in the preset smart contract and stores the vote count results therein. Furthermore, it stores and publishes the intermediate calculation results of the vote count in a Merkle tree structure, so that the vote count results are used as the final voting results when all voting users agree. This solves the problems of high cost and insufficient security in blockchain on-chain voting, reduces on-chain voting costs, improves on-chain voting security, and ensures smooth voting.
[0152] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device may include:
[0153] The memory 401, the processor 402, and the computer program stored on the memory 401 and capable of running on the processor 402.
[0154] When the processor 402 executes the program, it implements the on-chain voting method for blockchain governance provided in the above embodiments.
[0155] Furthermore, electronic devices also include:
[0156] Communication interface 403 is used for communication between memory 401 and processor 402.
[0157] The memory 401 is used to store computer programs that can run on the processor 402.
[0158] The memory 401 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.
[0159] If the memory 401, processor 402, and communication interface 403 are implemented independently, then the communication interface 403, memory 401, and processor 402 can be interconnected via a bus to complete communication between them. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be divided into address buses, data buses, control buses, etc. For ease of representation, Figure 4 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0160] Optionally, in a specific implementation, if the memory 401, processor 402, and communication interface 403 are integrated on a single chip, then the memory 401, processor 402, and communication interface 403 can communicate with each other through an internal interface.
[0161] Processor 402 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application.
[0162] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described on-chain voting method for blockchain governance.
[0163] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0164] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0165] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more N executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.
[0166] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.
[0167] It should be understood that the various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, the N steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0168] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
[0169] Furthermore, the functional units in the various embodiments of this application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0170] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of this application.
Claims
1. An on-chain voting method for blockchain governance, characterized in that, Includes the following steps: Obtain voting users who meet the preset voting qualifications, and generate the voting public key of the voting users based on the preset private key. Use the preset smart contract to verify the voting public key, Schnorr zero-knowledge proof, and Merkle tree qualification proof. After successful verification, the encrypted vote of the voting user is generated and stored in the preset smart contract, and it is determined whether there are any users who abstained from voting among the voting users; as well as If none of the voting users are the users who abstained from voting, then the encrypted votes on the preset smart contract are counted, and the vote count results are stored in the preset smart contract. The intermediate calculation results of the vote count results are stored and published in the structure of the Merkle tree, so that when all the voting users agree, the vote count results are used as the final voting results. After determining whether any of the voting users abstained from voting, the process further includes: if such users exist, obtaining the negotiation result from the voters who correctly executed the voting protocol; and based on the negotiation result, continuing the voting process. During the voting phase, if any registered voter abstains from voting, the process enters a recovery phase. Voters who correctly executed the voting protocol then renegotiate to ensure the voting proceeds normally. If any of the abstaining voters are among the registered users, the set of voters who correctly executed the protocol is determined. ; For the set of voters who correctly execute the protocol During the restoration phase, the formula is used: Recalculate the public key To use the recalculated cryptographic public key Excluding the users who abstained from voting, where, The number of users who participated in the vote; according to Algorithm for constructing zero-knowledge proofs Send to the preset smart contract ( , ), For the voter's private key, For generators of cyclic groups, For voters public key, For voters The public key; The preset smart contract is verified using the verifyEqDL algorithm. , If the matching of ) passes the verification, then The results are recorded in the preset smart contract to obtain the negotiation results from voters who correctly executed the voting protocol, so that the voting action can continue. If the verification fails, the vote is rejected. The recovery phase, recorded in a pre-defined smart contract, essentially involves recalculating the encrypted public key to exclude voters who abstained midway through the vote counting process. Furthermore, the inclusion of the recovery phase does not affect the normal execution of the vote counting process. After storing and publishing the intermediate calculation results of the vote counting results in the Merkle tree structure, the method further includes: If one or more of the voting users disagree, a challenge is raised to the preset smart contract based on the data from the Merkle tree, and the preset smart contract verifies the challenge.
2. The method according to claim 1, characterized in that, Before obtaining voting users who meet the preset voting qualifications, the process also includes: Initialize the current voting parameters and deploy the preset smart contract; The Merkle tree is constructed based on the addresses of voting users who meet the preset voting conditions.
3. The method according to claim 1, characterized in that, After obtaining voting users who meet the preset voting qualifications, the process also includes: Obtain the voting deposit of the voting user.
4. The method according to claim 3, characterized in that, After using the vote count as the final voting result, the process also includes: If the voting process of the voting user meets the preset voting conditions, the voting deposit will be sent to the corresponding voting user based on the preset smart contract.
5. An on-chain voting device for blockchain governance, characterized in that, include: The acquisition module is used to acquire voting users who meet the preset voting qualifications, generate the voting public key of the voting users based on the preset private key, and verify the voting public key, Schnorr zero-knowledge proof, and Merkle tree qualification proof using a preset smart contract. The judgment module is used to generate the encrypted vote of the voting user after the verification is passed, and store it in the preset smart contract, and determine whether there are any users who abstained from voting among the voting users; as well as The voting module is used to count the encrypted votes on the preset smart contract if there are no users who abstained from voting among the voting users, and store the vote count results in the preset smart contract. The intermediate calculation results of the vote count results are stored and published in the structure of the Merkle tree, so that when all voting users agree, the vote count results are used as the final voting results. After determining whether any of the voting users abstained from voting, the determining module is specifically configured to: if any of the voting users abstained from voting, obtain the negotiation result from the voters who correctly executed the voting protocol; and based on the negotiation result, continue to execute the voting action. During the voting phase, if any registered voter abstains from voting, the process enters a recovery phase. Voters who correctly executed the voting protocol then renegotiate to ensure the voting proceeds normally. If any of the abstaining voters are among the registered users, the set of voters who correctly executed the protocol is determined. ; For the set of voters who correctly execute the protocol During the restoration phase, the formula is used: Recalculate the public key To use the recalculated cryptographic public key Excluding the users who abstained from voting, where, The number of users who participated in the vote; according to Algorithm for constructing zero-knowledge proofs Send to the preset smart contract ( , ), For the voter's private key, For generators of cyclic groups, For voters public key, For voters The public key; The preset smart contract is verified using the verifyEqDL algorithm. , If the matching of ) passes the verification, then The results are recorded in the preset smart contract to obtain the negotiation results from voters who correctly executed the voting protocol, so that the voting action can continue. If the verification fails, the vote is rejected. The recovery phase is essentially a process of recalculating the encrypted public key to exclude voters who abstain midway through the vote counting process. The inclusion of the recovery phase does not affect the normal execution of the vote counting process. After storing and publishing the intermediate calculation results of the vote counting results in the structure of the Merkle tree, the voting module is specifically used to: if one or more of the voting users disagree, raise a challenge to the preset smart contract based on the data of the Merkle tree, and the preset smart contract will verify it.
6. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, the processor executing the program to implement the on-chain voting method for blockchain governance as described in any one of claims 1-4.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, The program is executed by the processor to implement the on-chain voting method for blockchain governance as described in any one of claims 1-4.
Citation Information
Patent Citations
Fair block chain voting method and system for ensuring rights and interests of voting initiators
CN112581132A
Election method based on block chain
CN113285799A
