Method and device for realizing random beacon based on block chain, medium and equipment
By generating global public keys and signed private keys on the blockchain, using signature aggregation smart contract verification and aggregation processing, the centralization problem of random beacon services in Web3.0 is solved, and a decentralized, secure and efficient random beacon services are realized.
Patent Information
- Application Number
- CN202311869535.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-29
- Publication Date
- 2025-07-01
AI Technical Summary
In Web 3.0, how to implement random beacon service based on blockchain to ensure that the generated random numbers are unbiased and unpredictable, avoiding relying on trusted authoritative centers.
Generate global public keys and each node generates signature private keys through blockchain, deploy a signed aggregation smart contract, use the verification public key and global public key for signature verification and aggregation, output public random numbers, and provide random beacon services in rounds.
Decentralized random beacon service is realized, which reduces protocol complexity, improves security and prevents the risk of malicious nodes from affecting the random beacon calculation results, and reduces network overhead.
Smart Images

Figure CN120238331A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of information security, and in particular, to a method, apparatus, medium, and device for implementing a random beacon based on a blockchain. Background Art
[0002] A blockchain is essentially a string of data blocks associated using cryptographic methods and has three basic characteristics: distributed storage, a P2P network, and a consensus mechanism. As blockchain technology becomes increasingly mature, consensus algorithms are broadcast on the blockchain through cryptographic techniques, perform mathematical operations on the blockchain, and provide replicability of transactions, thereby providing a basis for the intelligent security of these transactions. Based on blockchain technology, a blockchain system ensures information security and trust through techniques such as timestamps, hash algorithms, digital signatures, and timestamp information, thereby providing guarantees for the security and reliability of information. The decentralization of the blockchain makes the rights and obligations of each network node on the chain the same, enabling a high degree of trust to be achieved without the need to rely on a third-party trust endorsement.
[0003] Web3.0 is the next-generation distributed Internet form centered around technologies such as blockchain. Through technical means such as digital identity and smart contracts, the original production relationship is reconstructed, and the data ownership and control rights are returned to producers and users. Public randomness is an important part of a large number of application programs and protocols and is also an important part of real-world security protocols. Randomness provides a fair way to allocate indivisible resources, and the demand for high-entropy random numbers in science, engineering, and data protection is increasing. A random beacon service is a service that can generate publicly verifiable random numbers, which ensures that the generated random numbers are unbiased and unpredictable and can provide unpredictable random numbers at fixed intervals. Traditionally, trusted authoritative centers are relied on to ensure the authenticity of randomness, but in Web3.0, a better way is needed to implement the random beacon service.
[0004] Therefore, how to implement a random beacon based on a blockchain has become a key technical problem that urgently needs to be solved. Summary of the Invention
[0005] The purpose of the present invention is to provide a method, apparatus, medium, and device for implementing a random beacon based on a blockchain, which is used to provide a random beacon service for Web3.0 network applications.
[0006] According to one aspect of the present invention, there is provided a method for implementing a random beacon based on a blockchain. The method includes: using a distributed key generation method, the blockchain generates a global public key, and each blockchain node generates its own signature private key and verification public key. A signature aggregation smart contract is deployed on the blockchain. Each blockchain node signs the message to be signed using the signature private key to generate a signed message. Each blockchain node calls the signature aggregation smart contract deployed on the blockchain and sends the generated signed message to the signature aggregation smart contract. Each blockchain node executes the signature aggregation smart contract, and uses the verification public key and the global public key to perform signature verification and aggregation processing on the received signed message, and then outputs a public random number.
[0007] According to an embodiment of the present invention, after the method outputs the public random number, it further includes: providing a random beacon service by rounds, and regenerating the public random number in each round.
[0008] According to an embodiment of the present invention, the using a distributed key generation method, the blockchain generates a global public key, and each blockchain node generates its own signature private key and verification public key specifically includes: the blockchain node samples t random numbers according to a preset threshold t, generates proof information according to the random numbers and broadcasts it; after the blockchain node successfully verifies the received proof information, it generates an initial key; the blockchain node assigns an initial key share to all nodes, and the nodes separately share the corresponding initial key share; after all the received initial key shares are successfully verified, the blockchain node generates its own signature private key according to the initial key share; the blockchain node generates its own verification public key and the global public key according to the signature private key.
[0009] According to an embodiment of the present invention, the proof information includes a proof of knowledge and a public commitment; the generating proof information according to the random numbers and broadcasting it includes using the t random numbers sampled by the blockchain node as the coefficients of a t-1 degree polynomial, and the proof of knowledge is the proof of knowledge of the zero-degree coefficient of the polynomial.
[0010] According to an embodiment of the present invention, the using the verification public key and the global public key to perform signature verification and aggregation processing on the received signed message, and then outputting a public random number specifically includes: after receiving the signature information sent by the node, the signature aggregation smart contract verifies the received signed message using the verification public key of the node, and marks the signed message that passes the verification as a correctly signed message; the signature aggregation smart contract aggregates the correctly signed messages to obtain a global signature result; the signature aggregation smart contract verifies the global signature result using the global public key, and performs a hash calculation process on the global signature result that passes the verification to obtain a public random number.
[0011] According to an embodiment of the present invention, in the step where the signature aggregation smart contract aggregates correct signature messages to obtain a global signature result, the number of correct signature messages is greater than or equal to a threshold t.
[0012] According to an embodiment of the present invention, the threshold t needs to satisfy n / 2 ≤ t < n, where n is the total number of blockchain nodes.
[0013] According to another aspect of the present invention, there is provided a device for implementing a random beacon based on a blockchain. The device includes: a distributed key generation module configured to generate a signature key, a verification key, and a global key using a distributed key algorithm; a signature message generation module configured to sign a message to be signed using a signature private key to generate a signature message, and send the generated signature message to the signature aggregation smart contract; a signature aggregation smart contract module configured to deploy a signature aggregation smart contract to execute the signature aggregation smart contract, perform signature verification and aggregation processing on the received signature messages using the verification public key and the global public key to obtain a global signature result, and perform a hash calculation on the global signature result to output a public random number.
[0014] According to another aspect of the present invention, there is provided a computer-readable storage medium storing a computer program, which when executed by a processor, implements the method for implementing a random beacon based on a blockchain as described above.
[0015] According to another aspect of the present invention, there is provided a computer device. The computer device includes: a processor; a memory storing a computer program, which when executed by the processor, implements the method for implementing a random beacon based on a blockchain as described above.
[0016] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0017] 1. The technical solution of the present invention is based on blockchain technology and realizes the automatic verification and aggregation of signature messages through smart contracts, which can reduce the complexity of protocol implementation and decouple modules such as the upper-layer threshold signature protocol and the lower-layer node consensus protocol.
[0018] 2. The technical solution of the present invention uses blockchain technology to implement a random beacon. Through multi-party participation and the introduction of a distributed key generation algorithm, the decentralization of the random beacon is realized, greatly improving the security of the random beacon.
[0019] 3. The technical solution of the present invention uses P2P technology to achieve peer-to-peer communication between blockchain nodes, ensuring that no malicious node can cause deviation in the final random beacon calculation result, and effectively preventing the risk that the random beacon calculation result is predicted due to improper node behavior.
[0020] 4. The technical solution of the present invention realizes the random beacon service by setting a threshold t to perform signature aggregation to obtain a common random number, which can reduce network overhead while ensuring security. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The above objects and features of the present invention will become clearer through the following description with reference to the drawings.
[0022] Figure 1 FIG. shows a schematic flowchart of a method for implementing a random beacon based on a blockchain according to an exemplary embodiment of the present invention.
[0023] Figure 2 FIG. shows a schematic block diagram of a device for implementing a random beacon based on a blockchain according to an exemplary embodiment of the present invention.
[0024] Figure 3 FIG. shows a schematic flowchart of n blockchain nodes implementing a distributed random beacon according to an exemplary embodiment of the present invention.
[0025] Figure 4 FIG. shows a schematic diagram of a signature calculation process implemented by 4 blockchain nodes according to an exemplary embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0026] The concept of the present invention is as follows: Based on blockchain technology, a distributed key generation method is used to generate a signature private key, a verification public key, and a global public key. The automatic verification and aggregation of signature messages are realized through a smart contract. At the same time, the data stored on the blockchain has the characteristics of being auditable, which can effectively reduce the possibility of data being forged and tampered with. Nodes on the blockchain will store and execute the code of the smart contract, and the execution results are recorded on the blockchain. Using the blockchain smart contract as the communication layer of the above protocol can realize the aggregation of signature messages of participants (nodes), utilize the consensus mechanism provided by the underlying blockchain, reduce the difficulty of implementing the upper-layer threshold signature calculation, and improve the efficiency and security of the protocol.
[0027] Next, embodiments of the present invention will be described in detail with reference to the drawings.
[0028] Figure 1 FIG. shows a schematic flowchart of a method for implementing a random beacon based on a blockchain according to an exemplary embodiment of the present invention. Refer to Figure 1 , Figure 1 The method shown includes the following steps.
[0029] Step S1, using a distributed key generation method, the blockchain generates a global public key and each blockchain node generates its own signature private key and verification public key.
[0030] Step S2, deploy a signature aggregation smart contract on the blockchain.
[0031] Step S3, each blockchain node uses a signature private key to sign the message to be signed and generates a signed message.
[0032] Step S4, each blockchain node calls the signature aggregation smart contract deployed on the blockchain and sends the generated signed message to the signature aggregation smart contract.
[0033] Step S5, each blockchain node executes the signature aggregation smart contract, uses the verification public key and the global public key to perform signature verification and aggregation processing on the received signed message, and then outputs a public random number.
[0034] Figure 2 Shown is a schematic block diagram of a device for implementing a random beacon based on a blockchain according to an exemplary embodiment of the present invention. Referring to Figure 2 , the device includes: a distributed key generation module, a signed message generation module, and a signature aggregation smart contract module.
[0035] The distributed key generation module is configured to generate a signature key, a verification key, and a global key using a distributed key algorithm.
[0036] The signed message generation module is configured to sign the message to be signed using a signature private key to generate a signed message, and send the generated signed message to the signature aggregation smart contract.
[0037] The signature aggregation smart contract module is configured to deploy a signature aggregation smart contract, execute the signature aggregation smart contract, use the verification public key and the global public key to perform signature verification and aggregation processing on the received signed message to obtain a global signature result, and perform a hash calculation on the global signature result to output a public random number.
[0038] As Figure 3 shown, a schematic diagram of the process of generating a public random number for random beacon service by n nodes inside the blockchain is given. The entire process of generating a public random number for random beacon service based on the blockchain is divided into two stages: a distributed key generation stage and a signature calculation stage.
[0039] The blockchain is a newly created blockchain network or an existing blockchain network. In the blockchain network, the total number of blockchain nodes is n, and the blockchain nodes are represented as P i , i = 0,..., n - 1. A threshold t is set for the number of blockchain nodes. The threshold t is the threshold number of signature private keys required to construct the global private key, and the threshold number of messages signed with the correct signature private key required to calculate the global signature result of the message when collecting the signatures of the nodes using the signature private key for the message. t needs to satisfy n / 2 ≤ t < n.
[0040] In the distributed key generation phase, each node randomly samples t random numbers (a 00 , a 01 ,..., a 0(t-1) ) as the coefficients of a t - 1 degree polynomial , calculates and broadcasts a proof of knowledge of the zero - order coefficient of the polynomial, that is, a proof of knowledge σ i0 of the first random number a i , and a common commitment C i . When each other node receives σ i and C i , it verifies them. If the verification passes, it proceeds to the next step; if the verification fails, it restarts the distributed key generation.
[0041] Each node generates an initial key, divides the initial key into n initial key shares, keeps one share for itself, and separately sends the remaining n - 1 shares to each node. When a node receives an initial key share sent separately by another node, it verifies the initial key share separately. If any initial key share verification fails, it aborts and restarts the distributed key generation. After all the received initial key shares are successfully verified, it generates its own signature private key s i , which is the private key generated by node i during the distributed key generation process. Other nodes perform the same operation to generate their respective signature private keys.
[0042] Each node P i calculates its own verification public key Y i , and the global public key Y. Any node can obtain the verification public key of any other node by calculating Y i . After the above steps are completed, the distributed key generation phase in the process of the random beacon service generating a common random number is completed. All nodes broadcast the calculated global public key. After on - chain consensus, it is stored on the blockchain. When it is necessary to verify the global private key or perform a global verification on a message signed with the private key, this global public key can be used for verification.
[0043] In the signature calculation phase, the random beacon service generates common random numbers in rounds, and each generation of a common random number is one round. A message m to be signed is preset. The message to be signed is generated according to certain rules. In each round of the random beacon service (i.e., one generation of a common random number), the message m to be signed is different. Let r represent the round of the random beacon service generation, then the message to be signed in each round is represented by m r . In each round of random beacon generation, all nodes use their respective signature private keys to sign the message m to be signedr Perform a signature. After the signature is completed, send the signature information Sig i (r) to the deployed aggregated signature smart contract.
[0044] In the signature calculation stage, calculate the common random number for each round through the threshold signature algorithm. Implement the threshold signature algorithm by signing and aggregating the deployment smart contract on the blockchain. The signature aggregation smart contract acts as a node signature aggregator. The signature aggregation smart contract collects the signature messages sent by the nodes and verifies them. When the correct signature messages of t nodes among all the nodes are collected, perform signature aggregation processing on the correct signature messages to obtain the global signature result Sig(r) of all nodes for the message m of the current round. r The number of correct signature messages is greater than or equal to the threshold t. Use the global public key generated in the distributed key generation stage to verify the global signature result Sig(r). After the verification passes, perform a hash calculation on the global signature result. The global signature result after the hash calculation is the common random number output for this round.
[0045] As Figure 4 shown, taking the generation of a common random number through the random beacon service of 4 participants as an example, establish a 4-node blockchain network, assign a blockchain node to each participant to participate in the random beacon service. Number the 4 nodes on the blockchain as P0, P1, P2, and P3 respectively, set the threshold t to 3, and perform the random beacon service.
[0046] The four nodes start the random beacon service to calculate the common random number. In the distributed key generation stage, node P0 calculates and obtains its own signature private key S0 and verification public key V0 through the distributed key generation method. Similarly, nodes P1, P2, and P3 respectively obtain their own signature private keys S1, S2, S3, and verification public keys V1, V2, V3, and all nodes obtain a copy V of the global public key through calculation and on-chain broadcasting. p .
[0047] In the signature calculation stage, provide the random beacon service by round. Each successful completion of a signature calculation realizes a random beacon service and outputs a common random number. As Figure 4 shown, for message signing in the r-th round, the 4 nodes P0, P1, P2, and P3 perform the random beacon service through the signature aggregation smart contract and output the common random number.
[0048] As Figure 4 shown, node P0 uses its signature private key S0 to sign the message m r to generate the signature message Sig0(m r ), and send the signature message Sig0(m r)Send it to the signature aggregation smart contract. Similarly, nodes P1, P2, and P3 also perform the same operation, using their respective signature private keys S1, S2, and S3 to sign the message m r to generate the signature messages Sig1(m r ), Sig2(m r ), Sig3(m r ), and send the signature messages to the signature aggregation smart contract.
[0049] After receiving the signature messages sent by the nodes, the signature aggregation smart contract uses the respective verification public keys V0, V1, V2, and V3 of the nodes to verify them, records the signature messages that pass the verification as correct signature messages, and after collecting the correct signature messages sent by any 3 of the four nodes, performs signature aggregation processing on them to recover the global signature result Sig(m r of the message m r ).
[0050] Use the global public key V p to verify the global signature result Sig(m r ). After passing the verification, perform a hash calculation on the global signature result. The result output after the hash calculation processing is the common random number of the random beacon service for this round.
[0051] The distributed randomness beacon can be used to provide on-chain randomness, which will be a key factor for fair, secure, and transparent on-chain applications. The technical solution of the present invention implements a random beacon based on a blockchain, encrypts and verifies through the distributed keys of the blockchain, and then generates a decentralized common random number to implement a distributed random beacon service and provide a secure and reliable common random number to the outside world. All participants on the blockchain need to agree on the output (randomness), and malicious participants in the protocol should not be able to bias or predict the output.
[0052] In addition, according to an exemplary embodiment of the present invention, a computer-readable storage medium storing a computer program may also be provided. The computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to execute the method for implementing a random beacon based on a blockchain according to an exemplary embodiment of the present invention. The computer-readable recording medium is any data storage device that can store data read by a computer system. Examples of computer-readable recording media include: read-only memory, random access memory, read-only optical discs, magnetic tapes, floppy disks, optical data storage devices, and carrier waves (such as data transmission through the Internet via a wired or wireless transmission path).
[0053] In addition, an exemplary embodiment according to the present invention may further provide a computing device. The computing device includes a processor and a memory. The memory is used to store a computer program. The computer program is executed by the processor such that the processor executes the computer program of the method for implementing a random beacon based on a blockchain according to the exemplary embodiment of the present invention.
[0054] It should be noted that the first, second, third, fourth, etc. in the above description are used to distinguish features with the same name in the same or different embodiments, and are not limitations in terms of quantity. And the present invention is not limited to the specific configurations and processes described above or shown in the figures. The above are only specific embodiments of the present invention. Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the described system, device, module or unit can refer to the corresponding processes in the method embodiments and will not be repeated here. It should be understood that the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can think of various equivalent modifications or substitutions, and these modifications or substitutions should be covered within the protection scope of the present invention.
Claims
1. A method for implementing a random beacon based on blockchain, characterized in that, Comprising: Using a distributed key generation method, the blockchain generates a global public key and each blockchain node generates its own signature private key and verification public key; Deploying a signature aggregation smart contract on the blockchain; Each blockchain node signs the message to be signed with the signature private key to generate a signed message; Each blockchain node calls the signature aggregation smart contract deployed on the blockchain and sends the generated signed message to the signature aggregation smart contract; Each blockchain node executes the signature aggregation smart contract, and uses the verification public key and the global public key to perform signature verification and aggregation processing on the received signed message and then outputs a common random number.
2. The method for implementing a random beacon based on a blockchain according to claim 1, wherein After the method outputs the common random number, it further includes: Providing a random beacon service by rounds, and regenerating the common random number in each round.
3. The method for implementing a random beacon based on a blockchain according to claim 1, wherein The using of the distributed key generation method, where the blockchain generates a global public key and each blockchain node generates its own signature private key and verification public key, specifically includes: The blockchain node samples t random numbers according to a preset threshold t, generates proof information based on the random numbers and broadcasts it; After the blockchain node successfully verifies the received proof information, it generates an initial key; The blockchain node assigns an initial key share to all nodes, and the nodes separately share the corresponding initial key shares; After all the received initial key shares are successfully verified, the blockchain node generates its own signature private key according to the initial key shares; The blockchain node generates its own verification public key and the global public key according to the signature private key.
4. The method for implementing a random beacon based on a blockchain according to claim 3, wherein The proof information includes a proof of knowledge and a public commitment; the generating of the proof information based on the random numbers and broadcasting it includes using the t random numbers sampled by the blockchain node as the coefficients of a t-1 degree polynomial, and the proof of knowledge is the proof of knowledge of the zero-degree coefficient of the polynomial.
5. The method for implementing a random beacon based on a blockchain according to claim 1, wherein The using of the verification public key and the global public key to perform signature verification and aggregation processing on the received signed message and then output a common random number specifically includes: After the signature aggregation smart contract receives the signature information sent by the node, it verifies the received signed message using the verification public key of the node, and marks the signed message that passes the verification as a correct signed message; The signature aggregation smart contract aggregates the correct signed messages to obtain a global signature result; The signature aggregation smart contract verifies the global signature result using the global public key, and performs a hash calculation process on the global signature result that passes the verification to obtain a common random number.
6. The method for implementing a random beacon based on a blockchain according to claim 5, wherein In the step where the signature aggregation smart contract aggregates the correct signed messages to obtain a global signature result, the number of correct signed messages is greater than or equal to the threshold t.
7. The method for implementing a random beacon based on a blockchain according to claim 3, 4 or 6, characterized in that, The threshold t needs to satisfy n / 2 ≤ t < n, where n is the total number of blockchain nodes.
8. A device for implementing a random beacon based on blockchain, characterized in that, Comprising: A distributed key generation module, configured to generate a signature key, a verification key, and a global key using a distributed key algorithm; A signed message generation module, configured to sign the message to be signed with the signature private key to generate a signed message, and send the generated signed message to the signature aggregation smart contract; The signature aggregation smart contract module is configured to deploy a signature aggregation smart contract for executing the signature aggregation smart contract, perform signature verification and aggregation processing on the received signature messages by using the verification public key and the global public key to obtain a global signature result, and perform hash calculation on the global signature result to output a public random number.
9. A computer-readable storage medium storing a computer program, wherein, When the computer program is executed by a processor, the method for implementing a random beacon based on a blockchain according to any one of claims 1 to 7 is implemented.
10. A computing device, comprising: A processor; A memory storing a computer program, which when executed by the processor, implements the method for implementing a random beacon based on a blockchain according to any one of claims 1 to 7.