Block data processing method
By limiting the consumption amount of state slots and the incentive mechanism during block generation, the problem of rapid consumption of blockchain node resources is solved, and the effect of reducing data expansion rate and deployment costs is achieved.
Patent Information
- Application Number
- CN202410254842.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-05
- Publication Date
- 2025-09-05
AI Technical Summary
The resource consumption of blockchain nodes increases when generating blocks, affecting processing performance and deployment costs.
By limiting the consumption of state slots during block generation, resource consumption is controlled, and the data expansion rate is slowed down by releasing state slots through an incentive mechanism.
Reduce the data processing pressure and deployment costs of blockchain nodes, and improve node performance stability and efficiency.
Smart Images

Figure CN120602349A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of blockchain technology, and in particular to a block data processing method. Background Art
[0002] In the blockchain field, when blockchain nodes execute smart contracts to generate blocks, they typically consume node resources to calculate and store state data related to those blocks. The continuous generation of blocks leads to an increasing consumption of node resources, which seriously impacts the processing performance and deployment costs of blockchain nodes. Therefore, improving the performance of blockchain nodes when generating blocks and reducing their deployment costs have become hot research topics in the blockchain field. Summary of the Invention
[0003] The embodiments of the present application provide a block data processing method, which can improve the performance of blockchain nodes in generating blocks and reduce the deployment cost of blockchain nodes.
[0004] On the one hand, an embodiment of the present application provides a block data processing method, including:
[0005] Obtaining a consumption quota of a state slot by a target block, where the target block is generated based on one or more block transactions;
[0006] In the process of packaging the block transactions corresponding to the target block, detecting the actual consumption quantity of the state slots by the target block;
[0007] A packaging strategy is determined according to the actual consumption quantity and the consumption quota, and the block transactions to be packaged in the one or more block transactions are packaged according to the packaging strategy to generate the target block.
[0008] By setting a limit on the consumption of state slots during block generation, the embodiments of the present application can limit the amount of storage resources required by blockchain nodes when generating a block, allowing for more free resources within the blockchain nodes. This can reduce the data processing pressure on the blockchain nodes and, to a certain extent, improve the efficiency of subsequent block generation. Furthermore, by limiting the amount of storage resources consumed when generating each block, the amount of resources required by blockchain nodes to store the blockchain can be kept within a smaller range, thereby reducing the deployment cost of blockchain nodes.
[0009] On the other hand, the embodiment of the present application further provides another block data processing method, including:
[0010] In response to a block generation instruction for a target block, obtaining one or more block transactions for generating the target block, wherein one block transaction is generated in response to a transaction request of one blockchain account;
[0011] In the process of packaging each block transaction, detecting the number of released state slots of each block transaction;
[0012] According to the release quantity corresponding to each block transaction, a reference quantity of virtual resources is transferred to the virtual resource pool associated with the blockchain account corresponding to each block transaction.
[0013] The embodiment of the present application rewards the blockchain account that generates the block transaction based on the number of slot releases corresponding to the block transaction, so that there will be more blockchain accounts in the blockchain network willing to trigger the block transaction that can release the state slot. Releasing the state slot means deleting the corresponding key-value pairs stored in the blockchain network, thereby reducing the amount of storage resources required to allocate to the blockchain node when generating the target block, thereby slowing down the expansion of the data volume in the blockchain node and effectively reducing the deployment cost of the blockchain node.
[0014] In another aspect, an embodiment of the present application provides a block data processing device, comprising:
[0015] An acquisition unit, configured to acquire a consumption quota of a target block for a state slot, wherein the target block is generated based on one or more block transactions;
[0016] A detection unit, configured to detect the actual amount of state slots consumed by the target block during the process of packaging the block transactions corresponding to the target block;
[0017] A packaging unit is configured to determine a packaging strategy according to the actual consumption quantity and the consumption quota, and to package the block transactions to be packaged in the one or more block transactions according to the packaging strategy to generate the target block.
[0018] On the other hand, an embodiment of the present application provides another block data processing device, including:
[0019] an instruction response unit, configured to, in response to a block generation instruction for a target block, obtain one or more block transactions for generating the target block, wherein a block transaction is generated in response to a transaction request of a blockchain account;
[0020] A packaging detection unit, configured to detect the number of released state slots of each block transaction during the process of packaging each block transaction;
[0021] The resource reward unit is used to transfer a reference amount of virtual resources to the virtual resource pool associated with the blockchain account corresponding to each block transaction based on the release amount corresponding to each block transaction.
[0022] In another aspect, an embodiment of the present application provides a computer device, including:
[0023] a processor adapted to execute one or more computer programs;
[0024] A computer storage medium storing one or more computer programs, wherein the one or more computer programs are suitable for being loaded by the processor and executing the block data processing method proposed in the first aspect or the second aspect.
[0025] On the other hand, an embodiment of the present application proposes a computer storage medium, which stores one or more computer programs, and the one or more computer programs are suitable for being loaded by a processor and executing the block data processing method proposed in the first aspect or the second aspect.
[0026] On the other hand, an embodiment of the present application further provides a program product, which includes a computer program, and the computer program is suitable for being loaded by a processor and executing the block data processing method proposed in the first aspect or the second aspect.
[0027] The block data processing method proposed in this application can limit the amount of storage resources required by blockchain nodes when generating blocks by setting a consumption limit for state slots during block generation, thereby slowing down the data expansion rate and resource consumption rate in the blockchain network, and effectively reducing the deployment cost of blockchain nodes. Alternatively, by rewarding blockchain accounts that generate block transactions based on the number of slots released by block transactions, more blockchain accounts in the blockchain network will be willing to trigger block transactions that can release state slots, thereby saving the amount of storage resources consumed by blockchain nodes from the perspective of transaction packaging, thereby slowing down the expansion of data in blockchain nodes and effectively reducing the deployment cost of blockchain nodes. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0029] Figure 1a This is a schematic diagram of the structure of a blockchain provided by an embodiment of the present application;
[0030] Figure 1b This is a schematic diagram of the structure of a blockchain network provided by an embodiment of the present application;
[0031] Figure 2 is a schematic flow chart of a block data processing method provided in an embodiment of the present application;
[0032] Figure 3 is a schematic flow chart of another block data processing method provided in an embodiment of the present application;
[0033] Figure 4a This is a schematic diagram of the principle of determining the parent block's remaining amount provided by an embodiment of the present application;
[0034] Figure 4b This is a schematic diagram of the principle of determining a consumption quota provided by an embodiment of the present application;
[0035] Figure 5 This is a schematic diagram of an implementation process of block generation provided by an embodiment of the present application;
[0036] Figure 6 This is a schematic diagram of a consumption quota statistical principle provided by an embodiment of the present application;
[0037] Figure 7 is a schematic flow chart of another block data processing method provided in an embodiment of the present application;
[0038] Figure 8 This is a schematic structural diagram of a block data processing device provided in an embodiment of the present application;
[0039] Figure 9 This is a structural diagram of another block data processing device provided in an embodiment of the present application;
[0040] Figure 10 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0041] It should be noted in advance that, in order to enable those skilled in the art to better understand the technical solutions proposed in the embodiments of this application, the embodiments of this application will be combined with one or more figures to clearly and completely describe the implementation of the technical solutions proposed in the embodiments of this application. In addition, the various figures shown in the embodiments of this application are only exemplary. For example, the execution order of the various steps in the figures can be adaptively adjusted according to the actual application scenario.
[0042] In addition, in the embodiments of the present application, the block diagrams, modules and units shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities, and each module or unit can be part of an overall module or unit that includes the function of the module or unit. That is, the term "module" or "unit" mentioned in the embodiments of the present application refers to a computer program or a part of a computer program with a predetermined function, which can work together with other related parts to achieve a predetermined goal, and can also be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof, or implemented in different networks and / or processor devices and / or microcontroller devices. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units.
[0043] Specifically, the embodiments of this application primarily combine blockchain technology with computer technology to propose a block data processing solution. This solution can control the amount of resources consumed by the blockchain when generating each block, thereby slowing the resource consumption rate of blockchain nodes and reducing the deployment cost of blockchain nodes. The principle of this solution is: during the process of a blockchain node generating a target block, the number of state slots that the blockchain node can consume is limited. Then, based on whether the number of state slots actually consumed reaches a preset limit, a packaging strategy is determined. The block transactions to be packaged are packaged according to this packaging strategy to generate the target block.
[0044] Among them, the state slot can be understood as a modular storage resource in the blockchain node, which is mainly used to insert (or store) the resource data corresponding to the blockchain account into a certain storage location in the form of key-value pairs (i.e., key-value). In this way, a larger storage space can be divided into blocks by dividing the state slots. In general, a state slot is used to store a key-value pair. In other words, a state slot is used to indicate a blockchain account and its corresponding resource data. Therefore, it is not difficult to understand that by applying state slots in blockchain nodes, the resource data between different blockchain accounts can be effectively isolated, thereby improving the efficiency of data processing (such as reading, updating, etc.).
[0045] Based on this, it can be understood that if the number of occupied state slots in a blockchain node increases, it indicates that the amount of data stored in the blockchain node has increased, and the consumption of data storage resources of the blockchain node has increased, which increases the data processing pressure of the blockchain node and is not conducive to node deployment and data processing. However, the embodiment of the present application can slow down the expansion rate of the data stored in the blockchain node by limiting the number of state slots that can be consumed by the block during the block generation process, thereby effectively reducing the data processing pressure and deployment cost of the blockchain node. And under normal circumstances, when a blockchain node has more free resources, its data processing performance can be improved to a certain extent, so that the generation efficiency of each subsequent block can also be guaranteed to a certain extent.
[0046] In other words, the adoption of the above technical solution can effectively control the resource consumption of blockchain nodes during the block generation process, thereby effectively reducing the data storage burden and deployment cost of blockchain nodes, and to a certain extent improving the data processing efficiency of blockchain nodes.
[0047] In a specific implementation method, considering that in the actual application scenarios of blockchain, there may be a situation where multiple blockchain accounts are opened for the same object, but not every blockchain account is actually used, and if the blockchain account is not cancelled, the blockchain node still needs to provide a status slot to store resource data for the object, which causes a waste of resources of the blockchain node.
[0048] Therefore, in order to motivate each object to cancel such blockchain accounts and thus release the corresponding state slots, the embodiment of the present application also proposes an incentive mechanism. The principle of this incentive mechanism is: during the block generation process, the number of state slots released by the execution of each block transaction is detected, and in the subsequent block generation process, a certain amount of virtual resources is transferred to the virtual resource pool corresponding to the blockchain account based on this number.
[0049] The virtual resource pools corresponding to the various blockchain accounts of the same object can be the same, or the virtual resource pools corresponding to the various blockchain accounts can be linked. This allows for the virtual resources to be transferred to other virtual resource pools of the object when the blockchain account to be rewarded is cancelled. This effectively incentivizes each object to release its non-essential state slots, thereby allowing for more node resources to be reused. Combining this incentive mechanism with the aforementioned technical solution can further reduce the resource consumption rate and data expansion rate in blockchain nodes on the basis of the aforementioned technical solution.
[0050] The various technical implementation methods of the embodiments of this application will be elaborated in detail later. In order to facilitate a clear understanding of the relevant technical principles and technical effects, the following is a brief explanation of the various blockchain technology concepts used in this application.
[0051] 1. Blockchain Technology
[0052] Blockchain technology is an emerging field, an interdisciplinary field involving cryptography, game theory, and numerology. Blockchain technology primarily utilizes a blockchain (a chained data structure based on blocks) to store data, a consensus algorithm to ensure data consistency, and cryptography to ensure data security. Specifically, the blockchain in the embodiments of this application can be understood as a database shared, replicated, and synchronized between blockchain nodes, characterized by decentralization, information transparency, and immutability.
[0053] As an example, the structure of a blockchain can be seen in Figure 1a .Depend on Figure 1a It can be seen that the blockchain consists of a series of blocks (data blocks) that are connected to each other in the order of their generation. The blocks record the record data submitted by the blockchain nodes in the blockchain network (or blockchain system) (specifically including the packaged records of block transactions). Once a newly generated block is added to the blockchain, it will not be removed.
[0054] A block can be understood as a series of text records whose contents are connected and protected by cryptography. In practical applications, each block in the blockchain contains a cryptographic hash of the previous block, a corresponding timestamp, and transaction data. For example, transaction data is typically represented by a hash value calculated using a Merkle tree algorithm. This design makes the block content difficult to tamper with. In the embodiments of this application, the transaction data includes historical business data and insurance business data.
[0055] 2. Blockchain Nodes
[0056] Blockchain nodes are primarily used to generate blocks and store blockchains. Blockchain nodes can also perform multiple functions, including routing and application functions. Routing is a key, fundamental function of blockchain nodes, primarily supporting communication between them. Application functions (such as resource exchange in the financial sector) can be deployed within blockchain nodes to implement specific services based on actual business needs.
[0057] It's worth noting that, during the process of blockchain nodes implementing related services based on application functions, the application functions can also be used to record data related to the implementation of the function, and the recorded data carries a digital signature to indicate the source of the recorded data. Furthermore, blockchain nodes have a unique node identifier and can store the node identifiers of other blockchain nodes in the blockchain network where the blockchain node resides, so that relevant data (such as generated blocks) can be subsequently broadcast to other blockchain nodes in the blockchain network based on the node identifiers of other blockchain nodes.
[0058] The node identifier can be an IP (Internet Protocol) address or other information that can be used to uniquely identify a blockchain node. In practical applications, each blockchain node can maintain a node identifier list as shown in Table 1, which associates and stores the node name and node identifier of each blockchain node (Table 1 only uses IP addresses as an example).
[0059] Table 1
[0060] Node Name Node ID Node 1 117.114.151.XX Node 2 117.XX.XXX.XX … … Node N xx.xx.xx.xx
[0061] 3. Blockchain Network
[0062] Multiple intercommunication blockchain nodes can form a blockchain network, allowing data to be transmitted between nodes within the same blockchain network through communication connections. In other words, a blockchain network can essentially be understood as a data sharing system, with blockchain nodes representing nodes within the data sharing system. Alternatively, a node within a data sharing system can specifically refer to a client, application, or electronic device within the data sharing system. During normal operation, each node can receive input information and, based on the received input information, maintain shared data within the data sharing system.
[0063] For example, the structure of the blockchain network can be seen in Figure 1b .like Figure 1b As shown, the blockchain network is composed of multiple blockchain nodes, such as blockchain node 111, blockchain node 112, and blockchain node 113. In the actual application of the embodiments of the present application, the accounting rights of different blocks can be held by different blockchain nodes. The so-called accounting rights refer to the right to select individual block transactions used to generate blocks from the block transaction pool and package them into blocks for on-chain storage.
[0064] For example, suppose that when generating the i-th block, blockchain node 111 is used as a bookkeeping node. Then, blockchain nodes 112 and 113 in the blockchain network are all used as non-bookkeeping nodes. After generating the i-th block, the bookkeeping node will broadcast the i-th block to all non-bookkeeping nodes for legitimacy verification. If the legitimacy verification passes, the block is added to the chain (i.e., the block is added to the original blockchain to form a new blockchain). If the legitimacy verification fails, the block is discarded (i.e., the original blockchain remains unchanged).
[0065] Furthermore, blockchain nodes in a blockchain network can be categorized as light nodes and full nodes. Full nodes synchronize all blockchain data. Using full nodes in a blockchain network allows relevant parties to access comprehensive blockchain data from any node, improving data acquisition efficiency. Light nodes store only the data relevant to them. Using light nodes can reduce the data storage pressure on some nodes, thereby reducing the difficulty and cost of building a blockchain network.
[0066] It should also be noted that a blockchain node can be a terminal device or a server. When a blockchain node is a terminal device, the available terminal devices include, but are not limited to, smartphones, tablets, laptops, desktop computers, in-vehicle terminals, and smart TVs. Furthermore, the terminal device must at least run a blockchain client, allowing it to function as a blockchain node when the blockchain client is running. Alternatively, the terminal device can also run a variety of clients or applications (APPs), such as multimedia playback clients, social media clients, browser clients, information streaming clients, and image processing clients.
[0067] When the blockchain node is a server, the optional servers may include but are not limited to independent physical servers, server clusters or distributed systems composed of multiple physical servers, and cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms, etc. The embodiments of the present application do not impose specific restrictions on this.
[0068] See Figure 2 , Figure 2 The following is a schematic flow chart of a block data processing method based on the above technical solution, which can be executed by the above-mentioned blockchain node. Figure 2As shown, the method mainly includes steps S201-S204:
[0069] S201. Obtain the consumption amount of the target block for the state slot, where the target block is generated based on one or more block transactions.
[0070] Block transactions are primarily used to record resource exchange information between at least two blockchain accounts, and are generated in response to a resource exchange request from one of the blockchain accounts. Furthermore, a block is essentially a packaged record of one or more block transactions. The packaging of block transactions can be understood as the process of performing resource exchange according to the resource exchange information recorded in the block transaction and recording the resource data (or resource information) of each corresponding blockchain account after the resource exchange. In this case, for example, the packaged record may include the resource exchange records of each blockchain account and the resource information after the resource exchange.
[0071] Based on the above description, it can be understood that the target block contains a packaged record of the transactions in each block used to generate the target block. In practical applications, the target block refers to the block that currently needs to be generated, and the blockchain node used to generate the target block can be referred to as the target block's accounting node. For ease of explanation, the accounting node of the target block will be referred to as the accounting node. The maximum number of state slots that the accounting node can occupy when generating the target block is referred to as the target block's state slot consumption quota.
[0072] In one implementation, the consumption limit can be a fixed value preset based on block generation requirements. In this case, any blockchain node in the blockchain network is subject to the same consumption limit when generating blocks.
[0073] In another implementation, the consumption quota can also be determined based on node performance parameters of one or more blockchain nodes. In this case, the consumption quota can be positively correlated with the performance indicated by the node performance parameters. In other words, the higher the performance indicated by the node performance parameters, the higher the consumption quota can be.
[0074] In other implementations, the consumption limit can also be set based on the consumption of state slots (such as the amount consumed and released) by the target block's parent block during its generation. Consuming a state slot can be understood as creating a new key-value pair for a blockchain account. The key (i.e., key) is used to identify the blockchain account, specifically, the blockchain address of the blockchain account. The value (i.e., value) is used to indicate the resource data associated with the blockchain account, specifically, the amount of virtual resources held by the blockchain account.
[0075] Correspondingly, releasing a state slot can be understood as deleting a key-value pair of a blockchain account. For example, during the process of packaging a block transaction, the accounting node can delete the key-value pair corresponding to a blockchain account with a virtual resource of 0 (i.e., a value of 0), thereby freeing up the state slot occupied by the blockchain account.
[0076] That is to say, in the embodiment of the present application, the relationship between the state slot, the key-value pair, the blockchain account, and the blockchain usage object can be expressed as follows: one state slot corresponds to one key-value pair, and one blockchain account corresponds to one state slot, but one blockchain usage object can correspond to opening multiple blockchain accounts.
[0077] S202: In the process of packaging the block transactions corresponding to the target block, the actual consumption quantity of the state slots by the target block is detected.
[0078] Among them, when determining the actual consumption quantity of the target block for the state slot, the accounting node can first detect the consumption quantity and release quantity of each block transaction for the state slot during the packaging process of each block transaction corresponding to the target block, and then determine the actual consumption quantity corresponding to each block transaction based on the difference between the consumption quantity and the release quantity corresponding to each block transaction, and then use the sum of the actual consumption quantities corresponding to each block transaction as the actual consumption quantity of the target block for the state slot.
[0079] As an example, when the difference corresponding to the block transaction is a positive number, the actual consumption quantity corresponding to the block transaction can be positively correlated with the corresponding difference, and when the difference corresponding to the block transaction is a non-positive number (such as a negative number or 0), the actual consumption quantity corresponding to the block transaction can be determined to be 0.
[0080] That is, when the number of state slots required to be released for the packaging of a block transaction (referred to as the slot release quantity) is greater than the number of state slots required to be consumed (referred to as the slot consumption quantity), it can be considered that there is no actual consumption of state slots in the packaging process of the block transaction. When the slot release quantity is less than the slot consumption quantity, it can be considered that there is actual consumption of state slots in the packaging process. In this case, the difference between the slot consumption quantity and the slot release quantity can be used as the actual consumption of state slots when packaging the block transaction.
[0081] For example, let's assume there's a block transaction triggered by blockchain account 1, indicating the transfer of x virtual resources from blockchain account 1 to blockchain account 2, and y virtual resources to blockchain account 3. In this example, let's further assume that blockchain account 1 and blockchain account 2 already exist in the blockchain network, but blockchain account 3 doesn't. In this case, the accounting node might package this block transaction as follows:
[0082] When executing a resource transfer associated with blockchain account 2, the accounting node first checks whether blockchain account 2 exists. If blockchain account 2 already exists, the value corresponding to the state slot associated with blockchain account 2 is increased by x, and the value corresponding to the state slot associated with blockchain account 1 is decreased by x, thereby implementing the resource transfer between blockchain accounts 1 and 2.
[0083] Similarly, when transferring resources associated with blockchain account 3, the system first checks whether blockchain account 3 exists. If not, a new key-value pair is created and a state slot is constructed to store it. This state slot is then used to transfer resources between blockchain accounts 1 and 3. The newly created key identifies blockchain account 3, and the value indicates the amount of virtual resources held by blockchain account 3. As can be seen, after the resource transfer, the value associated with blockchain account 3 is y, while the value associated with blockchain account 1 decreases by y.
[0084] In this case, if blockchain account 1's own virtual resource quantity is 0 after transferring virtual resources to blockchain account 2 and blockchain account 3, the key-value pair corresponding to blockchain account 1 will be deleted, freeing up the state slot used to store the key-value pair. Therefore, in this example, since a state slot was created for blockchain account 3 during the execution of the block transaction, it can be considered that the execution of this block transaction consumed 1 state slot. At the same time, since 1 state slot was freed up by deleting the key-value pair corresponding to blockchain account 1 during the block transaction, the actual consumption quantity corresponding to this block transaction is 0.
[0085] S203: Determine a packaging strategy based on the actual consumption quantity and the consumption quota, and package the block transactions to be packaged in one or more block transactions according to the packaging strategy to generate a target block.
[0086] In one embodiment, when the number of consumed state slots equals the consumed quota, a first packaging strategy can be used to package pending block transactions. The pending block transactions can refer to unpackaged block transactions in one or more block transactions corresponding to the target block, or unpackaged block transactions in the block transaction pool. The block transaction pool contains multiple block transactions, and each block transaction used to generate the target block is selected from the block transaction pool by the accounting node.
[0087] Furthermore, the first packaging strategy is used to indicate that the actual number of state slots consumed by the target block should remain unchanged during the packaging process. That is, when using the first packaging strategy to package block transactions, the number of state slots to be released must be greater than or equal to the number of occupied (or consumed) state slots. Specifically, the accounting node can select block transactions that do not consume state slots from the block transactions to be packaged for packaging.
[0088] Among them, block transactions that do not consume state slots may include one or both of the following:
[0089] (1) Implementing packaged block transactions based on consumed state slots. For example, when both blockchain account 1 and blockchain account 2 correspond to state slots, if block transaction a is used to indicate the execution of resource exchange between blockchain account 1 and blockchain account 2, then block transaction a can be used as the block transaction adopted when the first packaging strategy is executed, and then block transaction a can be packaged.
[0090] (2) Implement block transactions that release a greater number of state slots than or equal to the number of occupied state slots during packaging. For example, if block transaction b consumes 4 state slots and releases 5 state slots during packaging, then block transaction b can be treated as a block transaction that does not consume state slots.
[0091] By selecting block transactions without consumption slots for packaging, on the one hand, when the actual consumption of the target block on the status slot reaches the consumption quota, the generation of the target block can continue, thereby effectively ensuring the block data processing capacity of the blockchain node. On the other hand, it can avoid the increase in the actual consumption of the status slot by the target block, thereby effectively controlling the consumption of node resources in the block generation process and slowing down the data expansion rate in the block generation process, thereby ensuring the performance stability of the blockchain node to a certain extent.
[0092] In another embodiment, when the actual consumption amount is less than the consumption quota, the accounting node may use a second packaging strategy to package the block transactions to be packaged. The second packaging strategy refers to a packaging method that allows the target block to increase the actual consumption of state slots according to the packaging requirements during the packaging process. In other words, when using the second packaging strategy, the accounting node can freely select block transactions to package without considering the consumption and release of state slots when packaging the block transactions.
[0093] In the embodiments of the present application, when generating a target block, the number of state slots that can be consumed by the generation process is limited. This can slow the expansion rate of data stored by blockchain nodes and effectively reduce the data processing pressure and deployment costs of blockchain nodes. In addition, by selectively packaging block transactions without consuming state slots when the actual number of state slots consumed reaches the limit, it can ensure that the blockchain node still has good block data processing capabilities within the limit of state slot consumption, thereby improving the performance stability of the blockchain node.
[0094] based on Figure 2 The method shown in the embodiment of the present application further proposes another block data processing method, which can still be executed by the accounting node mentioned above. Figure 3 , Figure 3 A schematic flow chart of the method is shown in FIG. Figure 3 As shown, the method may include steps S301-S305:
[0095] S301. During the generation process of the parent block of the target block, the total number of state slots released and consumed by the parent block is counted.
[0096] In a specific embodiment, the generation principle of the target block's parent block is the same as that of the target block. In other words, the number of state slots that can be consumed by the parent block is still limited during its generation process.
[0097] The total number of state slots released by a parent block refers to the sum of the number of state slots released when the transactions in each block corresponding to the parent block are packaged. Similarly, the total number of state slots consumed by a parent block can be understood and will not be further elaborated here. Furthermore, the total number of released and consumed state slots corresponding to a parent block can be calculated using the principles previously described for the target block and will not be further elaborated here.
[0098] S302: Determine the consumption amount of the target block for the status slot based on the difference between the total released amount and the total consumed amount.
[0099] In a specific embodiment, the accounting node can determine the consumption amount corresponding to the target block according to the principle that the quantity difference is positively correlated with the consumption amount. Correspondingly, in the process of generating the target block, the consumption amount of the target block's child blocks for the state slot can also be determined based on the quantity difference corresponding to the target block according to the same principle. The following only takes the parent block and the target block as an example, and combines Figure 4a and Figure 4b The principle shown is explained schematically.
[0100] In one possible implementation, Figure 4a As shown, the accounting node can first determine the parent block legacy amount corresponding to the target block based on the difference between the total amount released and the total amount consumed. For example, when the difference is a non-positive number, the parent block legacy amount can be set to 0, and when the difference is a positive number, the parent block legacy amount can be positively correlated with the difference, and specifically can be the same as the difference. After determining the parent block legacy amount, as shown in FIG. Figure 4b As shown, a weighted sum operation can be performed on the parent block's legacy quota and the preset new quota, and according to the principle that the operation result is positively correlated with the consumption quota, the consumption quota of the target block for the state slot is determined based on the operation result.
[0101] The weights of the parent block's legacy quota and the preset additional quota can be the same or different, and there are no restrictions here. Furthermore, when the weighted calculation result is non-integer, the accounting node can round the result and use the rounded value as the consumption quota. In actual applications, to minimize the occurrence of non-integer values when calculating the consumption quota, the accounting node can also directly use the sum of the parent block's legacy quota and the preset additional quota as the consumption quota, and there are no restrictions here.
[0102] S303: Obtain the consumption amount of the target block for the state slot, where the target block is generated based on one or more block transactions.
[0103] In a specific embodiment, other implementations related to step S303 can refer to the description of step S201 above and will not be repeated here. However, it should be noted that in the embodiment of the present application, each block transaction corresponding to the target block is generated in response to a transaction request from a blockchain account, and each block transaction corresponds to one blockchain account.
[0104] S304: In the process of packaging the block transactions corresponding to the target block, the actual consumption quantity of the status slots by the target block is detected.
[0105] The method for determining the actual number of status slots consumed by the target block can refer to the relevant embodiments of the aforementioned step S202 and will not be repeated here.
[0106] It should be noted that, in one implementation, when the actual consumption amount is greater than a preset threshold and less than the consumption quota, the accounting node can detect the number of state slots consumed and released during the packaging process of a block transaction. The preset threshold can be the parent block's remaining quota mentioned in step S302.
[0107] When the consumed quantity is greater than the released quantity, the accounting node can use the blockchain account corresponding to the block transaction as the first account, and select the target second account corresponding to the first account from one or more second accounts, and then transfer the target amount of virtual resources in the virtual resource pool corresponding to the first account to the virtual resource pool corresponding to the target second account, thereby encouraging more blockchain accounts to actively release status slots.
[0108] The first account refers to the blockchain account that needs to provide certain virtual resources to consume state slots during the packaging process of the corresponding block transactions, thereby completing the packaging of the block transactions. Correspondingly, the second account refers to the blockchain account that can obtain the virtual resources provided by the first account. In specific implementations, the second account primarily refers to blockchain users that released a positive number of state slots during the generation of historical blocks prior to the target block (such as the target block's parent block, the parent block of the parent block, etc.), and / or various blockchain accounts that released a greater number of state slots than they consumed.
[0109] Additionally, the target second account refers to a second account used to receive virtual resources provided by the current first account. The specific amount of virtual resources received may be a target amount. The target amount may be determined based on the amount of reward resources allocated by the current first account in the corresponding block transaction. For example, the target amount may be determined based on the aforementioned reward resource amount and the number of slots currently pending for reward for the target second account, and the target amount and the number of slots may be positively correlated.
[0110] For example, assuming that the number of state slots actually consumed when packaging the block transaction corresponding to the current first account is N (N is a positive integer), the accounting node can divide the reward resource amount into N resource portions, and determine the number of portions that can be obtained according to the number of slots to be rewarded associated with the target second account, thereby obtaining the target quantity corresponding to the target second account (i.e., target quantity = number of portions * resource quantity per portion). It is understandable that the number of slots to be rewarded associated with the target second account needs to be less than or equal to the number of state slots released by the target second account (or, less than or equal to the difference between the released number and the consumed number). And in actual applications, the number of target second accounts can be multiple.
[0111] In one feasible implementation, the target second account is selected based on the order in which the second accounts are ranked. This order can specifically be the order in which the second accounts released their state slots in historical blocks. In other words, the second account that released its state slot first will be selected as the target second account to receive the rewarded virtual resources.
[0112] For ease of understanding, the following detailed explanation of how the target second account is selected is provided with a specific example. In this example, it is assumed that the historical blocks prior to the target block only contain the target block's parent block. Furthermore, it is assumed that blockchain account 1 and blockchain account 2, which were used during the generation of the target block's parent block, are used as second accounts, and that blockchain account 1 releases state slots before blockchain account 2. Furthermore, it is assumed that blockchain account 1 has two state slots to be awarded, and blockchain account 2 has three state slots to be awarded.
[0113] The number of state slots to be rewarded refers to the number of state slots that have not been used to reward virtual resources among the actually released state slots, and the actually released state slots refers to the difference between the total number of state slots released and the total number of state slots consumed during the generation of the parent block.
[0114] In this case, when the actual consumption of the target block for the state slot is greater than the preset threshold and less than the consumption quota, if block transaction a is a block transaction willing to provide virtual resources, and the accounting node detects that the consumption of the state slot by the packaging of block transaction a is 7, and the release of the state slot is 4, then the accounting node can use the blockchain account corresponding to block transaction a as the first account, and use the difference between the consumption and release quantities corresponding to block transaction a (i.e., 7-4=3) as the state slot demand corresponding to block transaction a.
[0115] Furthermore, based on the slot demand and the number of state slots to be rewarded corresponding to each second account, target second accounts are selected from the second accounts in their order of arrangement until the sum of the number of state slots to be rewarded corresponding to the selected target second accounts is greater than or equal to the slot demand. However, it should be noted that the number of state slots actually used for rewards is the same as the slot demand.
[0116] That is, in this example, the accounting node can use both blockchain account 1 and blockchain account 2 as the target second account, and transfer 2 / 3 of the virtual resources rewarded in block transaction a to blockchain account 1, and 1 / 3 of the virtual resources rewarded in block transaction a to blockchain account 2. During this process, it is not difficult to see that the two state slots to be rewarded in blockchain account 1 and the one state slot to be rewarded in blockchain account 2 have been used to obtain rewards. Therefore, the number of state slots to be rewarded corresponding to blockchain account 1 can be updated to 0, and the number of state slots to be rewarded associated with blockchain account 2 can be updated to 2. Optionally, when the number of state slots to be rewarded is 0, the corresponding blockchain account can be deleted from the second account.
[0117] S305: Determine a packaging strategy based on the actual consumption quantity and the consumption quota, and package the block transactions to be packaged in one or more block transactions according to the packaging strategy to generate a target block.
[0118] In a specific embodiment, after generating a target block, the accounting node needs to obtain approval from other blockchain nodes (called non-accounting nodes) in the blockchain network before storing the target block on the chain, so as to ensure the accuracy and legitimacy of the blockchain data as much as possible.
[0119] As an example, after generating a target block, the accounting node can send the target block to each non-accounting node, and each non-accounting node verifies the generation process of the target block according to the generation method of the target block, and counts the actual consumption of the state slot by the target block during the verification process, and then generates a legitimacy verification result based on the actual consumption count counted by itself and the actual consumption count of the state slot by the parent block of the target block.
[0120] If the difference between the actual consumption counted by a non-bookkeeping node and the actual consumption count corresponding to the parent block is less than or equal to a preset additional quota, the non-bookkeeping node generates a validity verification result indicating that the target block has passed the validity verification. If a preset number of non-bookkeeping nodes all provide validity verification results indicating that the target block has passed the validity verification, the bookkeeping node is allowed to add the target block to the blockchain. It is understood that the bookkeeping and non-bookkeeping nodes belong to the same blockchain network.
[0121] In an embodiment of the present application, when generating a target block, the number of state slots that can be consumed by the generation process will be limited, and when the actual consumption of the state slots in the generation process reaches a preset consumption limit, the first packaging strategy of not consuming state slots is adopted to selectively package block transactions, thereby slowing down the expansion rate of the data stored in the blockchain node, thereby effectively reducing the data processing pressure and deployment cost of the blockchain node. In addition, when the actual consumption amount does not reach the consumption limit but reaches a certain threshold, the embodiment of the present application will transfer a certain amount of virtual resources to the virtual resource pool corresponding to the blockchain account whose released number of state slots in the parent block is greater than the consumed number during the block generation process. The source of the virtual resources is the blockchain account corresponding to the block exchange that requires additional consumption of state slots during the packaging process. Based on this, each blockchain account can be effectively incentivized to release state slots, so that more node resources can be reused, which can further reduce the resource consumption rate and data expansion rate in the blockchain node.
[0122] In order to facilitate the rapid application of the embodiments of the present application, the following Figure 5 、 Figure 6 The following is a complete and detailed description of the implementation process of block generation in an embodiment of the present application, with specific examples. However, it should be noted that the subsequent description is only for illustrative purposes, and the specific steps included can be split or omitted according to actual business needs, and there is no limitation here.
[0123] Specifically, Figure 5 A schematic diagram of the implementation process of block generation is shown, in which block K-1 and block K are used as examples for explanation, wherein block K-1 is the parent block of block K. Figure 5 As shown, the implementation process of the embodiment of the present application may include steps S1-S5, and the implementation method of each step may be specifically as follows:
[0124] S1. Pack the block transactions corresponding to block K-1.
[0125] Specifically, the accounting node of block K-1 can use block K-1 as the target block and follow the following steps: Figure 2 or Figure 3 The method shown is to package the transactions of each block corresponding to block K-1.
[0126] S2. Determine the consumption amount of block K.
[0127] Specifically, in the process of packaging block K-1, you can refer to Figure 6 The principle shown is to calculate the consumption amount of block K. Figure 6As shown, in the process of packaging each block transaction, the usage of state slots in the packaging process of the block transaction is recorded. Then, based on the sum of the insertion quantities corresponding to each block transaction recorded for block K-1 (i.e., the total number of state slots consumed by block K-1) and the sum of the release quantities (i.e., the total number of state slots released by block K-1), the consumption amount of block K is determined. The insertion quantity refers to the number of state slots consumed, and the release quantity refers to the number of state slots released.
[0128] also, Figure 6 The initiating account in can be understood as the blockchain account that initiates the block transaction. Figure 6 A row in the "Status Slot Usage Record Table" is obtained for a block transaction record. Taking the first row of data as an example, the insertion quantity 3 corresponding to the initiating account (i.e., Sender1) refers to the number of state slots consumed when packaging the first block transaction, and the release quantity 5 refers to the number of state slots released when packaging the block transaction.
[0129] It should be noted that the consumption quota of block K (denoted as TotalSlot) can be determined based on the preset additional quota (denoted as X) and the remaining quota of block K-1 (denoted as FreeSlot). As an example, the consumption quota can be the sum of the preset additional quota and the remaining quota of block K-1, that is, TotalSlot = FreeSlot + X.
[0130] The preset additional quota is set based on business needs, ensuring that each block is allowed to consume at least X state slots, ensuring that the accounting nodes of each block have the ability to generate blocks. The legacy quota of block K-1 is the difference between the total number of state slots released by block K-1 and the total number of state slots consumed by block K-1. For example, if this difference is negative or 0, the legacy quota of block K-1 can be set to 0. If the difference is positive, the positive number is used as the legacy quota of block K-1.
[0131] In addition, the accounting node of block K-1 can also determine the second account from the blockchain accounts corresponding to each block transaction and add each second account to the account queue according to the execution order of each block transaction. It should be noted that the second account in the account queue includes each blockchain account determined based on the generation process of block K-1 and each block before block K-1 (such as block K-2).
[0132] S3. Pack the block transaction corresponding to block K.
[0133] Specifically, before packaging block K, the accounting node of block K can first obtain the consumption quota of block K for the state slot, and then package the transactions of each block based on this consumption quota. In actual applications, the block transaction packaging process corresponding to block K can include two stages: packaging indiscriminate transactions and packaging slot-free transactions.
[0134] Among them, the indiscriminate packaging transaction is executed when the actual consumption of state slots by block K does not reach the consumption quota. Specifically, it can be understood as the packaging process mentioned above according to the second packaging strategy. In other words, the indiscriminate packaging transaction refers to the packaging process that does not consider the consumption and release of state slots during packaging. The slot-free packaging transaction is triggered when the actual consumption of state slots by block K reaches the consumption quota. Specifically, it can be understood as the packaging process mentioned above according to the first packaging strategy. In other words, the actual consumption of state slots by block K must remain unchanged when packaging the slot-free transaction.
[0135] Furthermore, during the slot-free transaction packaging phase, the accounting node of block K will only select block transactions from the memory pool that do not require the consumption of state slots for packaging. Therefore, in some implementations, a corresponding field can be set within each block transaction to indicate whether the block transaction requires the consumption of state slots. This will help the corresponding accounting node quickly select block transactions that can be packaged, improving block generation efficiency.
[0136] In addition, in the process of packaging each block transaction corresponding to block K, it is still necessary to follow the following Figure 6 The principle shown is to record the usage of state slots corresponding to the generation process of block K. On the one hand, it can be used to determine the consumption amount of the sub-block of block K (which can be called block K+1). On the other hand, it can be used to implement an incentive mechanism to encourage each blockchain account to release more state slots, thereby slowing down the data expansion rate in the blockchain network.
[0137] Specifically, the incentive mechanism is mainly used to reward a certain amount of virtual resources to one or more second accounts determined based on the generation process of historical blocks during the generation process of the current block. As a feasible implementation method, the accounting node of block K can trigger the incentive mechanism after the actual consumption of the state slot reaches a certain amount (such as the remaining amount of block K-1). As an example, after the incentive mechanism is triggered, the accounting node can transfer a certain amount of virtual resources from the initiating account of the block transaction to the second account corresponding to block K-1 (or an earlier block, such as block K-2) when it detects that a block transaction needs to consume the state slot.
[0138] Experimental data shows that after applying the above incentive mechanism, more blockchain accounts will be willing to include virtual resource rewards in block transactions to encourage on-chain state slot occupants to release their occupied state slots, thereby achieving the goal of improving the efficiency of state slot release and slowing down the continuous expansion of data volume.
[0139] S4. Trigger the verification of the legitimacy of block K.
[0140] Specifically, after generating block K, the accounting node of block K can broadcast block K to each non-accounting node, so that after receiving block K, the non-accounting node can independently calculate the usage process of block K for the status slot locally, and verify whether the actual consumption number of the status slot corresponding to the generation process of block K is less than or equal to the consumption amount corresponding to block K, so as to verify whether the accounting node of block K performs block data processing in accordance with the prescribed protocol.
[0141] S5. Block K is uploaded to the chain.
[0142] Specifically, after the legitimacy of block K is verified, the accounting node of block K can store block K on the chain, thereby updating the blockchain.
[0143] The implementation process proposed in the embodiment of this application determines the actual number of state slots consumed by the current block based on the state slots released and inserted during the packaging process of each block transaction in the current block. It then uses a consumption quota to limit the actual number of state slots consumed, so that there is an upper limit on the number of new state slots added during the generation process of each block, thereby effectively controlling data expansion in the blockchain network. In addition, the above implementation process also introduces an incentive mechanism for slot release, achieving a dynamic game between state slot occupants, effectively incentivizing each occupant to release idle state slots, and to a certain extent saving blockchain data processing costs.
[0144] The present application also proposes another block data processing method, in which an incentive mechanism is applied to encourage each blockchain account to release its occupied state slots, thereby slowing down the consumption of storage resources of blockchain nodes. Figure 7 , and it should be noted that, Figure 7 The method shown can still be executed by the aforementioned computer device. Figure 7 As shown, the method may include steps S701-S703:
[0145] S701. In response to a block generation instruction for a target block, obtain one or more block transactions for generating the target block. One block transaction is generated in response to a transaction request of one blockchain account.
[0146] In a specific embodiment, the target block refers to the block currently to be generated, and the target block is generated by packaging one or more block transactions. When generating the target block, the block transactions are packaged in a certain order. Each block transaction primarily records resource exchange information between at least two blockchain accounts, and the block transaction may specifically include one or more transaction fields to provide transaction information required for reference during transaction packaging.
[0147] In one implementation, a block transaction may include a reward indication field. This field indicates the amount of reward resources allocated by the blockchain account that generated the block transaction for the block transaction. The reward resource amount refers to the amount of virtual resources that the blockchain account is willing to pay for packaging the block transaction. Optionally, block transactions with a reward resource amount are prioritized for packaging.
[0148] S702: In the process of packaging each block transaction, detect the number of released status slots of each block transaction.
[0149] In a specific embodiment, based on the description of step S201, it can be seen that releasing a state slot can be understood as deleting a key-value pair corresponding to a blockchain account, and consuming a state slot can be understood as creating a new key-value pair for a blockchain account, and the key is used to indicate the blockchain account, and the value is used to indicate the amount of virtual resources held by the blockchain account.
[0150] Consuming a state slot typically occurs when a new blockchain account is detected during a block transaction to complete the transaction, while releasing a state slot typically occurs when the amount of virtual resources corresponding to a blockchain account is detected to be zero after the transaction. For a more detailed understanding, please refer to the example in step S202 and will not be repeated here.
[0151] In addition, in one implementation, when the computer device is packaging block transactions, it can also obtain the target block's consumption quota for the state slot, and in the process of packaging each block transaction, detect the actual consumption quantity of the target block for the state slot, and then determine the packaging strategy based on the actual consumption quantity and the consumption quota, so as to package the block transactions to be packaged according to the packaging strategy. Among them, the specific implementation principle and execution steps of this implementation method can be found in the aforementioned Figures 2 to 6 The relevant embodiments in will not be repeated here.
[0152] S703: According to the release quantity corresponding to each block transaction, a reference quantity of virtual resources is transferred to the virtual resource pool associated with the blockchain account corresponding to the block transaction.
[0153] In a specific embodiment, after detecting the release amount corresponding to any block transaction, the computer device may issue a reward (i.e., transfer a reference amount of virtual resources) to the corresponding blockchain account based on the release amount. Alternatively, the computer device may issue rewards after detecting the release amounts corresponding to all block transactions. In this case, the reference amount of reward resources corresponding to any blockchain account may be determined based on the release amounts corresponding to each block transaction generated by the blockchain account and used to generate the target block.
[0154] In other words, the rewards in the embodiments of this application can be distributed in a single settlement or in batches. Single settlement refers to the distribution of rewards based on the number of state slots released after a block transaction is packaged; batch settlement refers to the distribution of rewards based on the number of state slots released after multiple block transactions generated by the same blockchain account are packaged. For ease of explanation, however, the following explanation of how to determine the reference quantity uses single settlement as an example.
[0155] Specifically, when the release quantity corresponding to any block transaction is less than or equal to a certain quantity threshold (such as threshold A), the amount of virtual resources that the blockchain account corresponding to the block transaction can obtain under the block transaction can be set to 0, indicating that the release quantity of the block transaction is insufficient for the blockchain account to obtain the virtual resource reward. When the release quantity corresponding to the block transaction is greater than the quantity threshold, the amount of virtual resource reward that the blockchain account corresponding to the block transaction can obtain under the block transaction can be determined based on the principle that the release quantity is positively correlated with the reward quantity. And as an example, the quantity threshold mentioned here can be a pre-set fixed value (such as 0), or it can be determined based on the number of state slots consumed by the block transaction (such as quantity threshold = consumption quantity).
[0156] For the sake of further explanation, block transactions that release a quantity greater than the aforementioned threshold will be referred to below as pending rewarded block transactions, and the blockchain account corresponding to the pending rewarded block transaction will be referred to as the resource reward account. In practical applications, upon detecting a pending rewarded block transaction, the computer device can immediately issue a reward to the resource reward account. Alternatively, the computer device can also issue a reward to the resource reward account upon detecting that the packaging of a target block transaction (i.e., a block transaction that is packaged after the pending rewarded block transaction) requires the consumption of a state slot, and the reward can be provided by the blockchain account corresponding to the target block transaction.
[0157] It should be noted that in actual application scenarios, the target block transaction can be a block transaction used to generate the target block, or a block transaction used to generate a subblock (or later) of the target block. In other words, the target block transaction can be detected during the generation of the target block, or during the generation of subsequent blocks.
[0158] In addition, the method for the blockchain account corresponding to the target block transaction to provide virtual resources to the resource reward account can be as follows:
[0159] For any block transaction to be rewarded, if, during the packaging process of the target block transaction corresponding to the block transaction, it is detected that the target block transaction consumes more than or equal to the preset threshold value of the state slot, the blockchain account corresponding to the target block transaction can be used as the resource payment account. Then, based on the release quantity corresponding to the rewarded block transaction, a reference amount of virtual resources can be transferred from the virtual resource pool corresponding to the resource payment account to the virtual resource pool associated with the resource reward account corresponding to the block transaction to be rewarded, so as to realize the reward distribution to the resource reward account.
[0160] The reference quantity may be a pre-set value or a value determined based on the amount of reward resources carried in the target block transaction and the release quantity corresponding to the block transaction to be rewarded.
[0161] Specifically, in one feasible implementation, upon detecting that the number of state slots consumed by a target block transaction is greater than or equal to a preset threshold, the computer device may parse the target block transaction to obtain a reward indication field included in the target block transaction, and then determine a reference quantity based on the amount of reward resources indicated by the reward indication field and the corresponding released quantity of the block transaction to be rewarded. The preset threshold may specifically be the difference between the released and consumed quantity of the state slots by the target block transaction.
[0162] When determining the reference quantity based on the reward resource amount indicated by the reward indication field and the released quantity corresponding to the to-be-rewarded block transaction, the computer device may refer to the consumption of the state slot by the to-be-rewarded block transaction. Specifically, when the released quantity corresponding to the to-be-rewarded block transaction is less than or equal to the consumed quantity corresponding to the target block transaction, the computer device may determine a ratio between the released quantity and the consumed quantity, and then calculate the reference quantity based on the ratio and the reward resource amount.
[0163] As an example, the reference quantity can be specifically the product operation result between the reward resource amount and the quantity ratio, so that the reference quantity is less than or equal to the reward resource amount, thereby realizing the incentive mechanism within the expected range of the reward payment account. On the one hand, it can meet the payment expectations of the reward payment account and reduce its payment pressure. On the other hand, it can effectively incentivize other blockchain accounts to trigger the generation of block transactions that can release state slots.
[0164] In an embodiment of the present application, by rewarding the blockchain account that generates the block transaction based on the number of slot releases corresponding to the block transaction, there will be more blockchain accounts in the blockchain network willing to trigger the generation of block transactions that can release state slots. Releasing the state slots means deleting the corresponding key-value pairs stored in the blockchain network, thereby reducing the amount of storage resources required to allocate to the blockchain node when generating the target block, thereby slowing down the expansion of the amount of data in the blockchain node and effectively reducing the deployment cost of the blockchain node.
[0165] Based on the above Figure 2 and Figure 3 The block data processing method shown in the present application also discloses a block data processing device for performing the following Figure 2 as well as Figure 3 The block data processing method of FIG. The block data processing device may be a computer program (including program code) running on a computer device. Figure 8 , the block data processing device may at least include Figure 8 The acquisition unit 801, the detection unit 802 and the packaging unit 803 in the embodiment of the present invention are shown in FIG.
[0166] An acquisition unit 801 is configured to acquire a consumption quota of a target block for a state slot, where the target block is generated based on one or more block transactions;
[0167] A detection unit 802 is configured to detect the actual number of state slots consumed by the target block during the process of packaging the block transactions corresponding to the target block;
[0168] The packaging unit 803 is configured to determine a packaging strategy according to the actual consumption quantity and the consumption quota, and package the block transactions to be packaged in the one or more block transactions according to the packaging strategy to generate the target block.
[0169] In one embodiment, when the packaging unit 803 is used to determine the packaging strategy according to the actual consumption quantity and the consumption quota, it can be specifically used to perform:
[0170] When the actual consumption amount is equal to the consumption quota, the first packaging strategy is used as the determined packaging strategy, where the first packaging strategy is used to indicate that the actual consumption amount of the target block on the status slot remains unchanged during the packaging process.
[0171] In another embodiment, when the packaging unit 803 is used to package the block transactions to be packaged using the first packaging strategy, it can be specifically used to perform:
[0172] Selecting, from the block transactions to be packaged included in the one or more block transactions, a target block transaction whose released amount of state slots during packaging is greater than or equal to its consumed amount of state slots;
[0173] The target block transactions are packaged.
[0174] In yet another embodiment, the obtaining unit 801 may also be configured to execute:
[0175] During the generation process of the parent block of the target block, counting the total number of state slots released and consumed by the parent block;
[0176] Based on the difference between the total released quantity and the total consumed quantity, the consumption amount of the target block on the status slot is determined.
[0177] In yet another embodiment, when the obtaining unit 801 is configured to determine the consumption amount of the target block for the status slot based on the difference between the total released amount and the total consumed amount, it may be specifically configured to execute:
[0178] Determining a parent block legacy quota corresponding to the target block based on a difference between the total released quantity and the total consumed quantity; wherein, when the difference is a non-positive number, the parent block legacy quota is 0; and when the difference is a positive number, the parent block legacy quota is positively correlated with the difference;
[0179] A weighted sum operation is performed on the parent block's remaining quota and the preset new quota, and according to the principle that the operation result is positively correlated with the consumption quota, the consumption quota of the target block for the status slot is determined based on the operation result.
[0180] In another embodiment, a block transaction is generated in response to a transaction request of a blockchain account, and one block transaction corresponds to one blockchain account; when the actual consumption amount is greater than a preset threshold and less than the consumption amount, the packaging unit 803 may further be configured to execute:
[0181] If it is detected that the number of state slots consumed is greater than the number of slots released during the packaging process corresponding to any block transaction, the blockchain account corresponding to the said block transaction is used as the first account;
[0182] Selecting a target second account corresponding to the first account from one or more second accounts, where the second account refers to a blockchain account that released more state slots than consumed during the generation of historical blocks before the target block;
[0183] Transferring a target amount of virtual resources in the virtual resource pool corresponding to the first account to the virtual resource pool corresponding to the target second account, wherein the target amount is determined based on the amount of reward resources configured by the first account in any block transaction.
[0184] In another embodiment, the one or more second accounts are arranged in the order of time in which the state slots are released during the historical block process; when the packaging unit 803 is used to select the target second account corresponding to the first account from the one or more second accounts, it can be specifically used to perform:
[0185] The difference between the consumption amount and the release amount corresponding to any block transaction is used as the number of state slots to be rewarded;
[0186] Obtaining a release margin of a state slot associated with each second account, where the release margin refers to the number of state slots that are not used to reward virtual resources;
[0187] According to the arrangement order of the one or more second accounts, based on the number of status slots to be rewarded and the release balance associated with each second account, N second accounts are selected in sequence from the one or more second accounts as target second accounts; wherein the sum of the release balances of the status slots associated with the N second accounts is greater than or equal to the number of status slots to be rewarded, and N is a positive integer.
[0188] In another embodiment, the block data processing device may be integrated into a bookkeeping node, and the acquisition unit 801 in the device may be further configured to perform:
[0189] Obtaining a validity check result of the target block by each non-bookkeeping node; wherein the validity check result is determined by each non-bookkeeping node based on the actual consumption of the state slot by the target block and the actual consumption of the state slot by the parent block of the target block, and when the difference between the actual consumption corresponding to the target block and the actual consumption corresponding to the parent block is less than or equal to a preset additional quota, the validity check result is used to indicate that the validity check of the target block has passed;
[0190] When the validity verification results of a preset number of non-bookkeeping nodes indicate that the validity verification of the target block has passed, the target block is added to the blockchain.
[0191] In another embodiment, when the packaging unit 803 is used to determine the packaging strategy according to the actual consumption quantity and the consumption quota, it can be specifically used to execute:
[0192] When the actual consumption amount is less than the consumption quota, the second packaging strategy is used as the determined packaging strategy, where the second packaging strategy is used to indicate that the actual consumption amount of the target block on the status slot is allowed to increase during the packaging process.
[0193] In another embodiment, the detection unit 802 is configured to detect the actual number of status slots consumed by the target block during the process of packaging the block transactions corresponding to the target block, and can be specifically configured to execute:
[0194] During the packaging process of each block transaction corresponding to the target block, detecting the number of state slots consumed and released by each block transaction;
[0195] Determine the actual consumption quantity corresponding to each block transaction based on the difference between the consumption quantity and the release quantity corresponding to each block transaction; when the difference corresponding to the block transaction is a positive number, the actual consumption quantity corresponding to the block transaction is positively correlated with the difference; when the difference corresponding to the block transaction is a non-positive number, the actual consumption quantity corresponding to the block transaction is 0;
[0196] The sum of the actual consumption quantities corresponding to the transactions in each block is taken as the actual consumption quantity of the state slot by the target block.
[0197] The block data processing device proposed in the embodiments of the present application sets a consumption limit for state slots during block generation. This limits the amount of storage resources required by blockchain nodes when generating a block, allowing for more spare resources within the blockchain nodes. This reduces the data processing pressure on the blockchain nodes and, to a certain extent, improves the efficiency of subsequent block generation. Furthermore, by limiting the amount of storage resources consumed when generating each block, the amount of resources required by blockchain nodes for storing the blockchain can be kept within a smaller range, thereby reducing the deployment cost of blockchain nodes.
[0198] Based on the above Figure 7 The block data processing method shown in FIG. 1 is also disclosed in the present application. Another block data processing device is used to perform the following steps: Figure 7The block data processing method of FIG. 1 may be a computer program (including program code) running on a computer device. Figure 9 , the block data processing device may at least include Figure 9 The instruction response unit 901, the package detection unit 902 and the resource reward unit 903.
[0199] An instruction response unit 901 is configured to, in response to a block generation instruction for a target block, obtain one or more block transactions for generating the target block, wherein a block transaction is generated in response to a transaction request of a blockchain account;
[0200] The packaging detection unit 902 is used to detect the number of released status slots of each block transaction during the process of packaging each block transaction;
[0201] The resource reward unit 903 is used to transfer a reference amount of virtual resources to the virtual resource pool associated with the blockchain account corresponding to each block transaction according to the release amount corresponding to each block transaction.
[0202] In one embodiment, the packaging detection unit 902 may also be configured to, during the process of packaging a target block transaction, detect that the number of state slots consumed by the target block transaction is greater than or equal to a preset threshold, use the blockchain account corresponding to the target block transaction as a resource payment account; wherein the target block transaction refers to a block transaction that is packaged after any of the block transactions;
[0203] When the resource reward unit 903 transfers a reference amount of virtual resources to the virtual resource pool associated with the blockchain account corresponding to any block transaction according to the released amount corresponding to any block transaction, it can specifically perform the following steps:
[0204] According to the released quantity corresponding to any block transaction, the reference quantity of virtual resources is transferred from the virtual resource pool corresponding to the resource payment account to the virtual resource pool associated with the blockchain account corresponding to any block transaction.
[0205] In another embodiment, the target block transaction includes a reward indication field, and the reward indication field is used to indicate the amount of reward resources configured by the resource payment account for the target block transaction; the resource reward unit 903 can also be used to execute:
[0206] Performing field parsing on the target block transaction to obtain a reward indication field included in the target block transaction;
[0207] The reference quantity is determined according to the reward resource amount indicated by the reward indication field and the release quantity corresponding to any block transaction.
[0208] In another embodiment, when determining the reference amount based on the reward resource amount indicated by the reward indication field and the released amount corresponding to any block transaction, the resource reward unit 903 may be specifically configured to perform:
[0209] If the release quantity corresponding to any block transaction is less than or equal to the consumption quantity corresponding to the target block transaction, then determine the ratio between the release quantity and the consumption quantity;
[0210] The reference quantity is calculated according to the quantity ratio and the reward resource amount, and the reference quantity is less than or equal to the reward resource amount.
[0211] In another embodiment, the block data processing apparatus may further include a strategy determination unit 904, which may be specifically configured to execute:
[0212] Obtain the consumption amount of the target block on the status slot;
[0213] In the process of packaging the transactions of each block, detecting the actual consumption amount of the state slot by the target block;
[0214] A packaging strategy is determined according to the actual consumption quantity and the consumption quota, and the block transactions to be packaged in the one or more block transactions are packaged according to the packaging strategy to generate the target block.
[0215] In an embodiment of the present application, by adopting the resource reward unit 903 to reward the blockchain account that generates the block transaction based on the number of slot releases corresponding to the block transaction, there will be more blockchain accounts in the blockchain network willing to trigger the generation of block transactions that can release state slots. Releasing the state slots means deleting the corresponding key-value pairs stored in the blockchain network, thereby reducing the amount of storage resources required to be allocated by the blockchain node when generating the target block, thereby slowing down the expansion of the amount of data in the blockchain node and effectively reducing the deployment cost of the blockchain node.
[0216] It should be noted that Figure 8 and Figure 9Each unit in the block data processing device shown is divided based on logical functions. Each of the above units can be individually or completely combined into one or more other units to form a unit, or one (or some) of the units can be further divided into multiple functionally smaller units to form a unit, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. In other embodiments of the present application, the above block data processing device can also include other units. In actual applications, these functions can also be assisted by other units and can be achieved by the collaboration of multiple units.
[0217] Based on the above description of the block data processing method and apparatus, the present application embodiment further provides a computer device. Figure 10 , the computer device includes at least a processor 1001 and a computer storage medium 1002, and the processor 1001 and the computer storage medium 1002 can be connected via a bus or other means. Among them, the computer storage medium 1002 is a memory device in the computer device, which is used to store programs and data. It can be understood that the computer storage medium 1002 here can include both the built-in computer storage medium in the computer device and, of course, the extended computer storage medium supported by the computer device. The computer storage medium 1002 is used to provide a storage space, which stores the operating system of the computer device. In addition, one or more computer programs suitable for being loaded and executed by the processor 1001 are also stored in the storage space. These computer programs can be one or more program codes.
[0218] Specifically, the computer storage medium may be a high-speed RAM memory or a non-volatile memory, such as at least one disk storage; optionally, it may be at least one computer storage medium located remote from the aforementioned processor. The processor (or CPU (Central Processing Unit)) corresponds to the computing core and control core of the computer device, which is suitable for implementing one or more computer programs, and is specifically suitable for loading and executing one or more computer programs to implement the corresponding method flow or corresponding function.
[0219] exist Figure 10 In one embodiment of the computer device shown, the processor 1001 may load and execute one or more computer programs stored in the computer storage medium 1002 to implement the above-mentioned Figure 2 and Figure 3 The corresponding method steps in the method embodiment shown. In a specific implementation, one or more computer programs in the computer storage medium 1002 are loaded by the processor 1001 and execute the following steps:
[0220] Obtaining a consumption quota of a state slot by a target block, where the target block is generated based on one or more block transactions;
[0221] In the process of packaging the block transactions corresponding to the target block, detecting the actual consumption quantity of the state slots by the target block;
[0222] A packaging strategy is determined according to the actual consumption quantity and the consumption quota, and the block transactions to be packaged in the one or more block transactions are packaged according to the packaging strategy to generate the target block.
[0223] In one implementation of this embodiment, when the processor 1001 is used to determine the packaging strategy according to the actual consumption quantity and the consumption quota, it can be specifically used to load and execute:
[0224] When the actual consumption amount is equal to the consumption quota, the first packaging strategy is used as the determined packaging strategy, where the first packaging strategy is used to indicate that the actual consumption amount of the target block on the status slot remains unchanged during the packaging process.
[0225] In another implementation of this embodiment, when the processor 1001 is used to package the block transactions to be packaged using the first packaging strategy, it can be specifically used to load and execute:
[0226] Selecting, from the block transactions to be packaged included in the one or more block transactions, a target block transaction whose released amount of state slots during packaging is greater than or equal to its consumed amount of state slots;
[0227] The target block transactions are packaged.
[0228] In another implementation of this embodiment, the processor 1001 may also be configured to load and execute:
[0229] During the generation process of the parent block of the target block, counting the total number of state slots released and consumed by the parent block;
[0230] Based on the difference between the total released quantity and the total consumed quantity, the consumption amount of the target block on the status slot is determined.
[0231] In another implementation of this embodiment, when the processor 1001 is configured to determine the consumption amount of the target block for the status slot based on the difference between the total released amount and the total consumed amount, it can be specifically configured to load and execute:
[0232] Determining a parent block legacy quota corresponding to the target block based on a difference between the total released quantity and the total consumed quantity; wherein, when the difference is a non-positive number, the parent block legacy quota is 0; and when the difference is a positive number, the parent block legacy quota is positively correlated with the difference;
[0233] A weighted sum operation is performed on the parent block's remaining quota and the preset new quota, and according to the principle that the operation result is positively correlated with the consumption quota, the consumption quota of the target block for the status slot is determined based on the operation result.
[0234] In another implementation of this embodiment, a block transaction is generated in response to a transaction request of a blockchain account, and one block transaction corresponds to one blockchain account; when the actual consumption amount is greater than a preset threshold and less than the consumption amount, the processor 1001 may further be configured to load and execute:
[0235] If it is detected that the number of state slots consumed is greater than the number of slots released during the packaging process corresponding to any block transaction, the blockchain account corresponding to the said block transaction is used as the first account;
[0236] Selecting a target second account corresponding to the first account from one or more second accounts, where the second account refers to a blockchain account that released more state slots than consumed during the generation of historical blocks before the target block;
[0237] Transferring a target amount of virtual resources in the virtual resource pool corresponding to the first account to the virtual resource pool corresponding to the target second account, wherein the target amount is determined based on the amount of reward resources configured by the first account in any block transaction.
[0238] In another implementation of this embodiment, the one or more second accounts are arranged in the order of time when the state slots are released during the historical block process; when the processor 1001 is used to select the target second account corresponding to the first account from the one or more second accounts, it can be specifically used to load and execute:
[0239] The difference between the consumption amount and the release amount corresponding to any block transaction is used as the number of state slots to be rewarded;
[0240] Obtaining a release margin of a state slot associated with each second account, where the release margin refers to the number of state slots that are not used to reward virtual resources;
[0241] According to the arrangement order of the one or more second accounts, based on the number of status slots to be rewarded and the release balance associated with each second account, N second accounts are selected in sequence from the one or more second accounts as target second accounts; wherein the sum of the release balances of the status slots associated with the N second accounts is greater than or equal to the number of status slots to be rewarded, and N is a positive integer.
[0242] In another implementation of this embodiment, the computer device may be used as a billing node, and the processor 1001 in the computer device may be further configured to load and execute:
[0243] Obtaining a validity check result of the target block by each non-bookkeeping node; wherein the validity check result is determined by each non-bookkeeping node based on the actual consumption of the state slot by the target block and the actual consumption of the state slot by the parent block of the target block, and when the difference between the actual consumption corresponding to the target block and the actual consumption corresponding to the parent block is less than or equal to a preset additional quota, the validity check result is used to indicate that the validity check of the target block has passed;
[0244] When the validity verification results of a preset number of non-bookkeeping nodes indicate that the validity verification of the target block has passed, the target block is added to the blockchain.
[0245] In another implementation of this embodiment, when the processor 1001 is used to determine the packaging strategy according to the actual consumption quantity and the consumption quota, it can also be specifically used to load and execute:
[0246] When the actual consumption amount is less than the consumption quota, the second packaging strategy is used as the determined packaging strategy, where the second packaging strategy is used to indicate that the actual consumption amount of the target block on the status slot is allowed to increase during the packaging process.
[0247] In another implementation of this embodiment, when the processor 1001 is used to package the block transactions corresponding to the target block, and detects the actual number of status slots consumed by the target block, it can be specifically used to load and execute:
[0248] During the packaging process of each block transaction corresponding to the target block, detecting the number of state slots consumed and released by each block transaction;
[0249] Determine the actual consumption quantity corresponding to each block transaction based on the difference between the consumption quantity and the release quantity corresponding to each block transaction; when the difference corresponding to the block transaction is a positive number, the actual consumption quantity corresponding to the block transaction is positively correlated with the difference; when the difference corresponding to the block transaction is a non-positive number, the actual consumption quantity corresponding to the block transaction is 0;
[0250] The sum of the actual consumption quantities corresponding to the transactions in each block is taken as the actual consumption quantity of the state slot by the target block.
[0251] In an embodiment of the present application, by setting a limit on the consumption of state slots during block generation, a computer device can limit the amount of storage resources required by a blockchain node when generating a block, thereby allowing more free resources to be available in the blockchain node, thereby reducing the data processing pressure on the blockchain node and, to a certain extent, improving the efficiency of subsequent block generation. Furthermore, by limiting the amount of storage resources that can be consumed when generating each block, the amount of resources required to store the blockchain by the blockchain node can be kept within a smaller range, thereby reducing the deployment cost of the blockchain node.
[0252] exist Figure 10 In another embodiment of the computer device shown, the processor 1001 may load and execute one or more computer programs stored in the computer storage medium 1002 to implement the above-mentioned Figure 7 The corresponding method steps in the method embodiment shown. In a specific implementation, one or more computer programs in the computer storage medium 1002 are loaded and executed by the processor 1001:
[0253] In response to a block generation instruction for a target block, obtaining one or more block transactions for generating the target block, wherein one block transaction is generated in response to a transaction request of one blockchain account;
[0254] In the process of packaging each block transaction, detecting the number of released state slots of each block transaction;
[0255] According to the release quantity corresponding to each block transaction, a reference quantity of virtual resources is transferred to the virtual resource pool associated with the blockchain account corresponding to each block transaction.
[0256] In one implementation of this embodiment, the processor 1001 may also be configured to load and execute:
[0257] If, during the packaging process of a target block transaction, it is detected that the target block transaction consumes more than or equal to a preset threshold value of state slots, the blockchain account corresponding to the target block transaction is used as a resource payment account; wherein the target block transaction refers to a block transaction that is packaged after any of the block transactions;
[0258] When used to transfer a reference amount of virtual resources into a virtual resource pool associated with a blockchain account corresponding to any block transaction according to the released amount corresponding to any block transaction, it can be specifically used to load and execute:
[0259] According to the released quantity corresponding to any block transaction, the reference quantity of virtual resources is transferred from the virtual resource pool corresponding to the resource payment account to the virtual resource pool associated with the blockchain account corresponding to any block transaction.
[0260] In another implementation of this embodiment, the target block transaction includes a reward indication field, and the reward indication field is used to indicate the amount of reward resources configured by the resource payment account for the target block transaction; the processor 1001 may also be used to load and execute:
[0261] Performing field parsing on the target block transaction to obtain a reward indication field included in the target block transaction;
[0262] The reference quantity is determined according to the reward resource amount indicated by the reward indication field and the release quantity corresponding to any block transaction.
[0263] In another implementation of this embodiment, when the processor 1001 loads and executes the determination of the reference number based on the reward resource amount indicated by the reward indication field and the release amount corresponding to any block transaction, it may also be specifically configured to load and execute:
[0264] If the release quantity corresponding to any block transaction is less than or equal to the consumption quantity corresponding to the target block transaction, then determine the ratio between the release quantity and the consumption quantity;
[0265] The reference quantity is calculated according to the quantity ratio and the reward resource amount, and the reference quantity is less than or equal to the reward resource amount.
[0266] In another implementation of this embodiment, the processor 1001 may also be specifically configured to load and execute:
[0267] Obtain the consumption amount of the target block on the status slot;
[0268] In the process of packaging the transactions of each block, detecting the actual consumption amount of the state slot by the target block;
[0269] A packaging strategy is determined according to the actual consumption quantity and the consumption quota, and the block transactions to be packaged in the one or more block transactions are packaged according to the packaging strategy to generate the target block.
[0270] In an embodiment of the present application, the computer device rewards the blockchain account that generates the block transaction based on the number of slots released in the block transaction, so that there will be more blockchain accounts in the blockchain network willing to trigger the block transaction that can release the state slot. Releasing the state slot means deleting the corresponding key-value pairs stored in the blockchain network, thereby reducing the amount of storage resources required to be allocated by the blockchain node when generating the target block, thereby slowing down the expansion of the data volume in the blockchain node and effectively reducing the deployment cost of the blockchain node.
[0271] The present application also provides a computer storage medium that stores one or more computer programs corresponding to any of the aforementioned block data processing methods. When one or more processors load and execute the one or more computer programs, the block data processing method described in the embodiments can be implemented, and further description thereof will not be given here. It is understood that the computer program can be deployed and executed on one or more devices that can communicate with each other.
[0272] An embodiment of the present application also provides a program product or computer program, which includes computer instructions stored in a computer storage medium, and a processor of a computer device can read the computer instructions from the computer storage medium and execute the computer instructions, so that the computer device can execute any block data processing method provided in the above embodiments.
[0273] It is understood that the beneficial effects of the same method used in the computer storage medium and program product in this application are the same as the beneficial effects corresponding to the aforementioned block data processing method, and therefore will not be described in detail here. In addition, the various embodiments disclosed above are merely partial embodiments of this application and are certainly not intended to limit the scope of the rights of this application. Persons skilled in the art will understand that equivalent changes made by implementing all or part of the processes of the above embodiments in accordance with the claims of this application still fall within the scope of the present invention.
Claims
1. A block data processing method, characterized in that: include: Obtaining a consumption quota of a state slot by a target block, where the target block is generated based on one or more block transactions; In the process of packaging the block transactions corresponding to the target block, detecting the actual consumption quantity of the state slots by the target block; A packaging strategy is determined according to the actual consumption quantity and the consumption quota, and the block transactions to be packaged in the one or more block transactions are packaged according to the packaging strategy to generate the target block.
2. The method according to claim 1, characterized in that The determining of the packaging strategy according to the actual consumption quantity and the consumption quota includes: When the actual consumption amount is equal to the consumption quota, the first packaging strategy is used as the determined packaging strategy, where the first packaging strategy is used to indicate that the actual consumption amount of the target block on the status slot remains unchanged during the packaging process.
3. The method according to claim 2, characterized in that The method of packaging the block transactions to be packaged using the first packaging strategy includes: From the block transactions to be packaged, select a target block transaction whose released amount of state slots is greater than or equal to the consumed amount of state slots during packaging; The target block transactions are packaged.
4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: During the generation process of the parent block of the target block, counting the total number of state slots released and consumed by the parent block; Based on the difference between the total released quantity and the total consumed quantity, the consumption amount of the target block on the status slot is determined.
5. The method according to claim 4, characterized in that The determining, based on the difference between the total released quantity and the total consumed quantity, the consumption amount of the state slot by the target block includes: Determining a parent block legacy quota corresponding to the target block based on a difference between the total released quantity and the total consumed quantity; wherein, when the difference is a non-positive number, the parent block legacy quota is 0; and when the difference is a positive number, the parent block legacy quota is positively correlated with the difference; A weighted sum operation is performed on the parent block's remaining quota and the preset new quota, and according to the principle that the operation result is positively correlated with the consumption quota, the consumption quota of the target block for the status slot is determined based on the operation result.
6. The method according to claim 1, wherein Block transactions are generated in response to transaction requests from blockchain accounts, and one block transaction corresponds to one blockchain account; When the actual consumption amount is greater than a preset threshold and less than the consumption amount, the method further includes: If it is detected that the number of state slots consumed is greater than the number of slots released during the packaging process corresponding to any block transaction, the blockchain account corresponding to the said block transaction is used as the first account; Selecting a target second account corresponding to the first account from one or more second accounts, where the second account refers to a blockchain account that released more state slots than consumed during the generation of historical blocks before the target block; Transferring a target amount of virtual resources in the virtual resource pool corresponding to the first account to the virtual resource pool corresponding to the target second account, wherein the target amount is determined based on the amount of reward resources configured by the first account in any block transaction.
7. The method according to claim 6, characterized in that The one or more second accounts are arranged in the order of time in which the state slots are released during the generation of the historical block; The selecting a target second account corresponding to the first account from one or more second accounts includes: The difference between the consumption amount and the release amount corresponding to any block transaction is used as the number of state slots to be rewarded; Obtaining a release margin of the state slots associated with each second account, where the release margin refers to the number of state slots that are not used to reward virtual resources; According to the arrangement order of the one or more second accounts, based on the number of status slots to be rewarded and the release balance associated with each second account, N second accounts are selected in sequence from the one or more second accounts as target second accounts; wherein the sum of the release balances of the status slots associated with the N second accounts is greater than or equal to the number of status slots to be rewarded, and N is a positive integer.
8. The method according to claim 1, characterized in that The method is applied to a bookkeeping node, and the method further includes: Obtaining a validity check result of the target block by each non-bookkeeping node; wherein the validity check result is determined by each non-bookkeeping node based on the actual consumption of the state slot by the target block and the actual consumption of the state slot by the parent block of the target block, and when the difference between the actual consumption corresponding to the target block and the actual consumption corresponding to the parent block is less than or equal to a preset additional quota, the validity check result is used to indicate that the validity check of the target block has passed; When the validity verification results of a preset number of non-bookkeeping nodes indicate that the validity verification of the target block has passed, the target block is added to the blockchain.
9. The method according to claim 1, characterized in that The determining of the packaging strategy according to the actual consumption quantity and the consumption quota includes: When the actual consumption amount is less than the consumption quota, the second packaging strategy is used as the determined packaging strategy, where the second packaging strategy is used to indicate that the actual consumption amount of the target block on the status slot is allowed to increase during the packaging process.
10. The method according to claim 1, characterized in that In the process of packaging the block transactions corresponding to the target block, detecting the actual amount of state slots consumed by the target block includes: During the packaging process of each block transaction corresponding to the target block, detecting the number of state slots consumed and released by each block transaction; Determine the actual consumption quantity corresponding to each block transaction based on the difference between the consumption quantity and the release quantity corresponding to each block transaction; when the difference corresponding to the block transaction is a positive number, the actual consumption quantity corresponding to the block transaction is positively correlated with the difference; when the difference corresponding to the block transaction is a non-positive number, the actual consumption quantity corresponding to the block transaction is 0; The sum of the actual consumption quantities corresponding to the transactions in each block is taken as the actual consumption quantity of the state slot by the target block.
11. A block data processing method, characterized in that: include: In response to a block generation instruction for a target block, obtaining one or more block transactions for generating the target block, wherein a block transaction is generated in response to a transaction request of a blockchain account; In the process of packaging each block transaction, detecting the number of released state slots of each block transaction; According to the release quantity corresponding to each block transaction, a reference quantity of virtual resources is transferred to the virtual resource pool associated with the blockchain account corresponding to each block transaction.
12. The method according to claim 11, characterized in that For any block transaction, the method further includes: If, during the packaging process of a target block transaction, it is detected that the target block transaction consumes more than or equal to a preset threshold value of state slots, the blockchain account corresponding to the target block transaction is used as a resource payment account; wherein the target block transaction refers to a block transaction that is packaged after any of the block transactions; Methods for transferring a reference amount of virtual resources into a virtual resource pool associated with a blockchain account corresponding to any block transaction according to the released amount corresponding to any block transaction include: According to the released quantity corresponding to any block transaction, the reference quantity of virtual resources is transferred from the virtual resource pool corresponding to the resource payment account to the virtual resource pool associated with the blockchain account corresponding to any block transaction.
13. The method according to claim 12, characterized in that The target block transaction includes a reward indication field, and the reward indication field is used to indicate the amount of reward resources configured by the resource payment account for the target block transaction; the method further includes: Performing field parsing on the target block transaction to obtain a reward indication field included in the target block transaction; The reference quantity is determined according to the reward resource amount indicated by the reward indication field and the release quantity corresponding to any block transaction.
14. The method according to claim 13, characterized in that The determining the reference quantity according to the reward resource amount indicated by the reward indication field and the released quantity corresponding to any block transaction includes: If the release quantity corresponding to any block transaction is less than or equal to the consumption quantity corresponding to the target block transaction, then determine the ratio between the release quantity and the consumption quantity; The reference quantity is calculated according to the quantity ratio and the reward resource amount, and the reference quantity is less than or equal to the reward resource amount.
15. The method according to any one of claims 11 to 14, characterized in that: The method further comprises: Obtain the consumption amount of the target block on the status slot; In the process of packaging the transactions of each block, detecting the actual consumption amount of the state slot by the target block; A packaging strategy is determined according to the actual consumption quantity and the consumption quota, and the block transactions to be packaged in the one or more block transactions are packaged according to the packaging strategy to generate the target block.