Blockchain-based data processing method, device and related equipment
By polling and updating the resource transfer subject queue in the blockchain system, the next building node in the next building cycle is converted from the normal state to the building state, the problems of excessive computing power consumption and low attack cost in the POW and POS consensus algorithms are solved, and the fairness and security of the blockchain system are achieved.
Patent Information
- Application Number
- CN202110226487.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-01
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2041-03-01
AI Technical Summary
In the existing blockchain systems, the POW and POS consensus algorithms have problems such as excessive computing power consumption and low attack costs, which affects the fairness and security of the blockchain.
A blockchain-based data processing method is proposed. By obtaining resource transfer information of the previous block and the current building cycle of the previous building cycle, the resource transfer subject queue is polled and updated, so that the head of the resource transfer subject queue of the current building cycle is the next building node of the next building cycle, so as to convert it into the building state within the next building cycle.
This method saves computing power and improves security, while ensuring the fairness of each node in the blockchain system obtaining the right to build blocks, thus ensuring the fairness and security of the blockchain system.
Smart Images

Figure CN114997862B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of blockchain technology, and in particular, to a data processing method and apparatus, an electronic device, and a computer-readable storage medium based on blockchain. Background Art
[0002] With the development of computer technology, blockchain systems have emerged. A blockchain system is a distributed and decentralized storage system with features such as "non-forgeable", "traceable throughout the process", "traceable", "open and transparent", and "collectively maintained". To achieve the above features, in a blockchain system, the most important algorithm is the consensus algorithm.
[0003] Currently, the most common consensus algorithms are the POW (Proof Of Work) consensus algorithm and the POS (ProofOf Stake) consensus algorithm. Among them, the POW algorithm may consume a large amount of computing power that does not create any useful value; although the POS algorithm consumes less computing power, it also has a low attack cost due to less computing power consumption, and is easily subject to block attacks by dirty data. In addition, in the POS algorithm, nodes with a large number of electronic coins or nodes that have held electronic assets for a long time have a greater probability of obtaining the block building right, which will cause the consensus in the blockchain to be dominated by a small number of accounts, thus losing fairness.
[0004] It should be noted that the information disclosed in the above background art section is only used to enhance the understanding of the background of the present disclosure. Summary of the Invention
[0005] Embodiments of the present disclosure provide a data processing method and apparatus, an electronic device, and a computer-readable storage medium based on blockchain, which can save computing power, be not easily attacked, and at the same time ensure the fairness of each node in the blockchain system to obtain the block building right, thereby ensuring the fairness of the blockchain system.
[0006] Other features and advantages of the present disclosure will become apparent through the following detailed description, or be learned in part through the practice of the present disclosure.
[0007] An embodiment of the present disclosure provides a data processing method based on a blockchain. The method is applied to a node in a block building state during the current block building cycle in a blockchain system. The method may include: obtaining a previous block generated by the blockchain system during the previous block building cycle, where the previous block includes a resource transfer subject queue during the previous block building cycle, and the node in the block building state during the current block building cycle is at the head of the resource transfer subject queue during the previous block building cycle; obtaining resource transfer information of the blockchain system during the current block building cycle, where the resource transfer information corresponds to the resource transfer subject during the current block building cycle; polling and updating the resource transfer subject queue during the previous block building cycle according to the resource transfer subject during the current block building cycle and the node in the block building state during the current block building cycle to generate a resource transfer subject queue for the current block building cycle, where the head of the resource transfer subject queue for the current block building cycle is the next block building node for the next block building cycle, so as to convert the next block building node from an ordinary state to the block building state during the next block building cycle; establishing a target block for the current block building cycle, where the target block includes the resource transfer information during the current block building cycle and the resource transfer subject queue during the current block building cycle.
[0008] An embodiment of the present disclosure provides a blockchain system. The blockchain system includes: nodes in an ordinary state and nodes in a block building state.
[0009] Among them, the node in the normal state broadcasts resource transfer information as the resource transfer subject within the current block building cycle; the node in the block building state is used to obtain the previous block generated by the blockchain system in the previous block building cycle, and the previous block includes the resource transfer subject queue in the previous block building cycle. The node in the block building state in the current block building cycle is at the head of the resource transfer subject queue in the previous block building cycle; obtain the resource transfer information of the blockchain system in the current block building cycle, and the resource transfer information includes the resource transfer subject in the current block building cycle; poll and update the resource transfer subject queue in the previous block building cycle according to the resource transfer subject in the current block building cycle and the node in the block building state in the current block building cycle to generate the resource transfer subject queue in the current block building cycle, where the head of the resource transfer subject queue in the current block building cycle is the next block building node in the next block building cycle, so as to convert the next block building node from the normal state to the block building state in the next block building cycle; establish the target block of the current block building cycle, and the target block includes the resource transfer information in the current block building cycle and the resource transfer subject queue in the current block building cycle; at the end of the current block building cycle, convert the state of the block building node from the block building state to the normal state; the node in the normal state is also used to receive and record the target block established in the current block building cycle, and when the head of the resource transfer subject queue in the target block is the node in the normal state, then at the beginning of the next block building cycle, convert the state of the node in the normal state to the block building state.
[0010] An embodiment of the present disclosure provides a blockchain-based data processing device, which is applied to a node in the block building state in the current block building cycle in a blockchain system. The device includes: a previous block acquisition module, a resource transfer information acquisition module, a resource transfer subject queue update module, and a target blockchain establishment module.
[0011] Among them, the previous block acquisition module can be configured to acquire the previous block generated by the blockchain system in the previous block building cycle. The previous block includes the resource transfer subject queue in the previous block building cycle, and the node in the block building state in the current block building cycle is the head node of the resource transfer subject queue in the previous block building cycle; the resource transfer information acquisition module can be configured to acquire the resource transfer information of the blockchain system in the current block building cycle, and the resource transfer information corresponds to the resource transfer subject in the current block building cycle; the resource transfer subject queue update module can be configured to poll and update the resource transfer subject queue in the previous block building cycle according to the resource transfer subject in the current block building cycle and the node in the block building state in the current block building cycle, and generate the resource transfer subject queue in the current block building cycle, where the head of the resource transfer subject queue in the current block building cycle is the next block building node in the next block building cycle, so as to convert the next block building node from the normal state to the block building state in the next block building cycle; the target blockchain building module can be configured to build the target block in the current block building cycle, and the target block includes the resource transfer information in the current block building cycle and the resource transfer subject queue in the current block building cycle.
[0012] In some embodiments, the resource transfer subject queue update module may include: a new resource transfer subject determination unit, a new resource transfer subject insertion unit, a head transfer unit, a next block building node determination unit, and a resource transfer subject queue complete update unit.
[0013] Among them, the new resource transfer subject determination unit can be configured to compare the resource transfer subject in the current block building cycle with the resource transfer subject queue in the previous block building cycle to determine the new resource transfer subject that does not appear in the resource transfer subject queue in the previous block building cycle; the new resource transfer subject insertion unit can be configured to insert the new resource transfer subject into the tail of the resource transfer subject queue in the previous block building cycle; the head transfer unit can be configured to transfer the node in the block building state in the current block building cycle from the head of the resource transfer subject queue in the previous block building cycle to the tail; the next block building node determination unit can be configured to determine whether the current head node of the resource transfer subject queue in the previous block building cycle accepts to be the next block building node in the next block building cycle; the resource transfer subject queue complete update unit can be configured to generate the resource transfer subject queue in the current block building cycle if the current head node of the resource transfer subject queue in the previous block building cycle accepts to be the next block building node in the next block building cycle.
[0014] In some embodiments, the resource transfer subject queue update module may further include: a current head node deletion subunit, a next head node determination unit, and a next block building node determination unit.
[0015] Among them, the current head node deletion subunit may be configured to delete the current head node of the resource transfer subject queue in the previous block building cycle if the current head node of the resource transfer subject queue in the previous block building cycle does not accept becoming the next block building node in the next block building cycle; the next head node determination unit may be configured to determine whether the next head node of the resource transfer subject queue in the previous block building cycle accepts becoming the block building node in the next block building cycle; the next block building node determination unit may be configured to generate the resource transfer subject queue of the current block building cycle if the next head node of the resource transfer subject queue in the previous block building cycle accepts becoming the block building node in the next block building cycle.
[0016] In some embodiments, the new resource transfer subject insertion unit may include: a target transaction amount determination subunit, a transaction amount sorting subunit, and a new resource transfer subject insertion subunit.
[0017] Among them, the target transaction amount determination subunit may be configured to determine the target transaction amount corresponding to each new resource transfer subject according to the resource transfer information in the current block building cycle; the transaction amount sorting subunit may be configured to sort each new resource transfer subject according to the target transaction amount; the new resource transfer subject insertion subunit may be configured to insert the new resource transfer subject into the end of the resource transfer subject queue in the previous block building cycle according to the sorting result.
[0018] In some embodiments, the new resource transfer subject insertion subunit may also be configured to: insert the new resource transfer subjects with the top N sorted target transaction amounts into the end of the resource transfer subject queue in the previous block building cycle, where N is a positive integer greater than or equal to 1.
[0019] In some embodiments, the resource transfer subject queue update module may include: a current block building cycle transaction amount acquisition unit, a transaction amount sorting unit, and an elimination unit.
[0020] Among them, the current block building cycle transaction amount acquisition unit can be configured to acquire the transaction amounts of each resource transfer entity in the resource transfer entity queue of the current block building cycle within the current block building cycle; the transaction amount sorting unit can be configured to sort each resource transfer entity in the resource transfer entity queue within the current block building cycle according to the transaction amount within the current block building cycle; the elimination unit can be configured to eliminate resource transfer entities with a transaction amount less than the target threshold within the resource transfer entity queue within the current block building cycle.
[0021] In some embodiments, the blockchain-based data processing device may further include: a broadcast module and a state conversion module.
[0022] Among them, the broadcast module can be configured to broadcast the target block to the nodes in the blockchain system in the normal state; the state conversion module can be configured to convert the nodes in the block building state within the current block building cycle into the normal state at the end of the current block building cycle.
[0023] An embodiment of the present disclosure provides an electronic device, which includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the blockchain-based data processing method described in any one of the above.
[0024] An embodiment of the present disclosure provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements the blockchain-based data processing method described in any one of the above.
[0025] An embodiment of the present disclosure provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the above-mentioned blockchain-based data processing method.
[0026] The data processing method, device, electronic device and computer-readable storage medium based on blockchain provided by the embodiments of the present disclosure generate a resource transfer subject queue for the current block building cycle according to the resource transfer subjects in the current block building cycle and the nodes in the block building state in the current block building cycle, so as to simply and conveniently determine the nodes in the block building state in the next block building cycle. This method for determining the block building nodes, on the one hand, greatly saves computing power and avoids waste of computing resources; on the other hand, by maintaining the resource transfer subject queue, it ensures the fairness of each node becoming a block building node; in addition, since the construction and maintenance of the resource transfer subject queue are only related to the resource transfer subjects and the nodes in the block building node state in each block building cycle, it can ensure that the nodes in the block building state in each block building cycle are not attacked, improving the security of the blockchain system.
[0027] It should be understood that the above general description and the following detailed description are only exemplary and do not limit the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The accompanying drawings herein are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present disclosure and, together with the specification, are used to explain the principles of the present disclosure. The drawings described below are only some embodiments of the present disclosure, and those of ordinary skill in the art can obtain other drawings based on these drawings without creative efforts.
[0029] Figure 1 is a schematic diagram of a blockchain system shown according to an exemplary embodiment.
[0030] Figure 2 is a schematic diagram of a node in a blockchain system shown according to an exemplary embodiment.
[0031] Figure 3 schematically shows a schematic diagram of a block structure according to an embodiment of the present disclosure.
[0032] Figure 4 is a schematic diagram of a block generation process shown according to an exemplary embodiment.
[0033] Figure 5 is a flowchart of a data processing method based on blockchain shown according to an exemplary embodiment.
[0034] Figure 6 is a schematic diagram of the information content of a resource transfer information shown according to an exemplary embodiment.
[0035] Figure 7 is a schematic diagram of a block building process shown according to an exemplary embodiment.
[0036] Figure 8 is Figure 5 The flowchart of step S3 in an exemplary embodiment.
[0037] Figure 9 It is a schematic diagram of updating the resource transfer subject queue shown according to an exemplary embodiment.
[0038] Figure 10 It is a schematic diagram of the process for an ordinary node to compete for the block building right shown according to an exemplary embodiment.
[0039] Figure 11 It is a flowchart of the operation of a blockchain system shown according to an exemplary embodiment.
[0040] Figure 12 It is a block diagram of a data processing device based on a blockchain shown according to an exemplary embodiment.
[0041] Figure 13 It shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure. Detailed implementation manners
[0042] Now, example embodiments will be described more fully with reference to the accompanying drawings. However, the example embodiments can be implemented in various forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art. Identical reference numerals in the figures denote identical or similar parts, and thus their repetitive description will be omitted.
[0043] The features, structures, or characteristics described in this disclosure can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of the embodiments of this disclosure. However, those skilled in the art will realize that one or more of the specific details can be omitted in practicing the technical solutions of this disclosure, or other methods, components, devices, steps, etc. can be adopted. In other cases, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of this disclosure.
[0044] The accompanying drawings are only schematic illustrations of this disclosure, and identical reference numerals in the figures denote identical or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the drawings do not necessarily have to correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0045] The flowcharts shown in the accompanying drawings are only illustrative, not necessarily including all content and steps, nor necessarily executed in the described order. For example, some steps can be decomposed, while some steps can be combined or partially combined. Therefore, the actual execution order may change according to the actual situation.
[0046] In this specification, the terms "a", "one", "the", "said" and "at least one" are used to indicate the existence of one or more elements / components / etc.; the terms "comprising", "including" and "having" are used to mean an open inclusion and refer to the existence of additional elements / components / etc. in addition to the listed elements / components / etc.; the terms "first", "second", "third", etc. are only used as labels and are not a limitation on the quantity of their objects.
[0047] First, the nouns involved in the embodiments are explained.
[0048] Consensus algorithm: In a distributed system, there is an unavoidable problem, namely the consistency problem: for multiple nodes in the system, given a series of operations, how to make the global reach a certain degree of agreement on the local processing results? The blockchain architecture is a typical distributed architecture. The consensus algorithm is the process of reaching a consensus among all nodes in the blockchain system on a certain proposal.
[0049] POW consensus algorithm: Simply understood, it is a proof used to confirm that you have done a certain amount of work. POW determines the probability of a node obtaining a block based on the amount of work completed by the node in the network.
[0050] POS consensus algorithm: Simply understood, it is a proof of equity. In this mode, interest will be allocated to you according to the amount and time of the electronic assets you hold. In the POS mode, the longer the holding time of the electronic assets or the larger the holding amount of the electronic assets, the easier it is to obtain the right to create a new block.
[0051] Asymmetric encryption algorithm: The asymmetric encryption algorithm requires two keys: a public key (publickey, abbreviated as public key) and a private key (privatekey, abbreviated as private key). The public key and the private key are a pair. If the data is encrypted with the public key, only the corresponding private key can decrypt it. Similarly, if the data is encrypted with the private key, only the corresponding public key can decrypt it.
[0052] RSA: A typical asymmetric encryption algorithm proposed by Ron Rivest, Adi Shamir and Leonard Adleman.
[0053] Message digest algorithm: A class of encryption algorithms. The encryption process does not require a key, and the encrypted data cannot be decrypted.
[0054] SHA256, a message digest algorithm with an extremely low collision probability.
[0055] In the embodiments of the present disclosure, blockchain technology is involved. Next, the blockchain technology will be introduced in combination with the application scenarios of the embodiments of the present disclosure.
[0056] Figure 1 It is a schematic diagram of a blockchain system shown according to an exemplary embodiment.
[0057] See Figure 1 The blockchain system shown. The blockchain system 100 refers to a system for sharing data between nodes. The blockchain system may include multiple nodes 101. The multiple nodes 101 may refer to each client in the blockchain system. Each client may be various electronic devices with computing capabilities, including but not limited to servers, smartphones, tablets, laptop computers, desktop computers, wearable devices, virtual reality devices, smart homes, etc. When each node 101 is operating normally, it can receive input information and maintain the shared data within the blockchain system based on the received input information. To ensure information intercommunication within the blockchain system, there may be information connections between each node in the blockchain system, and nodes can transmit information through the above information connections. For example, when any node in the blockchain system receives input information, other nodes in the blockchain system obtain the input information according to the consensus algorithm and store the input information as data in the shared data, so that the data stored on all nodes in the blockchain system is consistent.
[0058] In the blockchain system, in order to maintain the blockchain, a block can be constructed every once in a while to store the data within that time period in the block of the blockchain. For example, a block can be constructed every ten minutes and the constructed block can be linked to the blockchain. The time period for constructing a block can be called the block construction period.
[0059] Within a block construction period, the blockchain system can package and construct the data within the current block construction period through a node in the block construction state. The node in the block construction state can be called the current block construction node (such as Figure 2 the white node shown), and other nodes in the blockchain system except the current block construction node can be current ordinary nodes (such as Figure 2 the white node shown). It can be understood that any node may be the "block construction node" at present, and each node in the blockchain system will communicate with any other node in the blockchain system.
[0060] Then, obtaining the input information of each node according to the consensus algorithm and storing the input information as the data in the shared data, so that the data stored on all nodes in the blockchain system is consistent, may include the following process:
[0061] Suppose that in the blockchain system, within each block building cycle which is a period of time, a node is elected to be in the block building state (hereinafter referred to as the "block building node" for short) within each block building cycle, so as to build and store the data on the chain within the current block building cycle through the block building node. After the block building node completes the block building operation within the current block building cycle, it will broadcast the built block to other nodes in the blockchain system for other nodes to verify and store, so that the data stored on all nodes in the blockchain system is consistent.
[0062] Each node in the blockchain system has its corresponding node identifier, and each node in the blockchain system can store the node identifiers of other nodes in the blockchain system, so as to broadcast the generated block to other nodes in the blockchain system according to the node identifiers of other nodes later. A node identifier list as shown in the following table can be maintained in each node, and the node name and the node identifier are stored in the node identifier list correspondingly. Among them, the node identifier can be an IP (Internet Protocol) address and any other information that can be used to identify the node. Only the IP address is taken as an example in Table 1 for illustration.
[0063] Node Name Node Identifier Node 1 117.114.151.174 Node 2 117.116.189.145 … … Node N 119.123.789.258
[0064] Each node in the blockchain system stores the same blockchain. Refer to Figure 3 , the blockchain is composed of multiple blocks. The genesis block may include a block header and a block body. The block header may store an input information feature value, a version number, a timestamp, and a difficulty value. The block body may store the input information and may also store a resource transfer subject queue, etc.; the next block of the genesis block uses the genesis block as the parent block. The next block also includes a block header and a block body. The block header stores the input information feature value of the current block, the resource transfer subject queue, the block header feature value of the parent block, the version number, the timestamp, and the difficulty value, and so on. In this way, the block data stored in each block in the blockchain is associated with the block data stored in the parent block, ensuring the security of the input information in the block.
[0065] When generating each block in the blockchain, refer to Figure 4, the block building nodes within the current block building cycle will listen to all input information on the blockchain system, verify the input information, and after the verification is completed, store the input information in the memory pool and update the hash tree used to record the input information; then, update the timestamp to the time when the input information is received, and try different random numbers, and perform eigenvalue calculations multiple times so that the calculated eigenvalue can satisfy the following formula:
[0066] SHA256(SHA256(version + prev_hash + merkle_root + ntime + nbits + x)) < TARGET
[0067] Among them, SHA256 is the eigenvalue algorithm used to calculate the eigenvalue; version (version number) is the version information of the relevant block protocol in the blockchain; prev_hash is the block header eigenvalue of the parent block of the current block; merkle_root is the eigenvalue of the input information; ntime is the update time of the updated timestamp; nbits is the current difficulty, which is a fixed value within a certain period of time and is determined again after exceeding the fixed time period; x is a random number; TARGET is the eigenvalue threshold, and this eigenvalue threshold can be determined according to nbits.
[0068] In this way, when a random number that satisfies the above formula is calculated, the information can be stored correspondingly, the block header and the block body are generated, and the current block within the current block building cycle is obtained. Subsequently, the block building node sends the newly generated block to other nodes in its blockchain system according to the node identifiers of other nodes in the blockchain system, and other nodes verify the newly generated block and add the newly generated block to the blockchain they store after the verification is completed.
[0069] Figure 5 is a flowchart of a data processing method based on blockchain shown according to an exemplary embodiment.
[0070] In the embodiments of the present disclosure, the blockchain system can establish blocks according to a certain block building cycle (for example, this block building cycle can be 10 minutes), and elect block building nodes for building blocks within each block building cycle (that is, determine a node to be in the block building state) to package and build blocks for the resource transfer data within the block building cycle. Within a block building cycle, there is a unique "block building node", and the remaining nodes are all "ordinary nodes" (that is, nodes in the ordinary state). Each node in the blockchain system is fair, there is no privileged node, and each node may switch between the two roles of "block building node" and "ordinary node".
[0071] Ordinary nodes are responsible for broadcasting resource transfer information in the blockchain system, receiving and verifying the resource transfer information of other nodes, and selectively participating in the election of block-building nodes in the next block-building cycle. Among them, the resource transfer information may refer to data that needs to be transferred in the blockchain system (such as data that needs to be uploaded to the blockchain).
[0072] The block-building nodes are responsible for collecting the resource transfer information in the blockchain system in the current block-building cycle to create a block, and selecting the "block-building nodes" in the next block-building cycle. While being responsible for block building, the block-building nodes also have the functions of ordinary nodes, that is, they can also be responsible for broadcasting resource transfer information, receiving and verifying the resource transfer information of other nodes, etc., and the present disclosure does not limit this.
[0073] In the blockchain system, each node has a pair of public and private keys. The private key is saved by each node itself and is not publicly disclosed, that is, only the node itself knows its private key; the public key is publicly disclosed, that is, one node will know the public keys of all other nodes, and the public key will also be used as the unique identity identifier of the node.
[0074] The method provided by the embodiments of the present disclosure can be executed by the nodes in the block-building state in the current block-building cycle in the blockchain system. The nodes in the block-building state in the current block-building cycle can be any electronic device with computing and processing capabilities, such as a server or a terminal device, or can be composed of a server and a terminal device together. In the following embodiments, the node in the block-building state is taken as an example of a server for illustration, but the present disclosure is not limited thereto.
[0075] Refer to Figure 5 , the blockchain-based data processing provided by the embodiments of the present disclosure may include the following steps.
[0076] In step S1, obtain the previous block generated by the blockchain system in the previous block-building cycle. The previous block includes the resource transfer subject queue in the previous block-building cycle, and the node in the block-building state in the current block-building cycle is at the head of the resource transfer subject queue in the previous block-building cycle.
[0077] It can be understood that each node in the blockchain system stores a full blockchain (that is, a complete blockchain), and the blockchains among the nodes are consistent and unified.
[0078] When entering the current block building cycle, the nodes in the block building state within the current block building cycle (hereinafter referred to as "block building nodes within the current block building cycle") can obtain the previous block generated in the previous block building cycle from the blockchain. Among them, the block body of the previous block can store a resource transfer subject queue within the previous block building cycle. Among them, the members of the resource transfer subject queue can be composed of the public keys of each resource transfer subject (which can also be identity identification information such as node numbers and names, and the present disclosure does not limit this), and the resource transfer subject can be a node that broadcasts resource transfer information in the blockchain system.
[0079] In some embodiments, there may be no previous block building cycle in the current block building cycle, that is, the current block building cycle is the first block building cycle in the blockchain system. Then, the block building nodes within the current block building cycle can construct a resource transfer subject queue based on the nodes in the block building state within the current block building cycle to serve as the resource transfer subject queue of the "previous block building cycle" (for example, the block building nodes within the current block building cycle can use themselves as the head of the resource transfer subject queue within the previous block building cycle).
[0080] In step S2, obtain the resource transfer information of the blockchain system within the current block building cycle, and the resource transfer information corresponds to the resource transfer subject within the current block building cycle.
[0081] In some embodiments, the resource transfer information within the current block building cycle may refer to the data requested to be uploaded to the chain within the current block building cycle in the blockchain system.
[0082] Generally speaking, the resource transfer information may not only include the data requested to be uploaded to the chain, but also include, as Figure 6 shown, the first part: the public key of the initiator (i.e., the public key of the node that sends the resource transfer data) and the public key of the recipient (the public key of the node that receives the resource transfer data), the second part: the transaction amount (the trading amount of the electronic assets involved in this resource transfer, for example, for this resource transfer process, the number of electronic assets that the sender will transfer or issue), the third part: the information digest of the resource transfer data, etc.
[0083] Among them, the electronic assets involved in the second part can be a recognized form of electronic resources in the blockchain system, and the present disclosure does not limit this electronic asset.
[0084] Among them, the third part is to generate a digest for all resource transfer information using SHA256, and then use the private key of the initiator to perform RSA encryption on the digest information. This information is to prevent malicious nodes from forging transaction information. Since only the node itself knows the private key and the public key is public, when other nodes receive the transaction information, they can use the corresponding public key to decrypt the digest information, and then calculate the SHA256 digest again and compare the values of the two. If the information is consistent, it means that the transaction information has not been tampered with.
[0085] It should be noted that the sender node corresponding to the sender's public key or the receiver node corresponding to the receiver's public key can both be the resource transfer entity in the embodiments of the present disclosure.
[0086] In the following embodiments, the present disclosure will use the sender node corresponding to the sender's public key as the resource transfer entity involved in the embodiments of the present disclosure, but the present disclosure is not limited thereto.
[0087] It can be understood that a resource transfer information can correspond to a resource transfer entity (that is, a resource transfer information is initiated by an initiator).
[0088] In step S3, according to the resource transfer entity in the current block building period and the nodes in the block building state in the current block building period, poll and update the resource transfer entity queue in the previous block building period to generate the resource transfer entity queue in the current block building period, where the head of the resource transfer entity queue in the current block building period is the next block building node in the next block building period, so as to convert the next block building node from the normal state to the block building state in the next block building period.
[0089] In some embodiments, the resource transfer entity queue in the previous block building period in the previous block can be polled and updated according to the resource transfer entity in the current block building period (that is, the resource transfer entity that has successfully broadcast the resource transfer information in the current block building period) and the nodes in the block building state in the current block building period.
[0090] For example, the resource transfer entity in the current block building cycle can be randomly inserted into the end of the resource transfer entity queue in the previous block building cycle, and then the nodes in the block building state in the current block building cycle are transferred from the head of the queue to the end of the queue to generate the resource transfer queue in the current block building cycle; or it can be inserted into the end of the resource transfer entity queue in the previous block building cycle according to the activity of the resource transfer entity in the current block building cycle, etc., and then the nodes in the block building state in the current block building cycle are transferred from the head of the queue to the end of the queue to generate the resource transfer queue in the current block building cycle. The present disclosure does not limit this. Among them, the activity of the resource transfer entity in the current block building cycle can refer to the number of resource transfers of the resource transfer entity in the current block building cycle, the size of the transaction amount of the resource transfer entity in the current block building cycle, etc. The present disclosure does not limit this.
[0091] In some embodiments, the head node of the resource transfer entity queue in the current block building cycle can be the block building node in the next block building cycle.
[0092] In step S4, the target block of the current block building cycle is established, and the target block includes the resource transfer information in the current block building cycle and the resource transfer entity queue in the current block building cycle.
[0093] In some embodiments, at the end of the current block building cycle, the nodes in the block building state in the current block building cycle will package the resource transfer information in the current block building cycle and the resource transfer entity queue in the current block building cycle to generate the target block.
[0094] In some embodiments, after the nodes in the block building state in the current block building cycle complete the construction of the target block, the nodes in the block building state in the current block building cycle will broadcast the target block to the nodes in the normal state in the blockchain system so that the nodes in the normal state can perform bookkeeping. In addition, at the end of the current block building cycle, the state of the nodes in the block building state in the current block building cycle will also be converted from the block building state to the normal state.
[0095] It can be understood that when the nodes in the normal state in the current block building cycle receive the target block broadcast by the nodes in the block building state in the current block building cycle, they will verify the resource transfer information in the target block. For example, verifying whether the resource transfer entity corresponding to the resource transfer information is legal; for example, verifying whether the amount of electronic assets held by the resource transfer entity corresponding to the resource transfer information is sufficient, etc. The present disclosure does not limit this.
[0096] The technical solutions provided in the above embodiments can also be passed through such as Figure 7The process implementation is as follows: The current block-building node in the current block-building cycle starts the block-building process; the current block-building node collects resource transfer information (i.e., transaction information) in the current block-building cycle; after reaching the deadline of the current block-building cycle, the current block-building node stops collecting resource transfer information; obtains the resource transfer subject queue in the previous block in the previous block-building cycle generated in the previous block-building cycle, and updates the resource transfer subject queue in the previous block-building cycle according to the resource transfer subjects in the current block-building cycle and the current block-building node to generate the resource transfer subject queue in the current block-building cycle; the current block-building node packs and builds blocks for the resource transfer subjects in the current block-building cycle and the resource transfer subject queue in the current block-building cycle to generate a block, and broadcasts the block information of the block across the network so that ordinary nodes in the blockchain can record accounts for the block; at the end of the current block-building cycle, the current block-building node transfers the block-building right to the block-building node in the next block-building cycle, that is, transfers the block-building right to the node at the head of the queue of resource transfer subjects in the current block-building cycle, so that the next block-building node can continue the block-building process.
[0097] In the current block-building cycle of the blockchain, the block-building node can obtain benefits in the following ways to further drive the normal operation of the blockchain system:
[0098] First is the block-building reward. The block-building node that successfully builds a block can obtain a fixed number of digital assets. For example, the initial value of the digital assets can be set to 50, and then it will be halved every four years until there are about 21 million digital assets in the end. Then, after obtaining the block-building right, the block-building node can charge a handling fee for each transaction at a target percentage (such as 1%).
[0099] The present disclosure does not limit the sources of income of the block-building node.
[0100] Figure 8 Yes Figure 5 It is the flowchart of step S3 in an exemplary embodiment.
[0101] Reference Figure 8 As shown in, the above step S3 may include the following steps.
[0102] In step S31, the resource transfer subjects in the current block-building cycle are compared with the resource transfer subject queue in the previous block-building cycle to determine the newly added resource transfer subjects that did not appear in the resource transfer subject queue in the previous block-building cycle.
[0103] In some embodiments, the resource transfer subjects in the current block-building cycle can be compared with the resource transfer subjects in the resource transfer subject queue in the previous block-building cycle to determine whether there are newly added resource transfer subjects in the current block-building cycle.
[0104] In step S32, insert the newly added resource transfer entity to the end of the resource transfer entity queue within the previous block building cycle.
[0105] In some embodiments, if a newly added resource transfer entity appears within the current block building cycle, the newly added resource transfer entity may be inserted to the end of the resource transfer entity queue within the previous block building cycle.
[0106] Generally speaking, there may be more than one newly added resource transfer entity. Then, the newly added resource transfer entities may be randomly inserted to the end of the queue, or inserted to the end of the resource transfer entity queue according to the activity level of the newly added resource transfer entities within the current block building cycle. Herein, the activity level of the newly added resource transfer entity within the current block building cycle may refer to the transaction amount of the newly added resource transfer entity within the current block building cycle, or may refer to the number of transactions of the newly added resource transfer entity within the current block building cycle, etc. The present disclosure does not limit this.
[0107] For example, the target transaction amount corresponding to each newly added resource transfer entity may be determined according to the resource transfer information within the current block building cycle; each newly added resource transfer entity may be sorted according to the target transaction amount; and the newly added resource transfer entities may be inserted to the end of the resource transfer entity queue within the previous block building cycle according to the sorting result.
[0108] A blockchain-based system is a decentralized system without a central node or a dedicated supervision system. The reason why the entire system can operate according to the established rules is a process of pursuing profit and gaming. There are two bases here: profit-seeking, where interests prompt all blocks to follow certain game rules; and profit maximization decision-making, where nodes will make decisions that they think are currently or ultimately most beneficial for obtaining interests.
[0109] However, in the embodiments of the present disclosure, the system itself wants to ensure that each node can equally take turns building blocks through a polling queue. Then, for a node, splitting itself into multiple nodes (for example, splitting one of its transactions into multiple transactions) can obtain more block building rights. For this approach, it is impossible to prohibit it because it is impossible to determine whether two transaction nodes originally belonged to the same node. The solution is not to prohibit it, but to impose a cost on this operation. Then, there are mainly the following several solutions.
[0110] Method 1: To ensure that each node cannot obtain more block building rights by splitting transactions, when inserting the newly added resource transfer entities to the end of the resource transfer entity queue within the previous block building cycle according to the sorting result, the resource transfer entities with a target transaction amount greater than the target threshold within the current block building cycle may be inserted to the end of the resource transfer entity queue within the previous block building cycle, and the nodes with a target transaction amount of 0 may also be directly excluded, etc.
[0111] Method 2: It is also possible to limit the transaction amount of newly enqueued nodes. The limit for each round of update is that at most N nodes can be newly enqueued (N can be dynamically adjusted). For example, the newly added resource transfer entities with the top N target transaction amounts can be inserted into the tail of the resource transfer entity queue in the previous block building cycle. N is a positive integer greater than or equal to 1, and the present disclosure does not limit this.
[0112] Through the limitations of the above two methods, in order to obtain the block building right as much as possible, each node in the blockchain system will try to reduce the behavior of self - splitting (that is, splitting one transaction into multiple transactions), ensuring the fairness of each node becoming a block building node.
[0113] In step S33, the nodes in the block building state in the current block building cycle are transferred from the head of the resource transfer entity queue in the previous block building cycle to the tail.
[0114] In step S34, it is determined whether the current head node of the resource transfer entity queue in the previous block building cycle accepts to become the next block building node in the next block building cycle.
[0115] In some embodiments, since some nodes may be in a state of being dead or unable to accept the block building right due to some subjective and objective reasons, the nodes in the block building state in the current block building cycle need to confirm with the current head node whether to accept the block building right, so as to determine whether the current head node accepts to become the next block building node in the next block building cycle.
[0116] The nodes in the block building state in the current block building cycle can send a confirmation message to the current head node to determine whether the current head node accepts to become the next block building node in the next block building cycle. The present disclosure does not limit this confirmation method.
[0117] In step S35, if the current head node of the resource transfer entity queue in the previous block building cycle accepts to become the next block building node in the next block building cycle, then generate the resource transfer entity queue for the current block building cycle.
[0118] In some embodiments, if the current head node accepts to become the next block building node in the next block building cycle, it is determined that the resource transfer entity queue for the current block building cycle is generated.
[0119] In step S36, if the current head node of the resource transfer entity queue in the previous block building cycle does not accept to become the next block building node in the next block building cycle, then delete the current head node of the resource transfer entity queue in the previous block building cycle.
[0120] In some embodiments, if the current head node does not accept to become the next block building node in the next block building cycle, then delete the current head node from the queue.
[0121] In step S37, it is determined whether the next head node of the resource transfer subject queue within the previous block building period accepts to become the block building node of the next block building period.
[0122] In some embodiments, confirmation can continue to be made to the next head node of the resource transfer subject queue to determine whether the next head node accepts to become the block building node of the next block building period.
[0123] In step S38, if the next head node of the resource transfer subject queue within the previous block building period accepts to become the block building node of the next block building period, the resource transfer subject queue for the current block building period is generated.
[0124] In some embodiments, if the next head node of the resource transfer subject queue accepts to become the block building node of the next block building period, it is determined that the resource transfer subject queue for the current block building period is generated; if the next head node of the resource transfer subject queue also does not accept to become the block building node of the next block building period, the next head node is deleted and confirmation continues to be made to the next next head node; and so on, until a certain head node accepts to become the block building node of the next block building period, it is determined that the resource transfer subject queue for the current block building period is generated.
[0125] Figure 8 The technical solution provided by the illustrated embodiment can be implemented through Figure 9 the illustrated interaction flowchart, which may specifically include the following steps:
[0126] The current block building node queries whether there are new resource transfer subjects (i.e., new traders) in the blockchain system during the current block building period that were not in the resource transfer subject queue during the previous block building period; if there are new resource transfer subjects during the current block building period, the new resource transfer subjects are found and inserted at the end of the resource transfer subject queue (they can be sorted according to the transaction amount during the current block building period before insertion), and then the current block building node is transferred from the head to the end of the queue; if there are no new resource transfer subjects during the current block building period, the current block building node is directly transferred from the head to the end of the queue; the current block building node makes a confirmation with the current head of the queue to determine whether the current head can (i.e., is willing or able to) transfer the block building right; if the current head node confirms that it can transfer the block building right, the queue update is completed, and the resource transfer subject queue for the current block building period is generated; if the current head node confirms that it cannot transfer the block building right, the current block building node deletes the head node from the queue and continues to confirm with the new head node whether it can transfer the block building right; and so on, until a head node willing to transfer the block building right is found in the resource transfer subject queue, and then the queue update can be completed, and the resource transfer subject queue for the current block building period is generated.
[0127] For an ordinary node in a blockchain, the process of competing to become a block-building node in the blockchain system may include as follows Figure 10 the steps shown.
[0128] The ordinary node broadcasts resource transfer information within the current block-building cycle of the blockchain system; waits for the end of the current block-building cycle; determines whether it is the leading node of the resource transfer entity within the current block-building cycle at the end of the current block-building cycle; if the ordinary node is not the leading node of the resource transfer entity within the current block-building cycle, then the ordinary node remains an ordinary node in the next block-building cycle; if the ordinary node is the leading node of the resource transfer entity within the current block-building cycle, then the ordinary node needs to determine whether to be the block-building node of the next block-building cycle; if the ordinary node does not agree to be elected as the block-building node of the next block-building cycle, then the ordinary node remains an ordinary node in the next block-building cycle; if the ordinary node agrees to be elected as the block-building node of the next block-building cycle, then the ordinary node becomes a block-building node in the next block-building cycle and executes the block-building process at the beginning of the next block-building cycle.
[0129] For the technical solution provided in this embodiment, on the one hand, by adding new resource transfer entities within the current block-building cycle, the resource transfer entity queue in the previous block-building cycle is updated, enabling the newly added and active resource transfer entities within the current block-building cycle to have the opportunity to become block-building nodes in the blockchain system, which to a certain extent encourages nodes in the blockchain system to actively participate in block building and maintains the operation of the blockchain system; on the other hand, through the confirmation operation of whether the current leading node accepts to become the next block-building node, it is ensured that the resource transfer entity elected as the next block-building node in the next block-building cycle can complete the block-building behavior, avoiding the paralysis of the blockchain system caused by the elected next block-building node refusing to build blocks in the next block-building cycle.
[0130] Figure 11 is a flowchart showing the operation of a blockchain system according to an exemplary embodiment.
[0131] In some embodiments, in the blockchain system, there is a block-building cycle every once in a while, and within each block-building cycle, there are nodes in the ordinary state (i.e., ordinary nodes) and nodes in the block-building state (i.e., block-building nodes).
[0132] Then the block-building process of the blockchain system within the current block-building cycle may include the following steps.
[0133] In step S01, a node in the ordinary state, as a resource transfer entity, broadcasts resource transfer information within the current block-building cycle.
[0134] In step S02, a node in the block building state obtains the previous block generated by the blockchain system in the previous block building period. The previous block includes a resource transfer subject queue in the previous block building period. The node in the block building state in the current block building period is at the head of the resource transfer subject queue in the previous block building period.
[0135] In step S03, a node in the block building state obtains the resource transfer information of the blockchain system in the current block building period. The resource transfer information includes the resource transfer subjects in the current block building period.
[0136] In step S04, a node in the block building state polls and updates the resource transfer subject queue in the previous block building period according to the resource transfer subjects in the current block building period and the node in the block building state in the current block building period, and generates the resource transfer subject queue in the current block building period. The head of the resource transfer subject queue in the current block building period is the next block building node in the next block building period, so as to convert the next block building node from the normal state to the block building state in the next block building period.
[0137] In step S05, a node in the block building state establishes the target block of the current block building period. The target block includes the resource transfer information in the current block building period and the resource transfer subject queue in the current block building period.
[0138] In step S06, at the end of the current block building period, the state of the block building node is converted from the block building state to the normal state.
[0139] In step S07, a node in the normal state is also used to receive and record the target block established in the current block building period. And when the head of the resource transfer subject queue in the target block is the node in the normal state, at the beginning of the next block building period, the state of the node in the normal state is converted to the block building state.
[0140] The data processing method based on blockchain provided by the embodiments of the present disclosure generates a resource transfer subject queue for the current block building cycle according to the resource transfer subjects in the current block building cycle and the nodes in the block building state in the current block building cycle, so as to simply and conveniently determine the nodes in the block building state in the next block building cycle. The method for determining the block building node, on the one hand, greatly saves computing power and avoids waste of computing resources; on the other hand, by maintaining the resource transfer subject queue, the fairness of each node becoming a block building node is ensured; in addition, since the construction and maintenance of the resource transfer subject queue are only related to the resource transfer subjects in each block building cycle and the nodes in the block building node state, it can ensure that the nodes in the block building state in each block building cycle are not attacked, improving the security of the blockchain system.
[0141] Figure 12 is a block diagram of a data processing device based on blockchain shown according to an exemplary embodiment. The data processing device based on blockchain can be applied to nodes in the block building state in the current block building cycle in the blockchain system. Refer to Figure 12 As shown in, the data processing device 1200 based on blockchain provided by the embodiments of the present disclosure may include: a previous block acquisition module 1201, a resource transfer information acquisition module 1202, a resource transfer subject queue update module 1203, and a target blockchain establishment module 1204.
[0142] Among them, the previous block acquisition module 1201 may be configured to acquire the previous block generated by the blockchain system in the previous block building cycle, the previous block includes the resource transfer subject queue in the previous block building cycle, and the node in the block building state in the current block building cycle is the head node of the resource transfer subject queue in the previous block building cycle; the resource transfer information acquisition module 1202 may be configured to acquire the resource transfer information of the blockchain system in the current block building cycle, and the resource transfer information corresponds to the resource transfer subjects in the current block building cycle; the resource transfer subject queue update module 1203 may be configured to poll and update the resource transfer subject queue in the previous block building cycle according to the resource transfer subjects in the current block building cycle and the nodes in the block building state in the current block building cycle, and generate the resource transfer subject queue of the current block building cycle, where the head of the resource transfer subject queue of the current block building cycle is the next block building node of the next block building cycle, so as to convert the next block building node from the normal state to the block building state in the next block building cycle; the target blockchain establishment module 1204 may be configured to establish the target block of the current block building cycle, and the target block includes the resource transfer information in the current block building cycle and the resource transfer subject queue in the current block building cycle.
[0143] In some embodiments, the resource transfer subject queue update module 1203 may include: a new resource transfer subject determination unit, a new resource transfer subject insertion unit, a head transfer unit, a next block building node determination unit, and a resource transfer subject queue complete update unit.
[0144] Among them, the new resource transfer subject determination unit may be configured to compare the resource transfer subjects in the current block building cycle with the resource transfer subject queue in the previous block building cycle to determine new resource transfer subjects that did not appear in the resource transfer subject queue in the previous block building cycle; the new resource transfer subject insertion unit may be configured to insert the new resource transfer subjects into the end of the resource transfer subject queue in the previous block building cycle; the head transfer unit may be configured to transfer the nodes in the block building state in the current block building cycle from the head of the resource transfer subject queue in the previous block building cycle to the end; the next block building node determination unit may be configured to determine whether the current head node of the resource transfer subject queue in the previous block building cycle accepts to become the next block building node in the next block building cycle; the resource transfer subject queue complete update unit may be configured to generate the resource transfer subject queue for the current block building cycle if the current head node of the resource transfer subject queue in the previous block building cycle accepts to become the next block building node in the next block building cycle.
[0145] In some embodiments, the resource transfer subject queue update module 1203 may further include: a current head node deletion subunit, a next head node determination unit, and a next block building node determination unit.
[0146] Among them, the current head node deletion subunit may be configured to delete the current head node of the resource transfer subject queue in the previous block building cycle if the current head node of the resource transfer subject queue in the previous block building cycle does not accept to become the next block building node in the next block building cycle; the next head node determination unit may be configured to determine whether the next head node of the resource transfer subject queue in the previous block building cycle accepts to become the block building node in the next block building cycle; the next block building node determination unit may be configured to generate the resource transfer subject queue for the current block building cycle if the next head node of the resource transfer subject queue in the previous block building cycle accepts to become the block building node in the next block building cycle.
[0147] In some embodiments, the new resource transfer subject insertion unit may include: a target transaction amount determination subunit, a transaction amount sorting subunit, and a new resource transfer subject insertion subunit.
[0148] Among them, the target transaction amount determination subunit may be configured to determine the target transaction amount corresponding to each newly added resource transfer entity according to the resource transfer information within the current block building period; the transaction amount sorting subunit may be configured to sort each newly added resource transfer entity according to the target transaction amount; the newly added resource transfer entity insertion subunit may be configured to insert the newly added resource transfer entity into the tail of the resource transfer entity queue in the previous block building period according to the sorting result.
[0149] In some embodiments, the newly added resource transfer entity insertion subunit may also be configured to: insert the newly added resource transfer entities with the top N sorted target transaction amounts into the tail of the resource transfer entity queue in the previous block building period, where N is a positive integer greater than or equal to 1.
[0150] In some embodiments, the resource transfer entity queue update module 1203 may include: a current block building period transaction amount acquisition unit, a transaction amount sorting unit, and an elimination unit.
[0151] Among them, the current block building period transaction amount acquisition unit may be configured to acquire the transaction amounts of each resource transfer entity in the resource transfer entity queue in the current block building period within the current block building period; the transaction amount sorting unit may be configured to sort each resource transfer entity in the resource transfer entity queue in the current block building period according to the transaction amount in the current block building period; the elimination unit may be configured to eliminate the resource transfer entities with transaction amounts less than the target threshold in the resource transfer entity queue in the current block building period.
[0152] In some embodiments, the blockchain-based data processing device may further include: a broadcast module, a state conversion module.
[0153] Among them, the broadcast module may be configured to broadcast the target block to the nodes in the blockchain system in the normal state; the state conversion module may be configured to convert the nodes in the block building state in the current block building period to the normal state at the end of the current block building period.
[0154] Since each functional module of the blockchain-based data processing device 1200 in the exemplary embodiments of the present disclosure corresponds to the steps in the exemplary embodiments of the above-mentioned blockchain-based data processing method, they will not be described in detail here.
[0155] From the description of the above embodiments, those skilled in the art can easily understand that the example embodiments described herein can be implemented by software or by a combination of software and necessary hardware. Therefore, the technical solutions of the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including several instructions for causing a computing device (which can be a personal computer, a server, a mobile terminal, or an intelligent device, etc.) to execute the method according to the embodiments of the present disclosure, such as Figure 5 one or more of the steps shown in
[0156] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the above-mentioned module, program segment, or part of code includes one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order from that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, as well as the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0157] The modules and / or units and / or subunits involved in the embodiments of the present application can be implemented by software or by hardware. The described modules and / or units and / or subunits can also be provided in a processor. For example, it can be described as: a processor includes a sending unit, an obtaining unit, a determining unit, and a first processing unit. Among them, the names of these modules and / or units and / or subunits do not constitute a limitation to the modules and / or units and / or subunits themselves in some cases.
[0158] Figure 13 The structural schematic diagram of an electronic device suitable for implementing the embodiments of the present disclosure is shown. It should be noted that Figure 13 the shown electronic device 1300 is only an example and should not bring any limitation to the functions and usage scope of the embodiments of the present disclosure.
[0159] As Figure 13As shown, the electronic device 1300 includes a central processing unit (CPU) 1301, which can perform various appropriate actions and processes according to a program stored in the read-only memory (ROM) 1302 or a program loaded from the storage section 1308 into the random access memory (RAM) 1303. In the RAM 1303, various programs and data required for the operation of the electronic device 1300 are also stored. The CPU 1301, the ROM 1302, and the RAM 1303 are connected to each other via a bus 1304. An input / output (I / O) interface 1305 is also connected to the bus 1304.
[0160] The following components are connected to the I / O interface 1305: an input section 1306 including a keyboard, a mouse, etc.; an output section 1307 including, for example, a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1308 including a hard disk, etc.; and a communication section 1309 including a network interface card such as a LAN card, a modem, etc. The communication section 1309 performs communication processing via a network such as the Internet. A drive 1310 is also connected to the I / O interface 1305 as needed. A removable medium 1311, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1310 as needed so that a computer program read from it can be installed into the storage section 1308 as needed.
[0161] Specifically, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program includes program codes for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 1309, and / or installed from the removable medium 1311. When the computer program is executed by the central processing unit (CPU) 1301, the above functions defined in the system of the present application are executed.
[0162] It should be noted that the computer-readable storage medium shown in this disclosure can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of a computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this application, a computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable storage medium other than a computer-readable storage medium, and this computer-readable storage medium can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on a computer-readable storage medium can be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0163] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram can represent a module, a program segment, or a part of code, and the above module, program segment, or part of code contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks can occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and the combination of blocks in a block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0164] As another aspect, the present application also provides a computer-readable storage medium, which may be included in the device described in the above embodiments; or may exist separately without being assembled into the device. The above computer-readable storage medium carries one or more programs, and when the one or more programs are executed by a device, the functions that the device can implement include: obtaining the previous block generated by the blockchain system in the previous block building cycle, the previous block including a resource transfer subject queue in the previous block building cycle, and the node in the block building state in the current block building cycle is at the head of the resource transfer subject queue in the previous block building cycle; obtaining the resource transfer information of the blockchain system in the current block building cycle, the resource transfer information corresponding to the resource transfer subject in the current block building cycle; polling and updating the resource transfer subject queue in the previous block building cycle according to the resource transfer subject in the current block building cycle and the node in the block building state in the current block building cycle to generate the resource transfer subject queue in the current block building cycle, wherein the head of the resource transfer subject queue in the current block building cycle is the next block building node in the next block building cycle, so as to convert the next block building node from the normal state to the block building state in the next block building cycle; establishing the target block in the current block building cycle, the target block including the resource transfer information in the current block building cycle and the resource transfer subject queue in the current block building cycle.
[0165] In addition, the above drawings are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, rather than for limiting purposes. It is easy to understand that the processes shown in the above drawings do not indicate or limit the time sequence of these processes. Additionally, it is also easy to understand that these processes may be executed synchronously or asynchronously in, for example, multiple modules.
[0166] Those skilled in the art will readily think of other embodiments of the present disclosure after considering the specification and practicing the disclosure herein. The present disclosure aims to cover any variations, uses, or adaptations of the present disclosure, which follow the general principles of the present disclosure and include the well-known common knowledge or conventional technical means in the technical field not claimed in the present disclosure. The specification and embodiments are only regarded as exemplary, and the true scope and spirit of the present disclosure are pointed out by the claims.
[0167] It should be understood that the present disclosure is not limited to the detailed structures, drawing methods, or implementation methods shown here. On the contrary, the present disclosure intends to cover various modifications and equivalent arrangements included in the spirit and scope of the appended claims.
Claims
1. A data processing method based on blockchain, characterized in that, it is applied to a node in a blockchain system that is in the block-building state during the current block-building cycle, and the method includes: Obtain the previous block generated by the blockchain system in the previous block-building cycle, where the previous block includes a resource transfer subject queue in the previous block-building cycle, and the node in the block-building state during the current block-building cycle is at the head of the resource transfer subject queue in the previous block-building cycle; Obtain the resource transfer information of the blockchain system in the current block-building cycle, where the resource transfer information corresponds to the resource transfer subject in the current block-building cycle; Poll and update the resource transfer subject queue in the previous block-building cycle according to the resource transfer subject in the current block-building cycle and the node in the block-building state during the current block-building cycle to generate the resource transfer subject queue in the current block-building cycle, where the head of the resource transfer subject queue in the current block-building cycle is the next block-building node in the next block-building cycle, so as to convert the next block-building node from the normal state to the block-building state in the next block-building cycle; Establish the target block in the current block-building cycle, where the target block includes the resource transfer information in the current block-building cycle and the resource transfer subject queue in the current block-building cycle.
2. The method according to claim 1, characterized in that, polling and updating the resource transfer subject queue in the previous block-building cycle according to the resource transfer subject in the current block-building cycle and the node in the block-building state during the current block-building cycle to generate the resource transfer subject queue in the current block-building cycle includes: Compare the resource transfer subject in the current block-building cycle with the resource transfer subject queue in the previous block-building cycle to determine the newly added resource transfer subjects that did not appear in the resource transfer subject queue in the previous block-building cycle; Insert the newly added resource transfer subjects into the end of the resource transfer subject queue in the previous block-building cycle; Transfer the node in the block-building state during the current block-building cycle from the head of the resource transfer subject queue in the previous block-building cycle to the end; Determine whether the current head node of the resource transfer subject queue in the previous block-building cycle accepts to become the next block-building node in the next block-building cycle; If the current head node of the resource transfer subject queue in the previous block-building cycle accepts to become the next block-building node in the next block-building cycle, then generate the resource transfer subject queue in the current block-building cycle.
3. The method according to claim 2, characterized in that, it further includes: If the current head node of the resource transfer subject queue in the previous block-building cycle does not accept to become the next block-building node in the next block-building cycle, then delete the current head node of the resource transfer subject queue in the previous block-building cycle; Determine whether the next head node of the resource transfer subject queue in the previous block-building cycle accepts to become the block-building node in the next block-building cycle; If the next head node of the resource transfer entity queue in the previous block building period accepts to become the block building node in the next block building period, then generate the resource transfer entity queue for the current block building period.
4. The method according to claim 2, wherein, Inserting the newly added resource transfer entity into the tail of the resource transfer entity queue in the previous block building period includes: Determining the target transaction amount corresponding to each newly added resource transfer entity according to the resource transfer information in the current block building period; Sorting each newly added resource transfer entity according to the target transaction amount; Inserting the newly added resource transfer entity into the tail of the resource transfer entity queue in the previous block building period according to the sorting result.
5. The method according to claim 4, wherein, Inserting the newly added resource transfer entity into the tail of the resource transfer entity queue in the previous block building period according to the sorting result includes: Inserting the newly added resource transfer entities with the top N target transaction amounts in the sorting result into the tail of the resource transfer entity queue in the previous block building period, where N is a positive integer greater than or equal to 1.
6. The method according to claim 1, wherein, Polling and updating the resource transfer entity queue in the previous block building period according to the resource transfer entities in the current block building period and the nodes in the block building state in the current block building period to generate the resource transfer entity queue for the current block building period includes: Obtaining the transaction amounts of each resource transfer entity in the resource transfer entity queue for the current block building period in the current block building period; Sorting each resource transfer entity in the resource transfer entity queue for the current block building period according to the transaction amount in the current block building period; Removing the resource transfer entities with transaction amounts less than the target threshold in the current block building period from the resource transfer entity queue for the current block building period.
7. The method according to claim 1, wherein, After establishing the target block for the current block building period, further includes: Broadcasting the target block to the nodes in the normal state in the blockchain system; At the end of the current block building period, converting the nodes in the block building state in the current block building period to the normal state.
8. A blockchain system, wherein, The blockchain system includes: Nodes in the normal state, which broadcast resource transfer information as resource transfer entities in the current block building period; A node in the block building state is used to obtain the previous block generated by the blockchain system in the previous block building cycle. The previous block includes the resource transfer subject queue in the previous block building cycle. The node in the block building state in the current block building cycle is at the head of the resource transfer subject queue in the previous block building cycle; obtain the resource transfer information of the blockchain system in the current block building cycle, where the resource transfer information includes the resource transfer subjects in the current block building cycle; poll and update the resource transfer subject queue in the previous block building cycle according to the resource transfer subjects in the current block building cycle and the node in the block building state in the current block building cycle to generate the resource transfer subject queue in the current block building cycle, where the head of the resource transfer subject queue in the current block building cycle is the next block building node in the next block building cycle, so as to convert the next block building node from the normal state to the block building state in the next block building cycle; establish the target block of the current block building cycle, where the target block includes the resource transfer information in the current block building cycle and the resource transfer subject queue in the current block building cycle; at the end of the current block building cycle, convert the state of the block building node from the block building state to the normal state; The node in the normal state is further used to receive and record the target block established in the current block building cycle, and when the node in the normal state is at the head of the resource transfer subject queue in the target block, at the beginning of the next block building cycle, convert the state of the node in the normal state to the block building state.
9. A data processing device based on blockchain Characterized in that Applied to a node in the block building state in the current block building cycle in the blockchain system, the device includes: A previous block acquisition module configured to obtain the previous block generated by the blockchain system in the previous block building cycle. The previous block includes the resource transfer subject queue in the previous block building cycle. The node in the block building state in the current block building cycle is the head node of the resource transfer subject queue in the previous block building cycle; A resource transfer information acquisition module configured to obtain the resource transfer information of the blockchain system in the current block building cycle, where the resource transfer information corresponds to the resource transfer subjects in the current block building cycle; A resource transfer subject queue update module configured to poll and update the resource transfer subject queue in the previous block building cycle according to the resource transfer subjects in the current block building cycle and the node in the block building state in the current block building cycle to generate the resource transfer subject queue in the current block building cycle, where the head of the resource transfer subject queue in the current block building cycle is the next block building node in the next block building cycle, so as to convert the next block building node from the normal state to the block building state in the next block building cycle; A target blockchain establishment module, configured to establish a target block for the current block building cycle, where the target block includes resource transfer information within the current block building cycle and a resource transfer subject queue within the current block building cycle.
10. An electronic device, characterized in that, it includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enabling the one or more processors to implement the method according to any one of claims 1-7.
11. A computer-readable storage medium, on which a computer program is stored, characterized in that, when the program is executed by a processor, it implements the method according to any one of claims 1-7.
12. A computer program product, which includes computer instructions that implement the method according to any one of claims 1-7 when the computer instructions are executed.
Citation Information
Patent Citations
Block chain transaction processing method, device, computer equipment and storage medium
CN110781196A
Data processing method, system and device based on block chain and storage medium
CN111612445A