Blockchain consensus method, device, equipment and computer-readable storage medium
Through the cellular verified random function VRF six-choice algorithm, a blockchain network is built, block nodes are selected, and a storage data proof string and data random check timestamp string are generated, which solves the problem of waste of energy and computing power in the existing blockchain consensus mechanism and improves consensus efficiency and security.
Patent Information
- Application Number
- CN202211710970.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-29
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2042-12-29
AI Technical Summary
Existing blockchain consensus mechanisms such as PoW waste energy and computing power, reducing consensus efficiency.
Using the cellular verified random function VRF six-choice algorithm, a blockchain network of m levels is built, block nodes are selected through the target random algorithm, and a storage data proof string and data random check timestamp string are generated to improve consensus efficiency.
It saves a lot of computing power, improves blockchain consensus efficiency, simplifies consensus algorithms, and enhances the security and trustworthiness of blockchain systems.
Smart Images

Figure CN116132058B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data services, and in particular to a blockchain consensus method, apparatus, device, and computer-readable storage medium. Background Art
[0002] Currently, in the blockchain network, due to the decentralized blockchain design, nodes are scattered and parallel, so a consensus mechanism is needed to maintain the operating order and fairness of the blockchain system.
[0003] In existing technologies, Proof-of-Work (PoW) consensus mechanisms are often used to maintain the operation of blockchain systems, using the time, equipment, and energy consumed as collateral to ensure the use of blockchain resources and services. The most commonly used technical principle is the hash function. Any value n input to the hash function h() will correspond to a result h(n). A single bit change in n can cause an avalanche effect, making it almost impossible to reverse engineer from h(n) to n. This requires users to perform extensive computations to achieve proof of work.
[0004] Therefore, the methods adopted by existing technologies not only waste energy but also waste computing power, increase the difficulty of calculations, and reduce the efficiency of blockchain consensus. Summary of the Invention
[0005] The embodiments of the present application provide a blockchain consensus method, apparatus, device, and computer-readable storage medium, which can generate random numbers using a target random algorithm and select the next block-producing node based on existing blocks, thereby saving a large amount of computing power and improving the efficiency of blockchain consensus.
[0006] In a first aspect, an embodiment of the present application provides a blockchain consensus method, the method comprising:
[0007] Based on multiple server nodes, a blockchain network with m levels is constructed. The first level includes p units, and a unit in the i-th level includes p units in the i+1-th level. 1≤i≤m-1, i, m, and p are all positive integers.
[0008] Go back and forth to get m blocks and get the contents of m blocks;
[0009] Based on the target random algorithm, the contents of m blocks are calculated respectively to obtain m random numbers;
[0010] Based on m random numbers, a server node is selected from the m-level blockchain network as a block producing node.
[0011] According to the implementation of the first aspect of the present application, the contents of the m blocks are respectively operated based on the target random algorithm to obtain m random numbers, specifically including:
[0012] Perform hash calculation on the content of any j-th block among m blocks to obtain N characters, where N is a positive integer;
[0013] The information exchange standard codes corresponding to N characters are superimposed and modulo p to obtain the random number corresponding to the j-th block.
[0014] According to the implementation of the first aspect of the present application, p=6, and the value range of the random number is 1 to 6.
[0015] According to an implementation of the first aspect of the present application, the unit in the mth level is the server node;
[0016] Based on m random numbers, a server node is selected from the m-level blockchain network as a block producer. Specifically, the process includes:
[0017] According to the mth random number to the first random number, determine the selected unit in the first level to the selected server node in the mth level in sequence;
[0018] The selected server node in the mth level is determined as the block producing node.
[0019] According to an implementation of the first aspect of the present application, after selecting a server node as a block producing node from an m-level blockchain network according to m random numbers, the method further includes:
[0020] Generate new blocks based on the block-producing nodes;
[0021] Generate a storage data proof string and a data spot check timestamp string;
[0022] Write the storage data proof string and data spot check timestamp string into the new block.
[0023] According to any of the aforementioned implementations of the first aspect of the present application, generating a stored data certification string and a data spot check timestamp string specifically includes:
[0024] Divide the encrypted data used to generate new blocks into multiple slices;
[0025] Based on multiple slices, build an n-layer Merkle tree, where n is a positive integer;
[0026] Go back and forth to get n blocks and get the contents of n blocks;
[0027] Based on the target random algorithm, the contents of n blocks are calculated respectively to obtain n random numbers, which constitute the Merkle path;
[0028] Add the hash values on the Merkle path and use the hash function to calculate the addition result to obtain the storage data proof string.
[0029] According to any of the aforementioned implementations of the first aspect of the present application, generating a stored data certification string and a data spot check timestamp string specifically includes:
[0030] The key of the block-producing node is used to sign the stored data proof string to obtain the data spot check timestamp string.
[0031] In a second aspect, an embodiment of the present application provides a blockchain consensus device, comprising:
[0032] A building block for building an m-level blockchain network based on multiple server nodes, where the first level includes p units, and a unit in the i-th level includes p units in the i+1-th level, 1≤i≤m-1, and i, m, and p are all positive integers;
[0033] The acquisition module is used to trace back and obtain m blocks and get the contents of m blocks;
[0034] The operation module is used to operate on the contents of m blocks based on the target random algorithm to obtain m random numbers;
[0035] The selection module is used to select a server node as a block producing node from the m-level blockchain network based on m random numbers.
[0036] In a third aspect, an embodiment of the present application provides an electronic device, which includes: a processor, a memory, and a computer program stored in the memory and runnable on the processor. When the computer program is executed by the processor, the steps of the blockchain consensus method provided in the first aspect are implemented.
[0037] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the blockchain consensus method provided in the first aspect are implemented.
[0038] The blockchain consensus method, apparatus, device and computer-readable storage medium of the embodiments of the present application construct an m-level blockchain, wherein the first level includes p units, each first-level unit may include p units in the second level, each second-level unit includes p units in the third level, and so on. m levels can be constructed, and the organizational form is similar to a honeycomb shape. m blocks are traced back forward, and the contents of the m blocks are calculated respectively using a target random algorithm to obtain m random numbers to determine the block-producing nodes in the honeycomb organization. A large amount of calculation is not required, and the consensus of the next block-producing node is selected based on the existing blocks. The algorithm is simple, saves computing power, and improves the efficiency of blockchain consensus. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0040] Figure 1 This is a flowchart of a blockchain consensus method provided by an embodiment of the present application;
[0041] Figure 2 This is a schematic diagram of the construction of an algorithm and consensus mechanism in a blockchain consensus method provided by an embodiment of the present application;
[0042] Figure 3 This is a schematic diagram of an algorithm in a blockchain consensus method provided in an embodiment of the present application;
[0043] Figure 4 This is a schematic diagram of the generation principle of the storage data certification string and the data spot check timestamp string provided in the embodiment of the present application;
[0044] Figure 5 This is a structural diagram of a blockchain consensus device provided by an embodiment of the present application;
[0045] Figure 6 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is merely to provide a better understanding of the present application by illustrating the examples of the present application.
[0047] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, the elements defined by the phrase "comprising..." do not exclude the presence of other identical elements in the process, method, article, or device comprising the elements.
[0048] It should be understood that the term "and / or" as used herein is merely a description of the relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, or B exists alone. Furthermore, the character " / " in this document generally indicates that the associated objects are in an "or" relationship.
[0049] It will be apparent to those skilled in the art that various modifications and variations can be made in this application without departing from the spirit or scope of this application. Therefore, this application is intended to cover modifications and variations of this application that fall within the scope of the corresponding claims (technical solutions claimed for protection) and their equivalents. It should be noted that the embodiments provided in the examples of this application can be combined with each other without contradiction.
[0050] Before describing the technical solutions provided by the embodiments of the present application, in order to facilitate understanding of the embodiments of the present application, the present application first specifically describes the problems existing in the related art:
[0051] As mentioned above, the inventors of this application have discovered that in a blockchain network, due to the decentralized blockchain design, the nodes are scattered and parallel, so a system must be designed to maintain the operating order and fairness of the blockchain system. This system determines which node obtains the packaging right (or accounting right) of the next block in the blockchain system and obtains the reward for packaging this block. This system is the consensus mechanism. A typical consensus mechanism is the PoW consensus, which generally requires users to perform some time-consuming and complex calculations, and the answers can be quickly verified by the service provider. The time, equipment and energy consumed in this way are used as guarantee costs to ensure that services and resources are used for real needs.
[0052] PoW consensus is very energy-wasting. The energy invested may exceed the consumption of a small country. It also wastes a lot of computing power, increases the difficulty of calculation, and reduces the efficiency of blockchain consensus.
[0053] In view of the above research findings of the inventors, the embodiments of the present application provide a blockchain consensus method, apparatus, device and computer-readable storage medium, which can use a target random algorithm to generate random numbers and select the next block-producing node based on the existing blocks, thereby saving a large amount of computing power and improving the efficiency of blockchain consensus.
[0054] The following describes in detail the blockchain consensus method provided by the embodiments of the present application through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0055] Figure 1 This is a flowchart of a blockchain consensus method provided by an embodiment of the present application. Figure 1 As shown, the blockchain consensus method provided in the embodiment of the present application may include steps S110-S140, wherein:
[0056] S110. Based on multiple server nodes, construct a blockchain network with m levels, where the first level includes p units, a unit in the i-th level includes p units in the i+1-th level, 1≤i≤m-1, and i, m, and p are all positive integers;
[0057] S120, trace back to obtain m blocks and obtain the contents of the m blocks;
[0058] S130, performing operations on the contents of the m blocks based on the target random algorithm to obtain m random numbers;
[0059] S140. According to m random numbers, a server node is selected from the m-level blockchain network as a block production node.
[0060] Therefore, by constructing a blockchain with m levels, the first level includes p units, each first-level unit can include p units in the second level, and each second-level unit includes p units in the third level, and so on, m levels can be constructed, and the organizational form is similar to a honeycomb shape. By tracing back m blocks, the contents of the m blocks are calculated using the target random algorithm respectively, and m random numbers can be obtained to determine the block-producing nodes in the honeycomb organization. This does not require a large amount of calculation, and is based on the consensus of selecting the next block-producing node based on the existing blocks. The algorithm is simple, saves computing power, and improves the efficiency of blockchain consensus.
[0061] The specific implementation methods of the above steps are introduced below.
[0062] In some embodiments, in S110, p=6, the server nodes are organized in a honeycomb manner to build a server cluster, and an original honeycomb Verifiable Random Function (VRF) six-choice algorithm is adopted. The design of the honeycomb Verifiable Random Function VRF six-choice algorithm is to interactively prove the random number generated by six VRF calculations. The six equidistant interactions resemble a honeycomb, so it is called the honeycomb Verifiable Random Function VRF six-choice algorithm.
[0063] As an example, consider a blockchain network with m layers, constructed from multiple server nodes. For example, the first layer consists of six units. Each first-layer unit can be split into six second-layer sub-units, which can be further split into six third-layer sub-units. This can be repeated over and over again, creating a total of m layers of sub-units, organized in a honeycomb-like structure. If there are fewer than six server nodes, they will not participate in bookkeeping. The m layers of nodes represent six to the power of m servers. The blockchain network will then conduct m elections, using the honeycomb Verifiable Random Function (VRF) six-choose-one algorithm to generate the next block.
[0064] The honeycomb structure of the nodes is the logical organization form between nodes. The underlying topology of the blockchain system is a distributed peer-to-peer network. The peer-to-peer network protocol is used to organize the various network nodes in the blockchain. Among them, the nodes usually use a point-to-point communication protocol to complete information exchange to ensure that the upper-level functions of the blockchain system can be supported.
[0065] In some embodiments, in S120, as Figure 2 As shown, Figure 2This is a schematic diagram of the construction of the algorithm and consensus mechanism in a blockchain consensus method provided by an embodiment of the present application. The blockchain consensus mechanism based on the cellular verifiable random function VRF six-choice algorithm and storage verification is a hybrid consensus mechanism. The node organization form is a honeycomb structure. The recursive VRF consensus algorithm is run on the honeycomb organization form, and a computer node is selected as the accounting node. Every once in a while, the blockchain system needs to generate the next block by the accounting node, and then broadcast it to the entire network to synchronize the blocks. The rule of the cellular verifiable random function VRF six-choice algorithm is that if the honeycomb structure node organization has m levels, along the last block of the blockchain, backtrack and read m blocks to obtain the content of m blocks. However, since the block contains transactions within the same period of the entire network, the length and content of the block cannot be predicted.
[0066] In some embodiments, in S130 , operations are performed on the contents of the m blocks based on the target random algorithm to obtain m random numbers, including the following two steps:
[0067] Step 1: Hash the content of any j-th block among the m blocks to obtain N characters, where N is a positive integer;
[0068] Step 2: Superimpose the information exchange standard codes corresponding to N characters and take the modulus of p to obtain the random number corresponding to the j-th block.
[0069] As an example, the target random algorithm can be a cellular verifiable random function (VRF) six-choose-one algorithm. The random number ranges from 1 to 6, and N can be 256. A hash value is calculated for the content of any j-th block among m blocks. For example, the VRF calculation involves applying the secure hash algorithm SHA256 to the block content to obtain 256 characters. The ASCII codes corresponding to these 256 characters are then superimposed and modulo 6 to obtain a random number from 1 to 6 corresponding to the j-th block. The VRF calculation is performed on the content of each block, resulting in m random numbers.
[0070] Within the m layers of server nodes, units are selected according to m random numbers, and this process is repeated recursively, ultimately determining a server node. If the first random number is 5, the fifth unit in the first layer is selected. If the second random number is 3, the third child unit in the fifth unit is selected. Since all nodes have access to the same blockchain ledger, they all obtain the same m random numbers, and the final block producer is also the same, thus achieving consensus among all nodes.
[0071] Through the above embodiments, the cellular verifiable random function VRF six-choice consensus algorithm adopted in this application determines the block-producing nodes in the cellular organization based on the method of generating random numbers from the forward-looking blocks. Therefore, the VRF consensus algorithm does not require a large amount of calculation, and each node can determine the next block-producing node based on its own block. It is a consensus based on the selection of the next block-producing node based on the existing blocks, which saves computing power.
[0072] In some embodiments, in S140, based on m random numbers, a server node is selected from the m-level blockchain network as a block producing node, which may specifically include the following steps:
[0073] Step 3: According to the mth random number to the 1st random number, determine the selected unit in the 1st level to the selected server node in the mth level in sequence;
[0074] Step 4: Determine the selected server node in the mth level as the block producing node.
[0075] As an example, Figure 3 As shown, Figure 3 This is a schematic diagram of an algorithm in a blockchain consensus method provided by an embodiment of the present application. For example, there are 36 computers, m=2, and in the blockchain network, there are 2 levels. The first level has 6 units, and each unit has 6 computers. It starts to read the last 2 blocks on the blockchain. If the first block is calculated by VRF to obtain a random number 3, then the first-level unit 3 is selected. If the second block is calculated by VRF to obtain a random number 5, then the computer No. 5 in the first-level unit 3 is selected, and a consensus is formed to determine it as the block-producing node. These 36 computers have the same blockchain ledger. After reading the last 2 blocks, it can be determined that the computer No. 5 in the first-level unit 3 is the block-producing node. The node selects a block-producing node through a six-selection process. After the block-producing node packages the block, it generates a random number and a certificate for the block and stores them in the block. When other nodes receive the block, they verify whether the certificate and random number are correct.
[0076] The data and ledger records based on the Cellular Verifiable Random Function (VRF) six-choice algorithm establish the foundation of the blockchain system. The timing service module provides unified timing for the blockchain system. Modules such as cryptographic digests and digital signatures ensure the security of the system's recorded data. The smart contract module ensures the automation of data circulation and data ownership. These modules can be customized according to different application scenarios. The Cellular Verifiable Random Function (VRF) six-choice algorithm helps each node in the blockchain network verify, record, and modify activities within the blockchain system. Different consensus algorithms can be selected to implement the consensus mechanism based on different business needs. The Cellular Verifiable Random Function (VRF) six-choice algorithm saves energy, simplifies consensus calculations, and uses a cellular node organization to quickly determine the node that produces the block, greatly improving the efficiency of the consensus algorithm.
[0077] In some embodiments, after S140, the blockchain consensus method further includes the following steps:
[0078] Step 5: Generate a new block based on the block-producing node;
[0079] Step 6: Generate a storage data proof string and a data spot check timestamp string;
[0080] Step 7: Write the storage data proof string and data spot check timestamp string into the new block.
[0081] As an example, Figure 4 As shown, Figure 4 This is a schematic diagram of the generation principle of the storage data proof string and the data spot check timestamp string provided in the embodiment of the present application. Integrating the storage data proof string and the data spot check timestamp string into the consensus accounting of the blockchain and writing them into the block can increase the security of the blockchain system.
[0082] Through the above embodiment, after integrating the storage data proof string and the data spot check timestamp string, the calculation of the consensus algorithm is more secure and the data on the blockchain is also more secure.
[0083] In some embodiments, in step 6, generating a stored data certification string and a data spot check timestamp string may specifically include the following steps:
[0084] Divide the encrypted data used to generate new blocks into multiple slices;
[0085] Based on multiple slices, build an n-layer Merkle tree, where n is a positive integer;
[0086] Go back and forth to get n blocks and get the contents of n blocks;
[0087] Based on the target random algorithm, the contents of n blocks are calculated respectively to obtain n random numbers, which constitute the Merkle path;
[0088] Add the hash values on the Merkle path and use the hash function to calculate the addition result to obtain the storage data proof string.
[0089] As an example, Figure 4 The block-producing node divides the encrypted data into multiple fragments, such as data fragment 1, data fragment 2, data fragment 3, and data fragment 4, and slices them to build an n-layer Merkle tree. From the last block, it traces back to obtain n blocks. For each block, VRFCRH calculation is used to obtain the content of n blocks. The content result is modulo 2 to obtain n random numbers. Here, each random number is 0 or 1. The Merkle path is formed by n random numbers. The hash values on the Merkle path are added and calculated using the SHA256 function to obtain the storage proof string.
[0090] Before constructing the Merkle tree, n blocks must be forwarded and n random numbers generated using the VRFCH algorithm. The random numbers range from 1 to 6. The data must also be encrypted. Upon receiving the event notification from the data confirmation contract, all data confirmation nodes connected to the blockchain network are notified of the task request through event broadcasting. The data confirmation node that deploys the batch job identifies the sub-job ID and is informed of the task request. The task content corresponding to the job ID is combined with the parameters in the event to set up the environment for task execution. Data confirmation system nodes utilize an immediate-read, publish-subscribe, and request-response workflow to search and access authenticated encrypted data. Data confirmation system nodes employ a simple threshold signature-based protocol and the Schnorr signature mechanism for data aggregation and verification within the blockchain, enabling permission resolution, data analysis, and data extraction for encrypted data.
[0091] In some embodiments, in step 6, generating a stored data certification string and a data spot check timestamp string may specifically include the following steps:
[0092] The key of the block-producing node is used to sign the stored data proof string to obtain the data spot check timestamp string.
[0093] As an example, the storage proof string is obtained above, and the storage proof string is signed using the key of the block-producing node to obtain the data spot check timestamp string, and the data spot check timestamp string is written into the blockchain.
[0094] Each node has the ability to store data, a function accomplished by a storage component. This component manages the storage of various data generated during system operation, including but not limited to relational databases. A data proof string indicates that data has been stored in the blockchain system; a data spot check timestamp string represents the storage status of the node's stored data at a specific point in time. The inclusion of both the data proof string and the data spot check timestamp string within a block makes the blockchain system more secure and trustworthy.
[0095] The distributed data storage mechanism within the blockchain uses different nodes to jointly record and maintain the ledger, ensuring public, tamper-proof, and trustworthy data management within the blockchain system. The data proof string and data spot-check timestamp string are stored to verify the integrity of the data within the blockchain system, preventing tampering. The requester should use a digital signature to confirm that the received data is consistent with the original data sent by the provider. In addition to storing the data proof string and data spot-check timestamp string, the block also contains transaction information, block producer information, and other content. The encrypted data storage system module periodically spot-checks the timestamp string based on the data to verify the identity and security of the encrypted data within the system. Encrypted data within the encrypted storage blockchain has its own storage category, access rights, and region. Users can create different storage categories and access rights for different regions and configure more advanced properties to meet storage requirements in different scenarios.
[0096] The construction method of the blockchain consensus mechanism based on the cellular verifiable random function VRF six-choice algorithm and storage verification, such as Figure 2 As shown, the encrypted data ownership and authorization system supports identity authentication. It is a decentralized data ownership service network that provides verifiable access to encrypted ownership data and continuous computation for blockchains. Through a blockchain consensus mechanism based on the Cellular Verifiable Random Function (VRF) six-choice algorithm and storage space, blockchain smart contracts can access encrypted network data and pay a fee to the owner of the encrypted data, thus realizing an economic system based on encrypted data search. The election rules of the Cellular Verifiable Random Function (VRF) six-choice algorithm are recursively executed layer by layer to select a bookkeeping node and generate the next block. Two auxiliary accounting elements, a storage data proof string and a data spot check timestamp string, are incorporated into the block generation process. This introduces data weight into the consensus mechanism, enhancing the security of blockchain consensus.
[0097] Based on the blockchain consensus method provided in the above embodiments, this application also provides a specific implementation of a blockchain consensus device. Please refer to the following embodiments.
[0098] Figure 5This is a structural diagram of a blockchain consensus device provided in an embodiment of the present application.
[0099] like Figure 5 As shown, the blockchain consensus device 500 provided in this embodiment of the application includes the following modules:
[0100] A construction module 501 is configured to construct an m-level blockchain network based on multiple server nodes, where the first level includes p units, a unit in the i-th level includes p units in the i+1-th level, 1≤i≤m-1, and i, m, and p are all positive integers;
[0101] An acquisition module 502 is used to trace back and acquire m blocks to obtain the contents of the m blocks;
[0102] The operation module 503 is used to perform operations on the contents of the m blocks based on the target random algorithm to obtain m random numbers;
[0103] The selection module 504 is used to select a server node as a block producing node from the m-level blockchain network according to m random numbers.
[0104] The blockchain consensus method, apparatus, device and computer-readable storage medium of the embodiments of the present application construct an m-level blockchain, wherein the first level includes p units, each first-level unit may include p units in the second level, each second-level unit includes p units in the third level, and so on. m levels can be constructed, and the organizational form is similar to a honeycomb shape. m blocks are traced back forward, and the contents of the m blocks are calculated respectively using a target random algorithm to obtain m random numbers to determine the block-producing nodes in the honeycomb organization. A large amount of calculation is not required, and the consensus of the next block-producing node is selected based on the existing blocks. The algorithm is simple, saves computing power, and improves the efficiency of blockchain consensus.
[0105] In some embodiments, the computing module 503 is specifically configured to:
[0106] Perform hash calculation on the content of any j-th block among m blocks to obtain N characters, where N is a positive integer;
[0107] The information exchange standard codes corresponding to N characters are superimposed and modulo p to obtain the random number corresponding to the j-th block.
[0108] In some embodiments, p=6, and the value range of the random number is 1-6.
[0109] In some embodiments, the units in the mth level are server nodes; the selection module 504 is specifically configured to:
[0110] According to the mth random number to the first random number, determine the selected unit in the first level to the selected server node in the mth level in sequence;
[0111] The selected server node in the mth level is determined as the block producing node.
[0112] In some embodiments, the blockchain consensus device 500 may further include a generation module for:
[0113] Generate new blocks based on the block-producing nodes;
[0114] Generate a storage data proof string and a data spot check timestamp string;
[0115] Write the storage data proof string and data spot check timestamp string into the new block.
[0116] In some embodiments, the generation module is specifically used to:
[0117] Divide the encrypted data used to generate new blocks into multiple slices;
[0118] Based on multiple slices, build an n-layer Merkle tree, where n is a positive integer;
[0119] Go back and forth to get n blocks and get the contents of n blocks;
[0120] Based on the target random algorithm, the contents of n blocks are calculated respectively to obtain n random numbers, which constitute the Merkle path;
[0121] Add the hash values on the Merkle path and use the hash function to calculate the addition result to obtain the storage data proof string.
[0122] In some embodiments, the generation module is specifically used to:
[0123] The key of the block-producing node is used to sign the stored data proof string to obtain the data spot check timestamp string.
[0124] Figure 5 Each module / unit in the device shown has the function of implementing each step in the blockchain consensus method provided by the above method embodiment and can achieve its corresponding technical effect. For the sake of brevity, it will not be repeated here.
[0125] Based on the blockchain consensus method provided in the above embodiments, this application also provides specific implementation methods of electronic devices. Please refer to the following embodiments.
[0126] Figure 6 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown.
[0127] The electronic device may include a processor 601 and a memory 602 storing computer program instructions.
[0128] Specifically, the processor 601 may include a central processing unit (CPU) or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0129] The memory 602 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 602 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. In one example, the memory 602 may include a removable or non-removable (or fixed) medium, or the memory 602 may be a non-volatile solid-state memory. The memory 602 may be inside or outside the integrated gateway disaster recovery device.
[0130] In one example, the memory 602 may be a read-only memory (ROM). In one example, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or a flash memory, or a combination of two or more of these.
[0131] The memory 602 may include read-only memory (ROM), random access memory (RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical or other physical / tangible memory storage devices. Thus, generally, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present application.
[0132] The processor 601 implements the method / steps in the above-mentioned method embodiment by reading and executing the computer program instructions stored in the memory 602, and achieves the corresponding technical effects achieved by the method embodiment executing its method / steps. For the sake of brevity, it will not be repeated here.
[0133] In one example, the electronic device may further include a communication interface 603 and a bus 610. Figure 6 As shown, the processor 601, the memory 602, and the communication interface 603 are connected via a bus 610 and communicate with each other.
[0134] The communication interface 603 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0135] Bus 610 includes hardware, software or both, couples the parts of electronic equipment to each other.For example, but not limitation, bus may include Accelerated Graphics Port (AGP) or other graphics buses, Enhanced Industry Standard Architecture (EISA) bus, Front Side Bus (FSB), Hyper Transport (HT) interconnection, Industry Standard Architecture (ISA) bus, InfiniBand interconnection, Low Pin Count (LPC) bus, memory bus, Micro Channel Architecture (MCA) bus, Peripheral Component Interconnect (PCI) bus, PCI-Express (PCI-X) bus, Serial Advanced Technology Attachment (SATA) bus, Video Electronics Standards Association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 610 may include one or more buses. Although the present application embodiment describes and shows specific bus, the application considers any suitable bus or interconnection.
[0136] In addition, in conjunction with the blockchain consensus method in the above embodiments, embodiments of the present application may provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any of the blockchain consensus methods in the above embodiments is implemented. Examples of computer-readable storage media include non-transitory computer-readable storage media, such as electronic circuits, semiconductor memory devices, ROM, random access memory, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, and hard disks.
[0137] It should be understood that the present application is not limited to the specific configurations and processes described above and illustrated in the figures. For the sake of brevity, a detailed description of known methods is omitted here. In the above embodiments, several specific steps are described and illustrated as examples. However, the method process of the present application is not limited to the specific steps described and illustrated. Those skilled in the art can make various changes, modifications, and additions, or change the order of the steps after understanding the spirit of the present application.
[0138] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROMs, flash memories, erasable ROMs (EROMs), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0139] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps. In other words, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0140] Aspects of the present application have been described above with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed via the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. This processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit. It is also understood that each box in the block diagram and / or the flowchart and the combination of the boxes in the block diagram and / or the flowchart can also be implemented by the dedicated hardware that performs the specified function or action, or can be implemented by the combination of dedicated hardware and computer instructions.
[0141] The above description is only a specific embodiment of the present application. Those skilled in the art will clearly understand that for the convenience and brevity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the scope of protection of the present application.
Claims
1. A blockchain consensus method, characterized in that: include: Based on multiple server nodes, a blockchain network with m levels is constructed. The first level includes p units, and each unit in the i-th level includes p units in the i+1-th level. 1≤i≤m-1, i, m, and p are all positive integers. Trace back m blocks and get the contents of the m blocks; Based on the target random algorithm, the contents of the m blocks are respectively calculated to obtain m random numbers; According to the m random numbers, a recursive operation is performed layer by layer from the m-level blockchain network to select a server node, and a server node selected from the m-th level is used as a block production node.
2. The method according to claim 1, characterized in that The target-based random algorithm is used to calculate the contents of the m blocks to obtain m random numbers, specifically including: Perform hash calculation on the content of any j-th block among the m blocks to obtain N characters, where N is a positive integer; The information exchange standard codes corresponding to the N characters are superimposed, and modulo p is taken to obtain a random number corresponding to the j-th block.
3. The method according to claim 1 or 2, characterized in that p=6, the random number range is 0 to 5.
4. The method according to claim 1, wherein The units in the mth level are the server nodes; The method of selecting a server node from the m-level blockchain network by recursive operation layer by layer according to the m random numbers, and using a server node selected from the m-th level as a block generating node, specifically includes: Determining, in sequence, the selected unit in the first level to the selected server node in the m-th level according to the m-th random number to the first random number; The selected server node in the mth level is determined as the block producing node.
5. The method according to claim 1, wherein After recursively selecting a server node from the m-level blockchain network layer by layer according to the m random numbers, and using a server node selected from the m-th level as a block production node, the method further includes: Generate a new block based on the block-producing node; Generate a storage data proof string and a data spot check timestamp string; The stored data proof string and the data spot check timestamp string are written into the new block.
6. The method according to claim 5, characterized in that The generation of the stored data proof string and the data spot check timestamp string specifically includes: Dividing the encrypted data used to generate the new block into a plurality of slices; Based on the multiple slices, construct an n-layer Merkle tree, where n is a positive integer; Trace back n blocks and get the contents of the n blocks; Based on the target random algorithm, operations are performed on the contents of the n blocks respectively to obtain n random numbers, and the n random numbers constitute a Merkle path; The hash values on the Merkle path are added together, and the addition result is calculated using a hash function to obtain the stored data proof string.
7. The method according to claim 5, characterized in that The generation of the stored data proof string and the data spot check timestamp string specifically includes: The stored data proof string is signed using the key of the block-producing node to obtain the data spot check timestamp string.
8. A blockchain consensus device, characterized in that: The device comprises: A building block for constructing an m-level blockchain network based on multiple server nodes, where the first level includes p units, and each unit in the i-th level includes p units in the i+1-th level, where 1≤i≤m-1, and i, m, and p are all positive integers. An acquisition module is used to trace back and acquire m blocks and obtain the contents of the m blocks; A calculation module, configured to perform calculations on the contents of the m blocks based on a target random algorithm to obtain m random numbers; The selection module is used to perform a recursive operation layer by layer to select a server node from the m-level blockchain network according to the m random numbers, and use a server node selected from the m-th level as a block production node.
9. An electronic device, characterized in that: The electronic device includes: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the blockchain consensus method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the blockchain consensus method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Block chain consensus processing method, electronic device and computer readable storage medium
CN108763302A
KR20200144756A