CN117793126A - Block chain-based on-chain voting method, device, equipment and storage medium - Google Patents

Block chain-based on-chain voting method, device, equipment and storage medium Download PDF

Info

Publication number
CN117793126A
CN117793126A CN202311797317.8A CN202311797317A CN117793126A CN 117793126 A CN117793126 A CN 117793126A CN 202311797317 A CN202311797317 A CN 202311797317A CN 117793126 A CN117793126 A CN 117793126A
Authority
CN
China
Prior art keywords
vdf
calculation
voting
time
node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311797317.8A
Other languages
Chinese (zh)
Inventor
胡朝新
张俊麒
苏小康
张开翔
范瑞彬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
WeBank Co Ltd
Original Assignee
WeBank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by WeBank Co Ltd filed Critical WeBank Co Ltd
Priority to CN202311797317.8A priority Critical patent/CN117793126A/en
Publication of CN117793126A publication Critical patent/CN117793126A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The embodiment of the application provides a chain voting method, device, equipment and storage medium based on a block chain, which relate to the technical field of block chains, and a time proving node performs VDF calculation in the voting process of a voting node. And when the voting is finished, the time proving node determines the height difference of the target block based on the first block height of the target block corresponding to the voting finishing moment and the second block height of the starting block corresponding to the voting starting moment, and provides a plurality of VDF calculation results covering the height difference of the target block, namely VDF time proving when the voting corresponding to the height difference of the target block is finished. And sending the VDF time evidence to a verification node for verification, and when the verification is passed and the total computation time length corresponding to a plurality of VDF computation results is determined, triggering the on-chain voting when the time difference of the voting time length corresponding to the target block height difference is within a preset range, so that the situation that a voter takes out blocks in advance or delays out blocks is effectively avoided, and the fairness of the on-chain voting and the accuracy of the voting result are ensured.

Description

Block chain-based on-chain voting method, device, equipment and storage medium
Technical Field
The embodiment of the application relates to the technical field of blockchains, in particular to a blockchain-based on-chain voting method, a blockchain-based on-chain voting device, blockchain voting equipment and a blockchain-based on-chain voting storage medium.
Background
With the development of blockchain technology, more and more applications are aggregated based on blockchain data, and typical usage scenarios include: on-chain distributed predictors, on-chain random number generators, on-chain consensus, on-chain voting, and the like.
In real life, most voting scenarios have one feature: a plurality of voting phases and counting phases that occur repeatedly, and the starting time of each counting phase is uncertain, i.e. real-world objective factors lead to unpredictable starting times of the counting and may trigger at any time.
In this scenario, when the externally triggered voting ends (i.e., the ballot begins), the voter ends the ballot and encapsulates the transaction record of the end of the ballot in a block and out of the block. Normally, the frequency of blockchain out blocks is fixed, such as out a block every t seconds. When the voter does not act, the block is output at the end of the countdown of t seconds, and the time of the output block is taken as the voting end time.
However, the condition that the voter takes out the block is that the voter completes the SHA256 nonce calculation, so when the voter knows that the voting result corresponding to the external trigger voting end time is unfavorable for the voter, the voter may take out the block before the end of t seconds or delay the block after the end of t seconds, so that the actual voting end time deviates from the normal voting end time corresponding to the external trigger voting end, and the voting result is evolved in the direction of the voter favorable for taking the block in advance or delay, thus affecting the fairness of the voting on the chain and the accuracy of the voting result.
Disclosure of Invention
The embodiment of the application provides a chain voting method, device, equipment and storage medium based on a blockchain, which are used for improving fairness of voting on a sound chain and accuracy of voting results.
In one aspect, an embodiment of the present application provides a blockchain-based on-chain voting method applied to a time proving node, the method including:
receiving a first block height of a target block corresponding to a voting ending time sent by a voting node;
determining a target block height difference based on the first block height and a second block height of a starting block corresponding to the voting starting time;
obtaining a plurality of VDF calculation results covering the target block height difference from a verifiable delay function VDF calculation result set, wherein each VDF calculation result corresponds to one calculation time length;
the plurality of VDF calculation results are sent to a verification node, so that the verification node verifies the plurality of VDF calculation results, and when verification passes, the total calculation time length corresponding to the plurality of VDF calculation results and the time difference of the voting time length corresponding to the target block height difference are determined; and if the time difference is within the preset range, triggering the on-chain ticket counting.
In one aspect, an embodiment of the present application provides a chain voting method based on a blockchain, which is applied to a voting node, and includes:
When the voting is finished, the first block height of the target block corresponding to the voting finishing moment is sent to a time proving node; the time proving node determines a target block height difference based on the first block height and a second block height of a starting block corresponding to the voting starting time; obtaining a plurality of VDF calculation results covering the target block height difference from a VDF calculation result set, wherein each VDF calculation result corresponds to one calculation time length; the plurality of VDF calculation results are sent to a verification node, so that the verification node verifies the plurality of VDF calculation results, and when verification passes, the total calculation time length corresponding to the plurality of VDF calculation results and the time difference of the voting time length corresponding to the target block height difference are determined; and if the time difference is within the preset range, triggering the on-chain ticket counting.
In one aspect, an embodiment of the present application provides a chain voting method based on a blockchain, which is applied to a verification node, including:
receiving a plurality of VDF calculation results which are transmitted by a time proving node and cover a target block height difference, wherein the target block height difference is: a block height difference between a first block height of a target block corresponding to the voting ending time and a second block height of a starting block corresponding to the voting starting time; the plurality of VDF calculation results are obtained from a VDF calculation result set, and each VDF calculation result corresponds to one calculation time length;
Verifying the plurality of VDF calculation results, and determining the total calculation time length corresponding to the plurality of VDF calculation results and the time difference of the voting time length corresponding to the target block height difference when the verification is passed;
and if the time difference is within the preset range, triggering the on-chain ticket counting.
In one aspect, an embodiment of the present application provides a block chain-based on-chain voting apparatus, applied to a time proving node, including:
the first receiving module is used for receiving a first block height of a target block corresponding to the voting ending time sent by the voting node;
the time proving module is used for determining a target block height difference based on the first block height and the second block height of the starting block corresponding to the voting starting time; obtaining a plurality of VDF calculation results covering the target block height difference from a verifiable delay function VDF calculation result set, wherein each VDF calculation result corresponds to one calculation time length;
the first sending module is used for sending the plurality of VDF calculation results to a verification node so that the verification node verifies the plurality of VDF calculation results, and when verification passes, the total calculation time length corresponding to the plurality of VDF calculation results and the time difference of the voting time length corresponding to the target block height difference are determined; and if the time difference is within the preset range, triggering the on-chain ticket counting.
Optionally, the time proving module is further configured to:
creating a plurality of VDF computation pipelines, the configuration parameters of each VDF computation pipeline comprising: calculating the calculation time length of each VDF calculation, wherein the ratio of the calculation time length to the block-out time length is a positive integer;
for each VDF calculation pipeline, repeatedly executing the VDF calculation on the VDF calculation pipeline based on the configuration parameters of the VDF calculation pipeline to obtain a VDF calculation result on the VDF calculation pipeline;
and obtaining the VDF calculation result set based on the VDF calculation results on the plurality of VDF calculation pipelines.
Optionally, the configuration parameters further include: VDF formula and proof algorithm combination;
the time proving module is specifically used for:
for each VDF computation on the VDF computation pipeline, comprising the operations of:
selecting one proving algorithm from the proving algorithm combination; performing VDF calculation based on calculation parameters corresponding to the parameter and the calculation time length through the VDF calculation formula and the one proving algorithm to obtain a VDF calculation result;
wherein, when performing the first VDF calculation, the parameters are: hash value of current block and hash value of voting start sign that the said voting node sends block height; when performing non-first VDF calculations, the entries are: the hash value and block height of the current block.
Optionally, the first receiving module is further configured to:
the method comprises the steps that based on configuration parameters of the VDF calculation pipeline, VDF calculation on the VDF calculation pipeline is repeatedly executed, and before a VDF calculation result on the VDF calculation pipeline is obtained, a voting start mark sent by a voting node is received, wherein the voting start mark is determined by the voting node based on a hash value of the starting block and the second block height;
the first sending module is further configured to:
sending a corresponding response message to the voting node so that the voting node sends the hash value of the voting start mark to the verification node;
the first sending module is further configured to:
after creating a plurality of VDF computation pipelines, sending hash values of configuration parameters of the plurality of VDF computation pipelines to the verification node.
In one aspect, an embodiment of the present application provides a block chain-based on-chain voting apparatus, applied to a voting node, including:
the second sending module is used for sending the first block height of the target block corresponding to the voting ending moment to the time proving node when the voting is ended; the time proving node determines a target block height difference based on the first block height and a second block height of a starting block corresponding to the voting starting time; obtaining a plurality of VDF calculation results covering the target block height difference from a VDF calculation result set, wherein each VDF calculation result corresponds to one calculation time length; the plurality of VDF calculation results are sent to a verification node, so that the verification node verifies the plurality of VDF calculation results, and when verification passes, the total calculation time length corresponding to the plurality of VDF calculation results and the time difference of the voting time length corresponding to the target block height difference are determined; and if the time difference is within the preset range, triggering the on-chain ticket counting.
In one aspect, an embodiment of the present application provides a block chain-based on-chain voting apparatus, applied to a verification node, including:
the second receiving module is configured to receive a plurality of VDF calculation results covering a target block height difference sent by the time proving node, where the target block height difference is: a block height difference between a first block height of a target block corresponding to the voting ending time and a second block height of a starting block corresponding to the voting starting time; the plurality of VDF calculation results are obtained from a VDF calculation result set, and each VDF calculation result corresponds to one calculation time length;
the verification module is used for verifying the plurality of VDF calculation results and determining the total calculation time length corresponding to the plurality of VDF calculation results and the time difference of the voting time length corresponding to the target block height difference when the verification is passed;
and if the time difference is within the preset range, triggering the on-chain ticket counting.
Optionally, each VDF calculation includes: parameter entering, VDF calculation results, proving and calculating parameters;
the verification module is specifically configured to:
verifying the enrollment for each VDF calculation based on the VDF formula result and the proof;
and acquiring configuration parameters of a VDF computing pipeline corresponding to the VDF computing result, and verifying whether the computing parameters correspond to computing time periods in the configuration parameters.
Optionally, the VDF calculation result further includes: a proof algorithm;
the verification module is further configured to:
and determining the total calculation time length corresponding to the plurality of VDF calculation results, and determining the proving algorithm as one proving algorithm in the proving algorithm combination in the configuration parameters according to each VDF calculation result before the time difference of the voting time length corresponding to the target block height difference.
In one aspect, embodiments of the present application provide a computer device including a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the blockchain-based on-chain voting method described above when the program is executed.
In one aspect, embodiments of the present application provide a computer-readable storage medium storing a computer program executable by a computer device, which when run on the computer device, causes the computer device to perform the steps of the blockchain-based on-chain voting method described above.
In the embodiment of the application, in the process of voting by the voting node, the time proving node performs VDF calculation and obtains a VDF calculation result. And when the voting is finished, the time proving node determines the height difference of the target block based on the first block height of the target block corresponding to the voting finishing moment and the second block height of the starting block corresponding to the voting starting moment, and provides a plurality of VDF calculation results covering the height difference of the target block, namely, VDF time proving under the condition of providing the voting duration corresponding to the height difference of the target block. And then, the VDF time evidence is sent to a verification node for verification, when verification is passed, the total computation time length corresponding to a plurality of VDF computation results is determined, and the time difference of the voting time length corresponding to the target block height difference is within a preset range, the on-chain voting is triggered, so that the situation that a voter takes out blocks in advance or delays out blocks is effectively avoided, and the fairness of the on-chain voting and the accuracy of the voting result are ensured.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments will be briefly described below, it will be apparent that the drawings in the following description are only some embodiments of the present invention, and that other drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of a VDF operation flow provided in an embodiment of the present application;
fig. 2A is a schematic structural diagram of a system architecture according to an embodiment of the present application;
FIG. 2B is a flowchart of a block chain based on-chain voting method according to an embodiment of the present application;
FIG. 3 is a flowchart of a block chain based on-chain voting method according to an embodiment of the present application;
FIG. 4 is a schematic flow chart of a time proving method according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a block chain based on-chain voting apparatus according to an embodiment of the present application;
FIG. 6 is a schematic diagram of a block chain based on-chain voting apparatus according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantageous effects of the present invention more apparent, the present invention will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
For ease of understanding, the terms involved in the embodiments of the present invention are explained below.
The delay verification function (Verifiable Delay Function, VDF for short) needs to satisfy the following conditions:
time consuming: the computational requirements are time consuming; and (3) quick verification: the verification duration of the calculation result needs to be significantly, at least logarithmically, smaller than the duration of the calculation; uniqueness: i.e. the same input corresponds to a unique output result (but no uniqueness is required for the proof of the result); serial nature: i.e. the probability that an attacker wants to calculate the result of VDF in less than T is negligible.
The operation flow of VDF is shown in fig. 1 below, and VDF generally includes three flows: initialization phase Setup, calculation phase Eval and verification phase Verify.
The initialization stage Setup receives the modulus parameter λ and the time parameter τ, generating the calculation parameter ek and the verification parameter vk. The calculation phase Eval receives the calculation parameters ek and the input x, and generates the function result y and the proof pi for a sufficiently long time. The verification stage receives vk, x, y and pi, quickly verifies and outputs pass or fail.
In use in the actual industry, the most common VDF equation (i.e., computing stage Eval in fig. 1) generally corresponds to the following iterative flattening (1):
wherein N is a modulus parameter lambda in the public parameters, and T is a time parameter tau.
That is, the input parameter x is squared, the squared result is continued to be squared for T times, and finally the result is left over N to obtain the function result y. The repetition of the squaring is not parallelizable and the final result cannot be displayed until the last squaring, thus meeting the time consuming, uniqueness requirements of the VDF algorithm.
Second, the calculator needs to provide a proof pi in order to meet the needs of VDF to be easily validated. The proof pi meeting the condition has various forms, and different proof pi can be sent to the applicant together with the function result y, and the applicant executes the verification stage Verify to Verify. The time taken to verify the result by y and pi should be much smaller than the computation time of the computation phase Eval and negligible compared to the duration of the computation phase Eval.
Referring to fig. 2A, a system architecture diagram applicable to an embodiment of the present application includes at least: voting node 201, time proving node 202, verification node 203; the number of voting nodes 201 may be one or more; likewise, the number of time proving nodes 202 and verifying nodes 203 may be one or more; the number of voting nodes 201, time proving nodes 202, and verification nodes 203 is not particularly limited in this application.
The voting node 201 may be a terminal device such as, but not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart home appliance, a smart voice interaction device, a smart car-mounted device, etc.
The voting node 201 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), basic cloud computing services such as big data and artificial intelligence platforms, and the like.
Likewise, the time proving node 202 and the verifying node 203 may also be terminal devices or servers, which are not described here again. The voting node 201, the time proving node 202 and the verifying node 203 may be directly or indirectly connected through wired or wireless communication, which is not limited herein.
In addition, the validation node 203 may also be a validation contract that the voting node 201 and the time proof node 202 together deploy on the blockchain. Both the voting node 201 and the time proving node 202 have access to the blockchain, wherein the voting node 201 has read-write rights and the time proving node 202 has read-only rights. Time proving node 202 also refers to: VDF calculator. The blockchain uses PoW (proof of workload) as a consensus mechanism for the out-blocks, requiring that the frequency of the blockchain out-blocks be fixed.
The whole on-chain voting process comprises four stages, namely an initialization stage, a voting stage, a verification stage and a vote counting stage.
The initialization phase needs to be executed once, and specifically comprises the following steps:
voting node 201 deploys voting contracts and counting contracts on the blockchain to implement the on-chain voting process.
Together, voting node 201 and time proof node 202 deploy validation contracts on the blockchain that require the following capabilities:
1. recording hash values of configuration parameters of each VDF calculation pipeline;
2. recording a voting start mark (TokenHash) of each round of voting period;
3. has the ability to verify the VDF equation.
The time proving node 202 obtains the out-block duration t of the blockchain and sets it to the base of the common VDF algorithm time parameter (i.e., the computation duration of the VDF computation). Let t=15s.
The time proofing node 202 creates a plurality of VDF computation pipelines, the configuration parameters of each VDF computation pipeline including: calculation duration τ of each VDF calculation p . Calculation time period tau of different VDF calculation pipelines p Is different, the calculation starting time of different VDF calculation pipelines is set according to the actual situation, so that by accumulating different tau in the time domain p The non-negative integer multiple of t which is arbitrarily large can be covered, so that the voting time period which is arbitrarily long can be ensured, and different VDF calculation results can be combined to be matched with the voting time period.
In some embodiments, the time period τ is calculated p The ratio of the block-out duration t is a positive integer.
For example, 4 VDF computation pipelines are created, and the computation time lengths of the 4 VDF computation pipelines are respectively: τ 1 =t,τ 2 =2t,τ 3 =4t,τ 4 =8t, the calculation start times of the 4 VDF calculation pipelines are the same.
For example, 2 VDF computation pipelines are created, each of the 2 VDF computation pipelinesThe self calculation time periods are respectively as follows: τ 1 =τ 2 =2t, the 1 st VDF computation pipeline is separated from the computation start time of the 2 nd VDF computation pipeline by t.
The time proofing node 202 selects, for each VDF computation pipeline, a corresponding VDF expression and a proofing algorithm combination, wherein the proofing algorithm combination includes a plurality of proofing algorithms. To at a specified tau p And obtaining a calculation result correspondingly to obtain a calculation parameter eki.
The time proofing node 202 calculates the number of VDF calculation pipelines, the configuration parameters of each VDF calculation pipeline (i.e., the calculation time period τ p VDF formula, proof algorithm combination) to voting node 201.
The time proofing node 202 calculates the number of VDF calculation pipelines, the configuration parameters of each VDF calculation pipeline (i.e., the calculation time period τ p VDF formula and attestation algorithm combination) and then performing hash computation to obtain a verification contract with hash value written on the blockchain.
Since voting and counting are perpetual in practical applications, the voting, verification and counting phases described above require multiple rounds to be performed.
Overall, referring to fig. 2B, the single round chain voting process includes: a voting stage, a verification stage and a counting stage. In the voting stage, when the voting starts, VDF calculation is triggered, and simultaneously the voting node continuously performs the voting in the voting process, and the result is written into a voting contract. When some external factor triggers the voting to end, the VDF computation also ends. In the verification stage, the time proving node provides a group of spliced VDF calculation results meeting the requirements according to the actual voting time length of the current round and sends the calculation results to a verification contract for verification. In the counting stage, if the verification is passed, the counting is triggered, the counting result is written into the counting contract, and then the round is ended, otherwise, the counting cannot be triggered, and the whole flow is ended. In addition, the verification phase in this application supports plug and play.
The voting process on the single round chain is specifically described below.
Based on the system architecture diagram shown in fig. 2A, the embodiment of the present application provides a flow of a block chain-based on-chain voting method, and as shown in fig. 3, the flow of the method is interactively executed by a voting node, a time proving node and a verification node, and includes the following steps:
In step S301, when the voting is completed, the voting node transmits the first block height of the target block corresponding to the voting completion time to the time proving node.
At the beginning of the vote, the voting node determines a voting start flag based on the hash value of the starting block and the second block height, and then sends the voting start flag to the time proving node. The time proving node sends a corresponding response message to the voting node, and the voting node sends the hash value of the voting start mark to the verification node.
Specifically, the starting block is the block corresponding to the starting time of the voting stage of the round on the block chain. The voting start flag is a Token (in the form of a string) for the voting stage of the present round, and is used to record the hash value of the starting block and the second block height.
When the voting starts, the voting node starts the voting process to vote, and writes the result into the voting contract. In addition, when voting starts, according to the set calculation starting time, the time proving node repeatedly executes the VDF calculation on the VDF calculation pipeline based on the configuration parameters of the VDF calculation pipeline to obtain the VDF calculation result on the VDF calculation pipeline. Each time a VDF calculation is performed on the VDF calculation pipeline, a VDF calculation result can be obtained. A set of VDF calculation results is obtained based on the VDF calculation results on the plurality of VDF calculation pipelines.
In some embodiments, for each VDF computation on the VDF computation pipeline, the following operations are included:
and selecting one proving algorithm from the proving algorithm combination, wherein the proving algorithm can be selected in a random mode or in a sequential mode. And performing VDF calculation based on calculation parameters corresponding to the parameter entering and calculation time length through a VDF calculation formula and a proving algorithm to obtain a VDF calculation result.
Wherein, when performing the first VDF calculation, the parameters are as follows: hash value of current block and hash value of voting start flag sent by voting node.
Specifically, the hash value BlockHash of the current block, the block height BlockHeight of the current block, and the hash value TokenHash of the vote start flag are concatenated as the calculated entry x, and at this time, the VDF calculation may be expressed as the following formula (1):
wherein y is p Represents the result of VDF expression, pi p Representation proof ek i Representing the calculated parameters, ||representing the splice.
When performing non-first VDF calculations, the parameters are: the hash value and block height of the current block.
Specifically, the hash value BlockHash of the current block and the block height BlockHeight of the current block are spliced as the calculated input parameter x, and at this time, the VDF calculation can be expressed as the following formula (2):
Wherein y is p Represents the result of VDF expression, pi p Representation proof ek i Representing the calculated parameters, ||representing the splice.
It should be noted that, the VDF calculation is repeatedly executed on the VDF calculation pipeline, after the VDF calculation is executed once, a proving algorithm is randomly selected from the proving algorithm combination, then the VDF calculation is performed again based on the calculation parameters corresponding to the parameter entering and the calculation duration through the VDF calculation formula and the selected proving algorithm, so as to obtain a VDF calculation result, and so on. Of course, after the execution of one VDF calculation, the next VDF calculation may be executed at intervals of a preset duration, which is not specifically limited in this application.
When the voting is triggered to be finished due to external reasons, the voting node finishes the voting, and the first block height of the target block corresponding to the voting finishing moment and the block information of the target block are sent to the time proving node. At the end of the vote, the VDF computation on each VDF computation pipeline is stopped.
In step S302, the time proving node determines the target block height difference based on the first block height and the second block height of the starting block corresponding to the voting start time.
In step S303, the time proving node obtains a plurality of VDF calculation results covering the target block height difference from the verifiable delay function VDF calculation result set.
In step S304, the time proving node transmits the plurality of VDF calculation results to the verification node.
Specifically, the VDF computation result set includes the products of all VDF computation pipelines, that is, VDF computation results obtained on all VDF computation pipelines, and each VDF computation result corresponds to a computation time.
For example, referring to fig. 4, 4 VDF computation pipelines are pre-established, and the computation durations of the 4 VDF computation pipelines are respectively: τ 1 =t,τ 2 =2t,τ 3 =4t,τ 4 =8t。
At the voting start time, the VDF computation pipeline 1 starts to execute VDF computation to obtain a VDF computation result (1.1); then, the VDF calculation is performed again, and a VDF calculation result (1.2) is obtained. After the interval duration 4t, the VDF calculation is performed again, obtaining a VDF calculation result (1.3).
At the voting start time, the VDF computation pipeline 2 continuously executes VDF computation three times, obtaining a VDF computation result (2.1), a VDF computation result (2.2), and a VDF computation result (2.3).
At the voting start time, the VDF computation pipeline 3 does not immediately execute the VDF computation, but executes the VDF computation after an interval period of 2t, obtaining a VDF computation result (3.1). The VDF computation is not continued later.
At the voting start time, the VDF computation pipeline 4 does not perform VDF computation.
The second block height of the starting block corresponding to the voting starting time is: 2, the first block height of the target block corresponding to the voting ending time is: 9, the target block height difference is 7.
As can be seen from fig. 4, a plurality of VDF calculation results conforming to the target block height difference are combined. For example, combination 1: (1.1), (1.2), (2.2), (2.3), (1.3); combination 2: (2.1), (2.2), (2.3), (1.3); combination 3: (2.1), (3.1), (1.3); other combinations are not described in detail.
Selecting the combination 2 and sending each VDF calculation result in the combination 2 to the verification node.
In step S305, the verification node verifies the plurality of VDF calculation results.
In step S306, when the verification is passed, the verification node determines the total computation time length corresponding to the plurality of VDF computation results, and the time difference of the voting time length corresponding to the target block height difference.
In some embodiments, each VDF calculation includes: parameters are entered, VDF calculation results, proved and calculated. For each VDF calculation result, verifying the enrollment based on the VDF calculation result and the proof. In addition, the configuration parameters of the VDF calculation pipeline corresponding to the VDF calculation result are obtained, and whether the calculation parameters correspond to calculation time periods in the configuration parameters is verified.
Specifically, the verification contract is used to calculate the certificate by using a VDF verification algorithm, verify whether the certificate can obtain a VDF calculation result y based on the input parameter x, and confirm the calculation parameter ek i Whether or not the calculated time period tau is satisfied p Is that the VDF calculation does need to go through at least τ p Is a time period of (2).
In some embodiments, each VDF calculation further comprises: the algorithm is demonstrated. And determining the total computation time length corresponding to the plurality of VDF computation results, and determining the proving algorithm as one proving algorithm in the proving algorithm combination in the configuration parameters for each VDF computation result before the time difference of the voting time length corresponding to the target block height difference.
Step S307, if the time difference is within the preset range, the verification node triggers the on-chain ticket counting.
Specifically, the preset range is equal to or greater than 0 and equal to or less than the network communication time difference. The network communication time difference is determined according to the actual network state, for example, two out-block durations.
When the time difference is less than 0, the voter delays out of the block, and the on-chain ticketing is not triggered.
When the time difference is larger than the network communication time difference, the voter is indicated to go out of the block in advance, and the on-chain counting is not triggered.
In the embodiment of the application, in the process of voting by the voting node, the time proving node performs VDF calculation and obtains a VDF calculation result. And when the voting is finished, the time proving node determines the height difference of the target block based on the first block height of the target block corresponding to the voting finishing moment and the second block height of the starting block corresponding to the voting starting moment, and provides a plurality of VDF calculation results covering the height difference of the target block, namely, VDF time proving under the condition of providing the voting duration corresponding to the height difference of the target block. And then, the VDF time evidence is sent to a verification node for verification, when verification is passed, the total computation time length corresponding to a plurality of VDF computation results is determined, and the time difference of the voting time length corresponding to the target block height difference is within a preset range, the on-chain voting is triggered, so that the situation that a voter takes out blocks in advance or delays out blocks is effectively avoided, and the fairness of the on-chain voting and the accuracy of the voting result are ensured.
Since the voter can hardly give the VDF calculation result of the same duration by taking a significant advantage in calculation power in the time difference from the end of voting to the verification of the VDF calculation result by the verification node, it is possible to resist an attack of advancing or retarding out the block. The only possible way for voters to attack is to forge the identity of the VDF calculator and build a similar VDF pipeline at the same time, but with great difficulty. In addition, the calculation of the VDF is parallel to the voting, the overall voting time length is not greatly influenced, and the newly added verification process only involves verification of the VDF certification, and the verification time length is far less than the calculation time length.
Based on the same technical concept, the embodiment of the present application provides a schematic structural diagram of a block-chain-based on-chain voting device, as shown in fig. 5, where the block-chain-based on-chain voting device 500 includes:
a first receiving module 501, configured to receive a first block height of a target block corresponding to a voting end time sent by a voting node;
the time proving module 502 is configured to determine a target block height difference based on the first block height and a second block height of a starting block corresponding to a voting start time; obtaining a plurality of VDF calculation results covering the target block height difference from a verifiable delay function VDF calculation result set, wherein each VDF calculation result corresponds to one calculation time length;
A first sending module 503, configured to send the multiple VDF calculation results to a verification node, so that the verification node verifies the multiple VDF calculation results, and when verification passes, determine a total computation time length corresponding to the multiple VDF calculation results, and a time difference of a voting time length corresponding to the target block height difference; and if the time difference is within the preset range, triggering the on-chain ticket counting.
Optionally, the time proving module 502 is further configured to:
creating a plurality of VDF computation pipelines, the configuration parameters of each VDF computation pipeline comprising: calculating the calculation time length of each VDF calculation, wherein the ratio of the calculation time length to the block-out time length is a positive integer;
for each VDF calculation pipeline, repeatedly executing the VDF calculation on the VDF calculation pipeline based on the configuration parameters of the VDF calculation pipeline to obtain a VDF calculation result on the VDF calculation pipeline;
and obtaining the VDF calculation result set based on the VDF calculation results on the plurality of VDF calculation pipelines.
Optionally, the configuration parameters further include: VDF formula and proof algorithm combination;
the time proving module 502 is specifically configured to:
for each VDF computation on the VDF computation pipeline, comprising the operations of:
Selecting one proving algorithm from the proving algorithm combination; performing VDF calculation based on calculation parameters corresponding to the parameter and the calculation time length through the VDF calculation formula and the one proving algorithm to obtain a VDF calculation result;
wherein, when performing the first VDF calculation, the parameters are: hash value of current block and hash value of voting start sign that the said voting node sends block height; when performing non-first VDF calculations, the entries are: the hash value and block height of the current block.
Optionally, the first receiving module 501 is further configured to:
the method comprises the steps that based on configuration parameters of the VDF calculation pipeline, VDF calculation on the VDF calculation pipeline is repeatedly executed, and before a VDF calculation result on the VDF calculation pipeline is obtained, a voting start mark sent by a voting node is received, wherein the voting start mark is determined by the voting node based on a hash value of the starting block and the second block height;
the first sending module 501 is further configured to:
sending a corresponding response message to the voting node so that the voting node sends the hash value of the voting start mark to the verification node;
the first sending module 501 is further configured to:
After creating a plurality of VDF computation pipelines, sending hash values of configuration parameters of the plurality of VDF computation pipelines to the verification node.
Based on the same technical concept, the embodiment of the present application provides a schematic structural diagram of a block-chain-based on-chain voting device, as shown in fig. 6, the block-chain-based on-chain voting device 600 includes:
a second receiving module 601, configured to receive a plurality of VDF calculation results covering a target block height difference sent by a time proving node, where the target block height difference is: a block height difference between a first block height of a target block corresponding to the voting ending time and a second block height of a starting block corresponding to the voting starting time; the plurality of VDF calculation results are obtained from a VDF calculation result set, and each VDF calculation result corresponds to one calculation time length;
the verification module 602 is configured to verify the multiple VDF calculation results, and determine a total computation time length corresponding to the multiple VDF calculation results and a time difference of a voting time length corresponding to the target block height difference when the verification passes;
and if the time difference is within the preset range, triggering the on-chain ticket counting.
Optionally, each VDF calculation includes: parameter entering, VDF calculation results, proving and calculating parameters;
The verification module 602 is specifically configured to:
verifying the enrollment for each VDF calculation based on the VDF formula result and the proof;
and acquiring configuration parameters of a VDF computing pipeline corresponding to the VDF computing result, and verifying whether the computing parameters correspond to computing time periods in the configuration parameters.
Optionally, the VDF calculation result further includes: a proof algorithm;
the verification module 602 is further configured to:
and determining the total calculation time length corresponding to the plurality of VDF calculation results, and determining the proving algorithm as one proving algorithm in the proving algorithm combination in the configuration parameters according to each VDF calculation result before the time difference of the voting time length corresponding to the target block height difference.
In the embodiment of the application, in the process of voting by the voting node, the time proving node performs VDF calculation and obtains a VDF calculation result. And when the voting is finished, the time proving node determines the height difference of the target block based on the first block height of the target block corresponding to the voting finishing moment and the second block height of the starting block corresponding to the voting starting moment, and provides a plurality of VDF calculation results covering the height difference of the target block, namely, VDF time proving under the condition of providing the voting duration corresponding to the height difference of the target block. And then, the VDF time evidence is sent to a verification node for verification, when verification is passed, the total computation time length corresponding to a plurality of VDF computation results is determined, and the time difference of the voting time length corresponding to the target block height difference is within a preset range, the on-chain voting is triggered, so that the situation that a voter takes out blocks in advance or delays out blocks is effectively avoided, and the fairness of the on-chain voting and the accuracy of the voting result are ensured.
Based on the same technical concept, the embodiment of the present application provides a computer device, which may be the voting node 201, the time proving node 202, and the verification node 203 shown in fig. 2A, and as shown in fig. 7, includes at least one processor 701, and a memory 702 connected to the at least one processor, where a specific connection medium between the processor 701 and the memory 702 is not limited in the embodiment of the present application, and in fig. 7, the processor 701 and the memory 702 are connected by a bus, for example. The buses may be divided into address buses, data buses, control buses, etc.
In the embodiment of the present application, the memory 702 stores instructions executable by the at least one processor 701, and the at least one processor 701 may perform the steps of the above-described blockchain-based on-chain voting method by executing the instructions stored in the memory 702.
Where the processor 701 is the control center of a computer device, various interfaces and lines may be utilized to connect the various portions of the computer device to implement in-chain voting by running or executing instructions stored in the memory 702 and invoking data stored in the memory 702. Alternatively, the processor 701 may include one or more processing units, and the processor 701 may integrate an application processor and a modem processor, wherein the application processor primarily processes an operating system, a user interface, and application programs, etc., and the modem processor primarily processes wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 701. In some embodiments, processor 701 and memory 702 may be implemented on the same chip, or they may be implemented separately on separate chips in some embodiments.
The processor 701 may be a general purpose processor such as a Central Processing Unit (CPU), digital signal processor, application specific integrated circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, and may implement or perform the methods, steps, and logic blocks disclosed in embodiments of the present application. The general purpose processor may be a microprocessor or any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present application may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in the processor for execution.
The memory 702 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The Memory 702 may include at least one type of storage medium, and may include, for example, flash Memory, hard disk, multimedia card, card Memory, random access Memory (Random Access Memory, RAM), static random access Memory (Static Random Access Memory, SRAM), programmable Read-Only Memory (Programmable Read Only Memory, PROM), read-Only Memory (ROM), charged erasable programmable Read-Only Memory (Electrically Erasable Programmable Read-Only Memory), magnetic Memory, magnetic disk, optical disk, and the like. Memory 702 is any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer device, but is not limited to such. The memory 702 in the embodiments of the present application may also be circuitry or any other device capable of implementing a memory function for storing program instructions and/or data.
Based on the same inventive concept, embodiments of the present application provide a computer-readable storage medium storing a computer program executable by a computer device, which when run on the computer device, causes the computer device to perform the steps of the above-described blockchain-based on-chain voting method.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, or as a computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer device or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer device or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer device or other programmable apparatus to produce a computer device implemented process such that the instructions which execute on the computer device or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present invention without departing from the spirit or scope of the invention. Thus, it is intended that the present invention also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.

Claims (10)

1. A blockchain-based on-chain voting method applied to a time proving node, comprising:
receiving a first block height of a target block corresponding to a voting ending time sent by a voting node;
determining a target block height difference based on the first block height and a second block height of a starting block corresponding to the voting starting time;
obtaining a plurality of VDF calculation results covering the target block height difference from a verifiable delay function VDF calculation result set, wherein each VDF calculation result corresponds to one calculation time length;
the plurality of VDF calculation results are sent to a verification node, so that the verification node verifies the plurality of VDF calculation results, and when verification passes, the total calculation time length corresponding to the plurality of VDF calculation results and the time difference of the voting time length corresponding to the target block height difference are determined; and if the time difference is within the preset range, triggering the on-chain ticket counting.
2. The method as recited in claim 1, further comprising:
creating a plurality of VDF computation pipelines, the configuration parameters of each VDF computation pipeline comprising: calculating the calculation time length of each VDF calculation, wherein the ratio of the calculation time length to the block-out time length is a positive integer;
for each VDF calculation pipeline, repeatedly executing the VDF calculation on the VDF calculation pipeline based on the configuration parameters of the VDF calculation pipeline to obtain a VDF calculation result on the VDF calculation pipeline;
and obtaining the VDF calculation result set based on the VDF calculation results on the plurality of VDF calculation pipelines.
3. The method of claim 2, wherein the configuration parameters further comprise: VDF formula and proof algorithm combination; the step of repeatedly executing the VDF computation on the VDF computation pipeline based on the configuration parameters of the VDF computation pipeline to obtain a VDF computation result on the VDF computation pipeline includes:
for each VDF computation on the VDF computation pipeline, comprising the operations of:
selecting one proving algorithm from the proving algorithm combination; performing VDF calculation based on calculation parameters corresponding to the parameter and the calculation time length through the VDF calculation formula and the one proving algorithm to obtain a VDF calculation result;
Wherein, when performing the first VDF calculation, the parameters are: hash value of current block and hash value of voting start sign that the said voting node sends block height; when performing non-first VDF calculations, the entries are: the hash value and block height of the current block.
4. The method of claim 2, wherein the repeatedly performing VDF calculations on the VDF calculation pipeline based on configuration parameters of the VDF calculation pipeline, before obtaining VDF calculation results on the VDF calculation pipeline, further comprises:
receiving a voting start flag sent by the voting node, wherein the voting start flag is determined by the voting node based on the hash value of the starting block and the second block height;
sending a corresponding response message to the voting node so that the voting node sends the hash value of the voting start mark to the verification node;
after the creating a plurality of VDF computation pipelines, the method further comprises:
and sending the hash values of the configuration parameters of the plurality of VDF calculation pipelines to the verification node.
5. A blockchain-based on-chain voting method applied to voting nodes, comprising:
When the voting is finished, the first block height of the target block corresponding to the voting finishing moment is sent to a time proving node; the time proving node determines a target block height difference based on the first block height and a second block height of a starting block corresponding to the voting starting time; obtaining a plurality of VDF calculation results covering the target block height difference from a VDF calculation result set, wherein each VDF calculation result corresponds to one calculation time length; the plurality of VDF calculation results are sent to a verification node, so that the verification node verifies the plurality of VDF calculation results, and when verification passes, the total calculation time length corresponding to the plurality of VDF calculation results and the time difference of the voting time length corresponding to the target block height difference are determined; and if the time difference is within the preset range, triggering the on-chain ticket counting.
6. A blockchain-based on-chain voting method applied to a verification node, comprising:
receiving a plurality of VDF calculation results which are transmitted by a time proving node and cover a target block height difference, wherein the target block height difference is: a block height difference between a first block height of a target block corresponding to the voting ending time and a second block height of a starting block corresponding to the voting starting time; the plurality of VDF calculation results are obtained from a VDF calculation result set, and each VDF calculation result corresponds to one calculation time length;
Verifying the plurality of VDF calculation results, and determining the total calculation time length corresponding to the plurality of VDF calculation results and the time difference of the voting time length corresponding to the target block height difference when the verification is passed;
and if the time difference is within the preset range, triggering the on-chain ticket counting.
7. The method of claim 6, wherein each VDF calculation comprises: parameter entering, VDF calculation results, proving and calculating parameters;
the verifying the plurality of VDF computation results includes:
verifying the enrollment for each VDF calculation based on the VDF formula result and the proof;
and acquiring configuration parameters of a VDF computing pipeline corresponding to the VDF computing result, and verifying whether the computing parameters correspond to computing time periods in the configuration parameters.
8. The method of claim 7, wherein the VDF computation result further comprises: a proof algorithm;
before determining the total computation time length corresponding to the plurality of VDF computation results and the time difference of the voting time length corresponding to the target block height difference, the method further comprises:
for each VDF calculation result, determining the attestation algorithm as one attestation algorithm of a combination of attestation algorithms in the configuration parameters.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method of any of claims 1-8 when the program is executed.
10. A computer readable storage medium, characterized in that it stores a computer program executable by a computer device, which program, when run on the computer device, causes the computer device to perform the steps of the method according to any one of claims 1-8.
CN202311797317.8A 2023-12-25 2023-12-25 Block chain-based on-chain voting method, device, equipment and storage medium Pending CN117793126A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311797317.8A CN117793126A (en) 2023-12-25 2023-12-25 Block chain-based on-chain voting method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311797317.8A CN117793126A (en) 2023-12-25 2023-12-25 Block chain-based on-chain voting method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117793126A true CN117793126A (en) 2024-03-29

Family

ID=90390295

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311797317.8A Pending CN117793126A (en) 2023-12-25 2023-12-25 Block chain-based on-chain voting method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117793126A (en)

Similar Documents

Publication Publication Date Title
JP7199466B2 (en) Cross-blockchain authentication method and device
TWI703853B (en) User identity authentication method and device in network
CN108711212B (en) Voting certificate storage method, device and system
CN111445333B (en) Block generation method, device, computer equipment and storage medium
CN111629039B (en) Block chain consensus method, client, endorsement node and sequencing node
CN108596623B (en) Block chain consensus achieving method
US20210049715A1 (en) Blockchain-based data procesing method, apparatus, and electronic device
CN110189122B (en) Method and device for anchoring time for data on block chain and electronic equipment
CN110690974B (en) Block chain based data verification method, device, equipment and readable storage medium
CN111818185B (en) Method and device for starting intelligent contract, electronic equipment and storage medium
CN111753334B (en) Method and device for verifying consistency of data across alliance chains and electronic equipment
CN110597916B (en) Data processing method and device based on block chain, storage medium and terminal
CN110570196A (en) Transaction data processing method and device, terminal equipment and storage medium
CN108648082B (en) Computer system for block chain consensus achievement
CN114281888A (en) Block chain consensus method, device, equipment and storage medium
CN110990790B (en) Data processing method and equipment
CN109921897B (en) Triggering method and device for workload certification calculation, calculating equipment and storage medium
CN114205087B (en) Block chain random number generation method
CN111385096B (en) Block chain network system, signature processing method, terminal and storage medium
CN117793126A (en) Block chain-based on-chain voting method, device, equipment and storage medium
CN111724168A (en) Transaction verification method and device based on block chain, electronic equipment and medium
CN111147477A (en) Verification method and device based on block chain network
CN111861469A (en) Processing method and device for consensus mechanism in block chain and electronic equipment
CN117978382A (en) Method and device for generating and verifying random number based on VDF in blockchain
CN114254345A (en) Secret commitment generation and verification method and device based on block chain

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication