Data processing method based on block chain network and related equipment
By introducing a multi-level cache system into the blockchain network, the problem of low judgment efficiency of object identification is solved, efficient object identification query and service processing is realized, adapting to network load changes, and improving the performance and stability of the blockchain network.
Patent Information
- Application Number
- CN202410250891.X
- 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
When processing service processing requests, the blockchain network has low efficiency in determining the existence of object identification, resulting in low service processing efficiency, and it is difficult for the prior art to realize efficient object identification query.
A multi-level cache system is introduced, and multiple cache devices are set up in the cache system to store the object identifiers that have been linked according to the hierarchical storage rules, and the existence of object identifiers is determined through the cache device to reduce access to the underlying state database.
It improves the existence judgment efficiency of object identification, improves the service processing efficiency, and adapts to network load changes through automatic splitting and reconstruction mechanisms to maintain high performance and stability.
Smart Images

Figure CN120596510A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, in particular to the field of blockchain technology, and specifically to a data processing method based on a blockchain network, a data processing device based on a blockchain network, a computer device, a computer-readable storage medium, and a computer program product. Background Art
[0002] The state data of a blockchain network is a data structure used to represent the current state of the blockchain network. This data is continuously updated as transactions are executed, reflecting the global state of the blockchain network at a given point in time. This data can include the object identifiers of on-chain business objects, object information about on-chain business objects, the status of smart contracts, and other related information. This data is typically stored in the blockchain network's underlying state database in the form of a Merkle tree or other encrypted data structure to ensure its storage integrity and security. In other words, the identifiers of on-chain objects in the blockchain network are stored in the underlying state database.
[0003] Currently, when a blockchain network needs to determine the existence of the object identifier of the business object requested by the business processing request during the process of processing a business processing request, it needs to access the underlying state database of the blockchain network and perform an existence determination in the underlying state database of the blockchain network; due to the low efficiency of database query, the efficiency of determining the existence of the object identifier is low, which further leads to low business processing efficiency. Summary of the Invention
[0004] The embodiments of the present application provide a data processing method and related equipment based on a blockchain network, which can improve the efficiency of determining the existence of object identifiers, thereby improving business processing efficiency.
[0005] On the one hand, an embodiment of the present application provides a data processing method based on a blockchain network, and the data processing method based on a blockchain network includes:
[0006] Get the business processing request, which is used to request business processing on the business object;
[0007] Obtaining a cache system associated with the blockchain network, the cache system being configured to store identifiers of objects on the blockchain network; the cache system comprising a plurality of cache devices in a hierarchical relationship, the plurality of cache devices storing identifiers of objects on the blockchain hierarchically according to a hierarchical storage rule;
[0008] Determining, in the cache system, a target cache device that matches the object identifier of the business object according to the hierarchical storage rule;
[0009] In the target cache device, determining the existence of the object identifier of the business object;
[0010] Perform business processing on the business object based on the judgment result.
[0011] Accordingly, an embodiment of the present application provides a data processing device based on a blockchain network, the data processing device based on a blockchain network comprising:
[0012] An acquisition unit, used to acquire a business processing request, where the business processing request is used to request business processing on a business object;
[0013] The acquisition unit is further configured to acquire a cache system associated with the blockchain network, the cache system being configured to store identifiers of objects on the blockchain network; the cache system comprising a plurality of cache devices having a hierarchical relationship, the plurality of cache devices storing identifiers of objects on the blockchain hierarchically according to a hierarchical storage rule;
[0014] a processing unit configured to determine, in the cache system according to the hierarchical storage rule, a target cache device that matches the object identifier of the business object;
[0015] The processing unit is further configured to determine the existence of the object identifier of the business object in the target cache device;
[0016] The processing unit is further configured to perform business processing on the business object according to the determination result.
[0017] In one implementation, the hierarchical relationship of the plurality of cache devices means that the plurality of cache devices are organized in a tree-like hierarchical structure; the tree-like hierarchical structure includes one or more root nodes at a first level, each root node supports differentiation as a parent node into a child node at a next level, and the child node supports further differentiation; during the differentiation process, the child node inherits the node identifier of the parent node and adds its own node identifier;
[0018] Each terminal child node in the tree-like hierarchical structure corresponds to a cache device, and the device identifier of any cache device is the node identifier of the terminal child node corresponding to the cache device;
[0019] The hierarchical storage rule means that the chained object identifier is stored in the cache device corresponding to the device identifier that matches the chained object identifier.
[0020] In one implementation, the device identifier and the object identifier are both composed of characters; the hierarchical storage rule defines a matching direction between the device identifier and the object identifier; and the processing unit is configured to, when determining, in the cache system, according to the hierarchical storage rule, a target cache device that matches the object identifier of the business object, specifically perform the following steps:
[0021] performing character matching on the object identifier of the business object and the device identifiers of the plurality of cache devices according to the matching direction;
[0022] The cache device corresponding to the target device identifier in the cache system is determined as the target cache device that matches the object identifier of the business object; the target device identifier is a device identifier among the device identifiers of multiple cache devices, and the characters in the object identifier of the business object completely match the characters.
[0023] In one implementation, the business processing request includes a block to be uploaded to the chain; the processing unit is further configured to perform the following steps:
[0024] After the block to be chained passes the consensus of the blockchain network, the identifier of the object to be updated in the block to be chained is obtained and the identifier of the object to be updated needs to be updated in the cache system;
[0025] According to the hierarchical storage rule, determining, in the cache system, a reference cache device that matches the identifier of the object to be updated;
[0026] Update the identifier of the object to be updated in the reference cache device.
[0027] In one implementation, the processing unit is configured to update the identifier of the object to be updated in the reference cache device, specifically to perform the following steps:
[0028] When the object identifier to be updated needs to be added to the reference cache device, a common check is performed on the object identifier to be updated; if the object identifier to be updated is a common object identifier and the object identifier to be updated does not exist in the reference cache device, the object identifier to be updated is added to the reference cache device;
[0029] When the object identifier to be updated needs to be deleted from the reference cache device, if the object identifier to be updated exists in the reference cache device, the object identifier to be updated is deleted from the reference cache device.
[0030] In one implementation, the processing unit, after adding the identifier of the object to be updated to the reference cache device, is further configured to perform the following steps:
[0031] Performing a device split check on the reference cache device;
[0032] If the reference cache device meets the device splitting condition, splitting the object identifiers stored in the reference cache device into a first object identifier set and a second object identifier set;
[0033] Creating a first cache device, and writing object identifiers in a first object identifier set into the first cache device; and creating a second cache device, and writing object identifiers in a second object identifier set into the second cache device;
[0034] In the tree-shaped hierarchical structure, the first cache device and the second cache device are located at a level below the level where the reference cache device is located.
[0035] In one implementation, the processing unit is further configured to perform the following steps:
[0036] Before writing is completed in the first cache device and the second cache device, if it is necessary to perform an object identifier existence determination in the reference cache device, the object identifier existence determination in the reference cache device remains unchanged;
[0037] After writing is completed in the first cache device and the second cache device, the reference cache device is deleted. If an object identifier existence determination is required in the reference cache device, the object identifier existence determination is performed in the first cache device or the second cache device.
[0038] In one implementation, after deleting the identifier of the object to be updated from the reference cache device, the processing unit is further configured to perform the following steps:
[0039] Performing a device reconstruction check on the reference cache device;
[0040] If the reference cache device meets the device reconstruction condition, the reference cache device is reconstructed.
[0041] In one implementation, the processing unit is configured to perform the following steps when reconstructing the reference cache device:
[0042] Determine an associated cache device of the reference cache device; the associated cache device is a cache device in the cache system that belongs to the same parent node as the reference cache device;
[0043] If the associated cache device meets the device reconstruction condition, the reference cache device and the associated cache device are reconstructed into a new cache device.
[0044] In one implementation, the processing unit is further configured to perform the following steps:
[0045] Performing common checks on object identities in multiple cache devices;
[0046] Deleting infrequently used object identifiers in a plurality of cache devices;
[0047] After deleting the infrequently used object identifier, if there is a cache device that meets the device reconstruction condition, the cache device that meets the device reconstruction condition is reconstructed.
[0048] In one implementation, the business processing request includes a block to be uploaded to the chain, the block to be uploaded to the chain includes a transaction to be executed, and executing the transaction to be executed is used to perform business processing on the business object; the processing unit is further used to perform the following steps:
[0049] Call the smart contract corresponding to the pending transaction to execute the pending transaction; the smart contract includes multiple execution statements;
[0050] During the execution of a smart contract, if the current execution statement of the smart contract is an existence judgment statement, and the judgment object of the existence judgment statement is a business object, the execution is triggered to obtain the cache system associated with the blockchain network.
[0051] In one implementation, a smart contract is executed by calling a contract process; the contract process communicates with multiple cache devices via an interactive protocol; and the processing unit is further configured to perform the following steps:
[0052] The contract process sends an existence determination request to the target cache device through the interactive protocol;
[0053] The processing unit is configured to perform the following steps when determining the existence of the object identifier of the business object in the target cache device:
[0054] The target cache device responds to the existence determination request and performs an existence determination on the object identifier of the business object in the target cache device.
[0055] In one implementation, a business processing request includes a block to be uploaded to the chain, the block to be uploaded to the chain includes a transaction to be executed, and executing the transaction to be executed is used to perform business processing on the business object; the blockchain network includes two types of blockchain nodes: a master node and a slave node; and the processing unit is further configured to perform the following steps:
[0056] Determine the transaction execution result of the pending transaction based on the business processing result of the business object;
[0057] If the method is executed by the master node, the transaction execution results of the pending transaction are packaged into the block to be on-chain to obtain the block to be verified; the block to be verified is sent to the slave node for block verification;
[0058] If the method is executed by a slave node, the block to be chained also carries the transaction execution result of the transaction to be executed. The transaction execution result obtained by executing the transaction to be executed is compared with the transaction execution result carried in the block to be chained, and block verification is performed on the block to be chained.
[0059] Accordingly, an embodiment of the present application provides a computer device, comprising:
[0060] a processor suitable for implementing a computer program;
[0061] A computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and executing the above-mentioned data processing method based on the blockchain network.
[0062] Accordingly, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is read and executed by a processor of a computer device, the computer device executes the above-mentioned blockchain network-based data processing method.
[0063] Accordingly, an embodiment of the present application provides a computer program product, which includes a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the above-mentioned blockchain network-based data processing method.
[0064] In the embodiment of the present application, a cache system is set up specifically for storing the object identifiers that have been put on the chain. When it is necessary to make an existence determination on the object identifier of the business object in the process of processing a business processing request, the cache system can be directly accessed to make an existence determination on the object identifier of the business object in the cache system without accessing the underlying state database. The query efficiency of the cache system is higher than the query efficiency of the database, which can improve the efficiency of the existence determination of the object identifier, thereby improving the efficiency of business processing. In addition, the multiple cache devices in the cache system store the object identifiers that have been put on the chain hierarchically according to the hierarchical storage rules. When making an existence determination, the existence determination can be made in the cache device that matches the object identifier of the business object without accessing the entire cache system, thereby reducing the workload of the existence determination. This can further improve the efficiency of the existence determination of the object identifier, thereby further improving the efficiency of business processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only 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.
[0066] Figure 1 This is a schematic diagram of the architecture of a blockchain network provided in an embodiment of the present application;
[0067] Figure 2 This is a schematic diagram of the structure of a blockchain provided by an embodiment of the present application;
[0068] Figure 3 This is a structural diagram of a block generation process provided by an embodiment of the present application;
[0069] Figure 4 This is a schematic diagram of the internal structure of a blockchain node provided in an embodiment of the present application;
[0070] Figure 5 This is a flowchart of a data processing method based on a blockchain network provided in an embodiment of the present application;
[0071] Figure 6 This is a schematic diagram of the structure of a multi-level cache device provided in an embodiment of the present application;
[0072] Figure 7 This is a flowchart of another data processing method based on a blockchain network provided in an embodiment of the present application;
[0073] Figure 8 This is a schematic diagram of a process for determining the existence of an object identifier provided in an embodiment of the present application;
[0074] Figure 9 This is a schematic diagram of an object identification update process provided by an embodiment of the present application;
[0075] Figure 10 is a schematic diagram of a cache device splitting process provided by an embodiment of the present application;
[0076] Figure 11 is a schematic diagram of a cache device reconstruction process provided by an embodiment of the present application;
[0077] Figure 12 This is a schematic diagram of a flow chart for determining the existence of an object identifier provided in an embodiment of the present application;
[0078] Figure 13 This is a schematic diagram of an update process of a cache device provided in an embodiment of the present application;
[0079] Figure 14 This is a schematic diagram of a splitting process of a cache device provided in an embodiment of the present application;
[0080] Figure 15 This is a schematic diagram of the structure of a data processing device based on a blockchain network provided in an embodiment of the present application;
[0081] Figure 16 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0082] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0083] In order to more clearly understand the technical solutions provided by the embodiments of the present application, the technical terms involved in the embodiments of the present application are first introduced here:
[0084] (1) Blockchain network:
[0085] A blockchain network is a point-to-point connected network. Each blockchain node connected point-to-point is called a peer node. The blockchain network is based on a specific type of network protocol, which eliminates the need for a central node to maintain the network status between peer nodes. Each peer node maintains the node status of the entire network and its connection status with adjacent nodes through broadcast interactions with adjacent nodes.
[0086] The blockchain network can be understood as Figure 1 The data sharing system 10 shown is shown. The data sharing system 10 refers to a system for sharing data between blockchain nodes. The data sharing system may include multiple (multiple may include two or more) blockchain nodes 101. The multiple blockchain nodes 101 may refer to various clients, terminal devices, or servers in the data sharing system. Each blockchain node 101 may receive input information (e.g., blockchain transactions) during normal operation and maintain the shared data within the data sharing system based on the received input information. To ensure information interoperability within the data sharing system, information connections may exist between each blockchain node in the data sharing system, and information can be transmitted between blockchain nodes through the above information connections. For example, when any blockchain node in the data sharing system receives input information, the other nodes in the data sharing system obtain the input information according to the consensus algorithm and store the input information as data in the shared data, so that the data stored on all blockchain nodes in the data sharing system are consistent.
[0087] Each blockchain node in the data sharing system has a corresponding node identifier, and each blockchain node in the data sharing system can store the node identifiers of other blockchain nodes in the data sharing system so that the generated blocks can be broadcast to other blockchain nodes in the data sharing system based on the node identifiers of other blockchain nodes. Each blockchain node can maintain a node identifier list as shown in Table 1 below, and store the node name and node identifier in the node identifier list accordingly. The node identifier can be an IP (Internet Protocol, a protocol for interconnecting networks) address or any other information that can be used to identify the blockchain node. Table 1 only uses the IP address as an example for illustration:
[0088] Table 1
[0089] Node Name Node ID Node 1 111.111.111.111 Node 2 222.222.222.222 … … Node N NNN.NNN.NNN.NNN
[0090] In distributed computing and blockchain networks, a master-slave node architecture is a common network structure. In this architecture, the master node is typically responsible for coordinating key operations across the network, such as generating new blocks, processing transactions, and initiating consensus. Slave nodes, on the other hand, are responsible for performing tasks assigned by the master node, such as verifying transactions, storing data, and participating in consensus. In some blockchain network designs, the master node may rotate to ensure network decentralization and security.
[0091] (2) Blockchain:
[0092] Each blockchain node in a blockchain network stores an identical blockchain. Blockchain is a distributed ledger technology in the information technology field. It is generally composed of consensus, transaction blocks, state data storage, cryptographic identity security, and other components. Because the ledger is distributed and blocks are agreed upon, it is tamper-proof, traceable, and jointly maintained. The ledger is the core data structure in the blockchain network, used to store and manage all confirmed blocks. The ledger is organized in a chain-like structure, with each block containing a set of transactions, a block header (which can include metadata such as the hash value and timestamp of the previous block), and other information. The block ledger provides a public, immutable transaction history for the blockchain network, ensuring the transparency and consistency of the system.
[0093] A blockchain can be composed of multiple blocks, see Figure 2 As shown in the blockchain structure, the blockchain consists of multiple blocks. The genesis block in the blockchain includes a block header and a block body. The block header of the genesis block stores the input information feature value, version number, timestamp and difficulty value, and the block body of the genesis block stores the input information (i.e., transaction). The next block of the genesis block uses the genesis block as its parent block. The next block also includes a block header and a block body. In addition to storing the input information feature value, version number, timestamp and difficulty value of the current block, the block header of the next block also stores the feature value of the block header of the parent block, and so on. Therefore, the block data stored in each block in the blockchain is associated with the block data stored in its parent block, ensuring the security of the input information in the block.
[0094] When generating each block in the blockchain, refer to Figure 3In the block generation process shown in the figure, when the blockchain node receives the input information, it verifies the input information. After the verification is completed, the input information is stored in the transaction pool and the hash tree used to record the input information is updated. After that, the update timestamp is updated to the time when the input information is received, and different random numbers are tried. The eigenvalue calculation is performed multiple times so that the calculated eigenvalue can satisfy the following formula:
[0095] SHA256(SHA256(version+prev_hash+merkle_root+ntime+nbits+x)) <TARGET
[0096] Among them, SHA256 (Secure Hash Algorithm 256, a secure hash algorithm) is the eigenvalue algorithm used to calculate the eigenvalue; version (version number) is the version information of the relevant block protocol in the blockchain; prev_hash is the block header eigenvalue of the parent block of the current block; merkle_root is the eigenvalue of the input information; ntime is the update time of the update timestamp; nbits is the current difficulty, which is a fixed value for a period of time and is determined again after exceeding the fixed time period; x is a random number; TARGET is the eigenvalue threshold, which can be determined based on nbits.
[0097] In this way, when a random number that satisfies the above formula is calculated, the information can be stored accordingly, and the block header and block body can be generated to obtain the current block. Subsequently, the blockchain node where the blockchain is located sends the newly generated block to other blockchain nodes in the data sharing system according to the node identifiers of other blockchain nodes in the data sharing system. The other blockchain nodes verify the newly generated block and, after completion of the verification, add the newly generated block to their stored blockchain.
[0098] (3) Status data:
[0099] State data is a data structure used within a blockchain network to represent the current state of the network. State data is continuously updated as transactions are executed, reflecting the global state of the blockchain network at a given point in time. State data can include object identifiers and information about on-chain business objects, the status of smart contracts, and other related information. State data is typically stored in the blockchain network's underlying state database as a Merkle tree or other encrypted data structure to ensure its integrity and security.
[0100] The object identifiers and the object information corresponding to them in the state data are stored in the form of key-value pairs. A key-value pair is a data structure consisting of a key and an associated value, used to store and manage data. In this data structure, the key is a unique identifier used to index or find data, and the object identifier in the state data can be understood as the key; the value is the data content associated with the key, and the object information corresponding to the object identifier in the state data can be understood as the value associated with the key. Key-value pairs are widely used in programming and database systems, particularly in NoSQL (non-relational databases) and some distributed storage systems. In blockchain smart contracts, key-value pairs are often used to store contract state, such as account balances and permission settings for business objects. A smart contract is a computer protocol designed to communicate, verify, or execute contracts in an information-based manner. Smart contracts allow for trusted transactions without a third party, and these transactions are traceable and irreversible.
[0101] (4) Cache device:
[0102] The cache device is a cache structure for storing object identifiers. The cache device can support fast existence determination of object identifiers. Existence determination refers to determining whether the object identifier exists in the cache device. In an embodiment of the present application, the cache device may include a Bloom filter or a cuckoo filter. A Bloom filter is a data structure used to retrieve whether an element is in a set, which has advantages in space efficiency and query time. A cuckoo filter is a data structure used to quickly determine whether an element is in a set; it is a variant of a Bloom filter that provides similar functionality, but performs better in some aspects, especially in deleting elements and space efficiency. The cuckoo filter uses multiple hash functions and a fixed-size array. Each element can be placed in one of multiple positions determined by the hash function; if these positions are occupied, it will try to move existing elements to other positions to make room for new elements. This process is similar to the parasitic reproduction behavior of cuckoos in nature, hence the name.
[0103] Based on the introduction of the above technical terms, the technical solution provided by the embodiment of the present application is briefly introduced below. At present, in the process of processing business processing requests (business processing requests are used to request business processing of business objects), smart contracts in blockchain networks need to make an existence determination on the object identifier of the business object. The existence determination basically queries the local status database of the blockchain node, which has a very large performance bottleneck for the smart contract itself. In addition, such query requests are also very common. For example, when adding a new business object, it is necessary to determine whether the business object does not exist, and when performing resource operations on the business object, it is necessary to determine whether the business object exists. It can be seen that it is currently difficult to achieve efficient existence determination of object identifiers. Based on this, the embodiment of the present application provides a data processing method based on a blockchain network, which can improve the efficiency of existence determination of object identifiers. Regarding the data processing method based on a blockchain network, in detail:
[0104] First, the data processing method based on the blockchain network sets up a cache device specifically for storing object identifiers that have been put on the chain. The cache device has a higher efficiency in determining the existence of object identifiers than the state database. Therefore, the data processing method based on the blockchain can improve the efficiency in determining the existence of object identifiers and improve business processing efficiency.
[0105] Secondly, object identifiers have a hierarchical nature. To accommodate this hierarchical nature, the data processing method based on the blockchain network employs a multi-layered cache device. Multi-layer refers to a hierarchical concept in system, data structure, or architectural design; in a multi-layered design, different layers can represent different levels of abstraction, authority, or data processing, among other things. In the embodiments of the present application, a multi-layered cache device refers to a hierarchical relationship between multiple cache devices, with different layers representing different object identifier ranges or usage frequencies. When determining the existence of an object identifier, a cache device that matches the object identifier can be identified, and the object identifier's existence can be determined in the matching cache device without accessing all cache devices. This reduces the workload of existence determination, further improving the efficiency of object identifier existence determination and enhancing business processing efficiency. Furthermore, a multi-layered cache device allows blockchain networks to more efficiently manage and query data. The multi-layered design helps improve the manageability, scalability, and performance of blockchain networks.
[0106] Thirdly, the data processing method based on the blockchain network can introduce an automatic splitting and reconstruction mechanism. The automatic splitting and reconstruction mechanism means that the size and level depth of the cache device can be dynamically adjusted according to the actual load and storage requirements of the cache device. For example, when the load of the cache device at the current level is too large (the load is too large, which means that the number of object identifiers stored in the cache device is greater than or equal to a first threshold, which can be set based on empirical values), the cache device at the current level can be split and split into multiple (multiple means two or more) cache devices at the next level; when the load of the cache device at the current level is too low (the load is too low, which means that the number of object identifiers stored in the cache device is less than or equal to a second threshold, which can be set based on empirical values), the cache device at the current level can be reconstructed and reconstructed into a cache device at the previous level. This adaptive splitting and reconstruction capability not only ensures the stability of the blockchain network under different workloads, but also provides strong support for the future expansion of the blockchain network. As the blockchain network grows and the complexity of smart contracts increases, the data processing method based on the blockchain network can effectively adapt to these changes, maintaining the high performance and good business processing experience of the blockchain network.
[0107] Fourthly, the cache device has a storage condition, and the storage condition is specifically that the object identifier stored in the cache device is an object identifier with a high frequency of existence determination. In order to meet the storage condition of the cache device, when the object identifier is updated to the cache device, its frequency of existence determination needs to be checked; the cache device can also delete the object identifier with a low frequency of existence determination by regularly checking the frequency of existence determination of the object identifiers stored therein. In this way, the object identifier with a high frequency of existence determination is more likely to need to be determined for existence, and storing the object identifier with a high frequency of existence determination in the cache device is conducive to the rational use of the storage space of the cache device and further improves the efficiency of existence determination of object identifiers with a high frequency of determination.
[0108] Based on the above introduction to the technical solutions provided by the embodiments of this application, the following describes the implementation of the technical solutions. The data processing method based on a blockchain network can be executed by a computer device, which can be any blockchain node in the blockchain network. As previously described, blockchain nodes in a blockchain network can include master nodes and slave nodes. The blockchain node that executes the data processing method based on a blockchain network can be either a master node or a slave node.
[0109] When the blockchain node executing the blockchain network-based data processing method is a master node, the blockchain network-based data processing method can be executed during the master node's block proposal process. Specifically, the master node can obtain pending transactions from the transaction pool and package the pending transactions into blocks to be uploaded to the chain. The business processing request can include the blocks to be uploaded to the chain. The number of pending transactions can be one or more, and each pending transaction can be used to request business processing for a business object. During the execution of the business processing request, the master node can determine the existence of the object identifier of the business object based on a matching cache device, perform business processing on the business object based on the determination result to execute the pending transaction, and determine the transaction execution result of the pending transaction based on the business processing result. After obtaining the transaction execution result of the pending transaction, the master node can package the transaction execution result into a block to be uploaded to the chain, obtain a block to be verified, and send the block to be verified to the slave node for block verification.
[0110] The transaction pool (also known as the mempool) is a data structure within a blockchain network that stores pending transactions that have not yet been included in a block. When a new transaction is submitted to the blockchain network, it first enters the transaction pool. When a blockchain node prepares to generate a new block, it selects a certain number of transactions from the transaction pool for inclusion. The transaction pool helps improve the processing power of the blockchain network.
[0111] When the blockchain node executing the blockchain network-based data processing method is a slave node, the blockchain network-based data processing method can be executed while the slave node is verifying a block. Specifically, the service processing request received by the slave node may include a block to be uploaded to the blockchain. Here, the block to be uploaded to the blockchain can be understood as a block to be verified. The block to be uploaded to the blockchain may include a transaction to be executed. The block to be uploaded to the blockchain may also carry the transaction execution result of the transaction to be executed (here, the transaction execution result is obtained by the master node). During the process of executing the service processing request, the slave node may determine the existence of the object identifier of the business object based on the matching cache device, perform service processing on the business object based on the determination result to execute the transaction to be executed, and determine the transaction execution result of the transaction to be executed based on the service processing result (here, the transaction execution result is obtained by the slave node). After obtaining the transaction execution result, the slave node may compare the transaction execution result obtained by execution (i.e., the transaction execution result obtained by execution by the slave node) with the transaction execution result carried in the block to be uploaded to the blockchain (i.e., the transaction execution result obtained by execution by the master node) to verify the block to be uploaded to the blockchain.
[0112] Furthermore, the blockchain node is the basic component of the entire blockchain network, representing a participant in the blockchain network, responsible for processing transactions, maintaining the status of the blockchain, and participating in the consensus process. The internal structure of the blockchain node is introduced below. The blockchain node can implement the data processing method based on the blockchain network provided by the embodiment of the present application through the interaction between the internal structures. Figure 4 As shown, the internal structure of a blockchain node may include: a network module, a verification module, a transaction pool module, a scheduling module, a consensus module, and a storage module.
[0113] (1) Network Module: The network module is responsible for information transmission between blockchain nodes, including the sending and receiving of transaction data, block data, and control messages. The network module ensures that data can be transmitted securely and efficiently between different blockchain nodes.
[0114] (2) Verification module: The verification module can be used to verify the legitimacy of transactions and blocks. The verification module can include the following two submodules: certificate verification submodule and permission verification submodule.
[0115] Certificate Verification Submodule: The certificate verification submodule can be responsible for verifying the digital signatures of transactions or blocks, ensuring that they come from legitimate senders and have not been tampered with during transmission.
[0116] Permission verification submodule: The permission verification submodule can be used to check whether the object initiating the transaction has the permission to execute the transaction, for example, the calling permission of the smart contract.
[0117] (3) Transaction pool module: The transaction pool module can be used to store transactions that have not yet been packaged into blocks. After a blockchain node receives a new transaction, it will first put it into the transaction pool and wait for subsequent processing.
[0118] (4) Scheduling Module: The scheduling module is responsible for managing and scheduling the execution of transactions and the generation of blocks. The scheduling module can include the following six submodules: block generator, transaction scheduling submodule, contract repository, contract process pool, cache system, and cache automatic adjustment submodule.
[0119] Block Generator: The block generator is responsible for generating new blocks, packaging transactions in the transaction pool into blocks, and executing transactions.
[0120] Transaction scheduling submodule: The transaction scheduling submodule can manage the execution order of transactions and ensure that transactions can be processed according to certain rules.
[0121] Contract Warehouse: The contract warehouse can be used to store the code of smart contracts. When the smart contract is called, the contract warehouse will provide the corresponding code for execution.
[0122] Contract process pool: The contract process pool can be used to manage contract processes. The contract process refers to the execution process of the smart contract. Each time a smart contract is called, a new process or thread will be created in the process pool.
[0123] Cache system: The cache system includes multi-level cache devices, which can be used to quickly determine the cache device that matches the object identifier and perform existence determination on the object identifier in the matching cache device, determine whether the object identifier exists, and optimize the efficiency of the object identifier existence determination query.
[0124] Cache automatic adjustment submodule: The cache automatic adjustment submodule can detect the performance and capacity of the cache device and automatically split and reconstruct the cache device as needed.
[0125] (5) Consensus Module: The consensus module is responsible for reaching consensus among blockchain nodes in the blockchain network, verifying and confirming newly generated blocks. The consensus module can ensure the data consistency and security of the blockchain.
[0126] (6) Storage module: It is responsible for persistent storage of blockchain data. The storage module includes the following two submodules: state database and block ledger submodule:
[0127] State database: The state database can store the current state of the smart contract, that is, the latest status information of all business objects.
[0128] Blockchain submodule: The blockchain submodule can store blocks that have been confirmed by the blockchain network consensus, forming a chain structure of the blockchain. The chain structure of the blockchain is the blockchain.
[0129] The above content introduces the technical solutions provided by the embodiments of this application and the execution entities of the technical solutions. The following describes the application scenarios of the technical solutions. The data processing method based on the blockchain network provided by the embodiments of this application can be applied to any scenario in the blockchain network that requires the existence determination of object identifiers, such as DeFi (Decentralized Finance) scenarios, supply chain management scenarios, access control scenarios, smart contract data scenarios, voting scenarios, and blockchain commodity scenarios, etc. Specifically:
[0130] The decentralized finance scenario is a scenario for financial management based on a blockchain network. In the decentralized finance scenario, users of DeFi applications perform resource management operations such as resource transfer, resource borrowing, and resource liquidity query. In this scenario, the user is the business object requesting processing. When calling a smart contract to perform a resource management operation, it involves determining the existence of the user's object identifier; when determining the existence of the application user's object identifier, using the blockchain network-based data processing method provided in the embodiment of the present application can significantly improve the efficiency of determining the existence of the object identifier during the execution of resource management operations, reduce the response time of the DeFi system, and enhance the user experience of DeFi application users; and, the adaptive splitting and reconstruction cache device can optimize performance according to the actual usage pattern to maintain the high throughput of the DeFi system.
[0131] The supply chain management scenario is a scenario in which goods in the supply chain are managed based on a blockchain network. In the supply chain management scenario, there is an operation to record the flow information of goods. In this scenario, the goods are the business objects requested for processing. When calling a smart contract to perform a recording operation, it involves determining the existence of the object identifier of the goods. When determining the existence of the object identifier of the goods, using the data processing method based on the blockchain network provided in the embodiment of the present application can speed up the query of the goods history record and improve the overall efficiency of the supply chain management system. In addition, the structure of the cache device can be automatically adjusted to adapt to the query frequency of different goods.
[0132] The access control scenario is a scenario in which permission verification is performed based on a blockchain network. For example, in an enterprise's access control scenario, there is a permission verification operation for enterprise employees. In this scenario, enterprise employees are the business objects requested for processing. When calling a smart contract to perform a permission verification operation, it involves determining the existence of the enterprise employee's object identifier. When determining the existence of the enterprise employee's object identifier, the data processing method based on the blockchain network provided in the embodiment of the present application can be used to quickly verify permissions. In addition, multiple cache devices can realize the existence determination of a large number of enterprise employees while ensuring the security and stability of the access control system.
[0133] Smart contract data scenarios involve automated data transactions based on smart contracts within a blockchain network. In smart contract data scenarios, there are query operations that query information such as data ownership or transaction conditions. In these scenarios, data is the business object being processed. When invoking a smart contract to perform a query operation, the existence of the data's object identifier is determined. When determining the existence of the data's object identifier, using the blockchain network-based data processing method provided in the embodiments of this application can ensure that smart contracts can respond to market changes instantly, while reducing unnecessary database access and lowering operating costs.
[0134] The voting scenario involves managing voting based on a blockchain network. In this scenario, there are operations to verify voting information, such as the voter's eligibility or vote validity. In this scenario, the voter is the business object requesting processing. When calling a smart contract to perform a verification operation, the existence of the voter's object identifier is determined. When determining the existence of the voter's object identifier, the blockchain network-based data processing method provided in the embodiments of this application can provide a fast voter existence determination service, ensuring the smoothness and accuracy of the voting process.
[0135] The blockchain commodity scenario involves managing blockchain commodities based on a blockchain network. Examples of blockchain commodities include blockchain games and NFTs (digital collectibles). Within this blockchain commodity management scenario, there are operations to query commodity information, such as ownership and transfer records. In this scenario, the blockchain commodity is the business object requested for processing. When invoking a smart contract to perform a query operation, the existence of the object identifier of the blockchain commodity is determined. When determining the existence of the object identifier of the blockchain commodity, using the blockchain network-based data processing method provided in the embodiments of this application can accelerate the commodity information query process, improve the transaction processing speed of blockchain commodities, and enhance the user experience of blockchain commodities.
[0136] The technical solutions provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0137] The embodiment of the present application provides a data processing method based on a blockchain network, and the content of the data processing method based on the blockchain network includes: hierarchical storage rules of multi-level cache devices, and the matching process between object identifiers and cache devices. Figure 5 As shown, the process may include but is not limited to the following steps S501 to S505:
[0138] S501: Obtain a business processing request, where the business processing request is used to request business processing on a business object.
[0139] A business processing request can include a pending block, which is a block waiting to be uploaded to the blockchain for storage. A pending block requires consensus on the blockchain network. Once the pending block passes consensus, it can be uploaded to the blockchain for storage. A pending block can include pending transactions, which can be one or more. A pending transaction can be used to request business processing on a business object, and executing a pending transaction can enable business processing on the business object. Thus, a business processing request can request business processing on a business object through the pending transactions.
[0140] S502, obtaining a cache system associated with the blockchain network, the cache system being used to store identifiers of objects that have been put on the blockchain in the blockchain network; the cache system includes a plurality of cache devices having a hierarchical relationship, and the plurality of cache devices store identifiers of objects that have been put on the blockchain in a hierarchical manner according to a hierarchical storage rule.
[0141] If, during the processing of a business object, it is necessary to determine the existence of the object identifier of the business object, a cache system associated with the blockchain network can be obtained. The existence determination of the business object's object identifier can be performed in the cache system. Existence determination refers to determining whether the business object's object identifier exists. The cache system can be used to store object identifiers that have been uploaded to the blockchain network. An uploaded object identifier is an object identifier that has been uploaded to the blockchain for storage.
[0142] A cache system may include multiple cache devices in a hierarchical relationship, each of which can store on-chain object identifiers hierarchically according to hierarchical storage rules. A blockchain network-associated cache system means that each blockchain node in the blockchain network is equipped with the same cache device, and the cache devices in the cache systems of each blockchain node store on-chain object identifiers hierarchically according to the hierarchical storage rules.
[0143] Among them, multiple cache devices have a hierarchical relationship, which means that: multiple cache devices are organized according to a tree hierarchical structure. The tree hierarchical structure may include one or more root nodes at the first level, each root node supports differentiation into child nodes of the next level as a parent node, and the child nodes support continued differentiation; during the differentiation process, the child node inherits the node identifier of the parent node and adds the node identifier of the child node itself. Each terminal child node in the tree hierarchical structure corresponds to a cache device, and the device identifier of any cache device is the node identifier of the terminal child node corresponding to the cache device. The terminal child node refers to the child node that has not been further differentiated in the tree hierarchical structure. Based on the above introduction to the hierarchical relationship between multiple cache devices, the hierarchical storage rule means that the object identifier that has been chained is stored in the cache device corresponding to the device identifier that matches the object identifier that has been chained.
[0144] It should be noted that both the device identifier and the object identifier are composed of characters, and the hierarchical storage rules also define the matching direction between the device identifier and the object identifier, which refers to the character matching direction between the characters in the device identifier and the characters in the object identifier. The process of matching the device identifier for the object identifier that has been chained may include: performing character matching on the object identifier that has been chained and the device identifiers of multiple cache devices in the cache system according to the matching direction; determining the first device identifier as the device identifier that matches the object identifier that has been chained, where the first device identifier is a device identifier among the device identifiers of the multiple cache devices in the cache system, whose characters completely match the characters in the object identifier that has been chained.
[0145] Among them, the matching direction may include prefix matching or suffix matching. Prefix matching refers to character matching of characters in the identifier in order from front to back, and suffix matching refers to character matching of characters in the identifier in order from back to front. When the specified matching direction is prefix matching, the device identifier can be matched for the object identifier on the chain according to the matching direction of prefix matching; in this case, it can be understood that the device identifier that matches the object identifier on the chain is the prefix of the object identifier on the chain. When the specified matching direction is suffix matching, the device identifier can be matched for the object identifier on the chain according to the matching direction of suffix matching; in this case, it can be understood that the device identifier that matches the object identifier on the chain is the suffix of the object identifier on the chain.
[0146] In addition, the direction in which a child node adds its own node identifier, based on the node identifier inherited from the parent node, is related to the specified matching direction. When the specified matching direction is prefix matching, a child node can inherit the node identifier of the parent node and add its own node identifier after the parent node identifier. When the specified matching direction is suffix matching, a child node can inherit the node identifier of the parent node and add its own node identifier before the parent node identifier.
[0147] Taking prefix matching as an example, an exemplary tree-like hierarchical structure of a cache device is as follows: Figure 6 As shown, the tree-like hierarchical structure includes three levels, namely the first level (also called level 1), the second level (also called level 2), and the third level (also called level 3). The first level may include three root nodes, and the node identifiers of the three root nodes are key1, key2, and key3 respectively.
[0148] For the root node key1, as the parent node, it is differentiated into two child nodes of the second level. The two child nodes inherit the node identifier of the root node key1 and add their own node identifier after the node identifier of the root node key1 to obtain the final node identifier. The node identifiers of the two child nodes of the second level are key1-key1 and key1-key2 respectively. The two child nodes of the second level are not further differentiated and can be used as terminal child nodes, each corresponding to a cache device; the cache device corresponding to the child node key1-key1 can be used to store the chained object identifiers with the identifier prefix key1-key1, and the cache device corresponding to the child node key1-key2 can be used to store the chained object identifiers with the identifier prefix key1-key2.
[0149] For the root node key2, it is not further differentiated and can be used as a terminal child node, corresponding to a cache device. The cache device corresponding to the root node key2 can be used to store the object identifier that has been chained with the identifier prefix key2.
[0150] For the root node key3, as the parent node, it is differentiated into two child nodes of the second level. The two child nodes inherit the node identifier of the root node key3 and add their own node identifier after the node identifier of the root node key3 to obtain the final node identifier. The node identifiers of the two child nodes of the second level are key3-key1 and key3-key2 respectively. Each child node of the second level is further differentiated into two child nodes of the third level as a parent node. For the child nodes differentiated from the child node key3-key1, on the basis of inheriting the node identifier key3-key1, the node identifier of the child node is added after the node identifier key3-key1 to obtain the final node identifier. The node identifiers of the two child nodes differentiated from the child node key3-key1 are key3-key1-key1 and key3-key1-key2 respectively; for the child nodes differentiated from the child node key3-key2, on the basis of inheriting the node identifier key3-key2, the node identifier of the child node is added after the node identifier key3-key2 to obtain the final node identifier. The node identifiers of the two child nodes differentiated from the child node key3-key2 are key3-key2-key1 and key3-key2-key2 respectively. The four child nodes of the third level are not further differentiated and can serve as terminal child nodes, each corresponding to a cache device; the cache device corresponding to the child node key3-key1-key1 can be used to store the object identifier that has been chained with an identification prefix of key3-key1-key1, the cache device corresponding to the child node key3-key1-key2 can be used to store the object identifier that has been chained with an identification prefix of key3-key1-key2, the cache device corresponding to the child node key3-key2-key1 can be used to store the object identifier that has been chained with an identification prefix of key3-key2-key1, and the cache device corresponding to the child node key3-key2-key2 can be used to store the object identifier that has been chained with an identification prefix of key3-key2-key2.
[0151] For the chained object identifier key1-key1-key5, according to the prefix matching direction, the characters in the device identifier key1-key1 completely match the characters in the chained object identifier. In other words, the device identifier key1-key1 is a prefix of the chained object identifier key1-key1-key5. Therefore, the device identifier that matches the chained object identifier key1-key1-key5 is key1-key1, and the chained object identifier key1-key1-key5 can be stored in the cache device corresponding to the device identifier key1-key1.
[0152] S503: Determine a target cache device that matches the object identifier of the business object in the cache system according to the hierarchical storage rule.
[0153] As described above, the hierarchical storage rule defines the matching direction between the device identifier and the object identifier. According to the hierarchical storage rule, the method of determining the target cache device that matches the object identifier of the business object in the cache system is similar to the method of matching the device identifier for the object identifier that has been chained. Specifically, according to the hierarchical storage rule, determining the target cache device that matches the object identifier of the business object in the cache system may include: performing character matching on the object identifier of the business object and the device identifiers of multiple cache devices according to the matching direction; determining the cache device corresponding to the target device identifier in the cache system as the target cache device that matches the object identifier of the business object; the target device identifier is a device identifier in the device identifiers of the multiple cache devices in the cache system, the characters of which completely match the characters in the object identifier of the business object.
[0154] S504: In the target cache device, an existence determination is performed on the object identifier of the business object.
[0155] In the target cache device, performing an existence determination on the object identifier of the business object specifically refers to determining whether the object identifier of the business object exists in the target cache device.
[0156] S505: Perform business processing on the business object according to the determination result.
[0157] Business processing of business objects may include any of the following types: adding a new business object (for example, in a decentralized finance scenario, adding a financial account of a business object), querying the object information of a business object (for example, in a blockchain commodity scenario, querying the ownership of a blockchain commodity), editing the object information of a business object (for example, in a decentralized finance scenario, transferring resources of a business object's financial account), and deleting a business object (for example, in a decentralized finance scenario, deleting the financial account of a business object).
[0158] When the business processing of a business object includes adding a new business object, the business processing of the business object according to the judgment result may include: when the judgment result indicates that the object identifier of the business object does not exist in the target cache device, the business object may be added; when the judgment result indicates that the object identifier of the business object exists in the target cache device, a new addition result may be returned. When the business processing of a business object includes querying the object information of the business object, the business processing of the business object according to the judgment result may include: when the judgment result indicates that the object identifier of the business object exists in the target cache device, the object information of the business object may be queried; when the judgment result indicates that the object identifier of the business object does not exist in the target cache device, a query failure result may be returned. When the business processing of a business object includes editing the object information of the business object, the business processing of the business object according to the judgment result may include: when the judgment result indicates that the object identifier of the business object exists in the target cache device, the object information of the business object may be edited; when the judgment result indicates that the object identifier of the business object does not exist in the target cache device, an edit failure result may be returned. When the business processing of the business object includes deleting the business object, the business processing of the business object is performed according to the judgment result, which may include: when the judgment result indicates that the object identifier of the business object exists in the target cache device, the business object can be deleted; when the judgment result indicates that the object identifier of the business object does not exist in the target cache device, a deletion failure result can be returned.
[0159] As described above, the process of performing business processing on a business object is the process of executing a pending transaction. The transaction execution result of the pending transaction can be determined based on the business processing result of the business object. When a pending transaction requests business processing on a single business object, the business processing result of that single business object can be determined as the transaction execution result of the pending transaction. When a pending transaction requests business processing on multiple business objects, the business processing results of multiple business objects can be determined as the transaction execution result of the pending transaction.
[0160] In an embodiment of the present application, a cache system is provided specifically for storing object identifiers that have been uploaded to the blockchain. When an existence check is required for the object identifier of a business object during the processing of a business request, the cache system can be directly accessed and the existence check is performed on the object identifier of the business object in the cache system without accessing the underlying state database. The query efficiency of the cache system is higher than that of the database, which can improve the efficiency of object identifier existence checks and thus improve business processing efficiency. The time complexity of the cache device for existence checks is close to a constant level, which means that even in an environment with large amounts of data and high-frequency existence checks, the existence check of the object identifier can maintain high efficiency, significantly improving the execution performance of the smart contract. When the cache device is a cuckoo filter, compared to a Bloom filter, the Bloom filter has a certain false alarm rate, and the cuckoo filter reduces this problem by using multiple hash functions and backup locations. In addition, the multiple cache devices in the cache system store the object identifiers that have been uploaded to the blockchain in a hierarchical manner according to a hierarchical storage rule. This is conducive to hierarchical management of the cache devices and can better adapt to hierarchical changes in the cache devices. When performing existence determination, the existence determination can be performed in a cache device that matches the object identifier of the business object without accessing the entire cache system, thereby reducing the workload of existence determination. This can further improve the efficiency of existence determination of the object identifier, thereby further improving business processing efficiency.
[0161] The embodiment of the present application provides a data processing method based on a blockchain network. The data processing method based on a blockchain network includes: an object identification update process of a cache device, a split process of a cache device, and a reconstruction process of a cache device. The data processing method based on a blockchain network is as follows: Figure 7 As shown, the process may include but is not limited to the following steps S701 to S708:
[0162] S701: Obtain a business processing request, where the business processing request is used to request business processing on a business object.
[0163] The business processing request may include a block to be on-chain, and the block to be on-chain may include a transaction to be executed. The transaction to be executed may be used to request business processing of a business object. By executing the transaction to be executed, business processing may be performed on the business object.
[0164] S702, obtaining a cache system associated with the blockchain network, the cache system being used to store identifiers of objects that have been put on the blockchain in the blockchain network; the cache system includes a plurality of cache devices having a hierarchical relationship, and the plurality of cache devices store identifiers of objects that have been put on the blockchain in a hierarchical manner according to a hierarchical storage rule.
[0165] If, during the process of processing a business object (i.e., during the execution of a pending transaction), an existence check is required for the object identifier of the business object, a cache system associated with the blockchain network can be obtained. Specifically, the pending transaction can be executed by calling a smart contract, which can call the smart contract corresponding to the pending transaction to execute the pending transaction. The smart contract may include multiple execution statements. During the execution of the smart contract, if the current execution statement of the smart contract is an existence check statement, and the object of the existence check statement is a business object, it can be determined that an existence check is required for the object identifier of the business object, and a cache system associated with the blockchain network can be obtained.
[0166] For an introduction to the hierarchical relationship between multiple cache devices and an introduction to hierarchical storage rules, please refer to the above Figure 5 The description of step S502 in the illustrated embodiment will not be repeated here.
[0167] S703: Determine a target cache device that matches the object identifier of the business object in the cache system according to the hierarchical storage rule.
[0168] In the embodiment of the present application, the execution process of step S703 is the same as the above Figure 5 The execution process of step S503 in the embodiment shown is the same, and the execution process of step S703 can be specifically referred to the above Figure 5 The description of step S503 in the illustrated embodiment will not be repeated here.
[0169] S704: In the target cache device, an existence determination is performed on the object identifier of the business object.
[0170] During the execution of a smart contract, after determining that an existence check is required for the object identifier of a business object, the target cache device can be notified through an interactive protocol to perform an existence check. Specifically, the smart contract can be executed by calling a contract process allocated to the smart contract in a contract process pool. The contract process in the contract process pool and the multiple cache devices in the cache system can communicate through an interactive protocol. After determining that an existence check is required for the object identifier of a business object, and determining that the cache device that matches the object identifier of the business object is the target cache device, the contract process can send an existence check request to the target cache device through an interactive protocol. After receiving the existence check request, the target cache device can respond to the existence check request, and perform an existence check on the object identifier of the business object in the target cache device to obtain a check result.
[0171] Furthermore, when the judgment result indicates that the object identifier of the business object does not exist in the target cache device, the target cache device can send the judgment result to the contract process through the interactive protocol, so that the contract process calls the smart contract to perform business processing on the business object based on the judgment result, where the judgment result indicates that the object identifier of the business object does not exist. When the judgment result indicates that the object identifier of the business object exists in the target cache device, the target cache device can further confirm the existence of the object identifier of the business object in the state database; if it is determined that the object identifier of the business object exists in the state database, the target cache device can send the judgment result to the contract process through the interactive protocol, so that the contract process calls the smart contract to perform business processing on the business object based on the judgment result, where the judgment result indicates that the object identifier of the business object exists; if it is determined that the object identifier of the business object does not exist in the state database, the target cache device needs to modify the judgment result (the modified judgment result indicates that the object identifier of the business object does not exist), delete the object identifier of the business object in the target cache device, and send the modified judgment result to the contract process through the interactive protocol, so that the process calls the smart contract to perform business processing on the business object based on the modified judgment result.
[0172] In summary, the process of determining the existence of the object identifier of a business object is as follows: Figure 8 As shown: the contract process calls the smart contract corresponding to the transaction to be executed, and executes the transaction to be executed. The smart contract includes execution statement 1, execution statement 2, and execution statement 3, etc.; the smart contract currently executes execution statement 2. If execution statement 2 is an existence determination statement, and the determination object of the existence determination statement is a business object, then a target cache device that matches the object identifier of the business object can be determined in the cache system, and the object identifier of the business object can be determined in the target cache device. If the determination result indicates that the object identifier of the business object does not exist in the target cache device, a determination result indicating non-existence can be returned to the contract process of the smart contract. If the determination result indicates that the object identifier of the business object exists in the target cache device, then a request can be continued to the state database, requesting the state database to confirm the existence of the object identifier of the business object; if the object identifier of the business object exists in the state database, the state database can return a determination result indicating existence to the target cache device, and the target cache device can return a determination result indicating existence to the contract process of the smart contract.
[0173] In other words, if the business object's object identifier doesn't exist in the target cache, it can be determined that it also doesn't exist in the state database. If the business object's object identifier does exist in the target cache, due to the cache's inherent false positive rate, further existence verification in the state database is necessary to improve the accuracy of existence determination. Furthermore, through the interactive protocol between the contract process and the cache, the smart contract can efficiently interact with the cache during execution, thereby improving the efficiency of existence determination.
[0174] S705: Perform business processing on the business object according to the determination result.
[0175] In the embodiment of the present application, the execution process of step S705 is the same as the above Figure 5 The execution process of step S505 in the embodiment shown is the same, and the execution process of step S705 can be specifically referred to the above Figure 5 The description of step S505 in the illustrated embodiment will not be repeated here.
[0176] S706: After the block to be chained passes the consensus of the blockchain network, the identifier of the object to be updated in the block to be chained is obtained, and the identifier of the object to be updated needs to be updated in the cache system.
[0177] After a block to be chained has passed consensus on the blockchain network, it can be uploaded to the blockchain for storage. Specifically, the block to be chained can be uploaded to the blockchain and stored in the block ledger submodule of each blockchain node in the blockchain network. To ensure consistency between the object identifier storage in the cache system and the blockchain, the cache system can be updated based on the block to be chained. Specifically, the block to be chained can be retrieved from the block ledger submodule, parsed, and the object identifier to be updated in the block to be chained can be obtained. The updated object identifier must then be updated in the cache system.
[0178] The ID of the object to be updated can be added to a write set. Specifically, a block to be on-chain can include one or more pending transactions, each of which corresponds to a write set. The ID of the object to be updated can be added to the write set corresponding to the pending transaction to which it belongs. All write sets can be traversed sequentially to update the ID of the object to be updated in the cache system. The relationship between the ID of the object to be updated and the pending transaction is that if the pending transaction is used to request business processing for the business object corresponding to the ID of the object to be updated, then the ID of the object to be updated belongs to the pending transaction.
[0179] S707 , according to the hierarchical storage rule, determine a reference cache device that matches the identifier of the object to be updated in the cache system.
[0180] For any object identifier to be updated, a reference cache device that matches the object identifier to be updated can be determined in the cache system according to the hierarchical storage rules. The way of determining the reference cache device that matches the object identifier to be updated in the cache system according to the hierarchical storage rules is similar to the way of determining the target cache device that matches the object identifier of the business object in the cache system according to the hierarchical storage rules. Specifically, according to the hierarchical storage rules, determining the reference cache device that matches the object identifier to be updated in the cache system may include: performing character matching on the object identifier to be updated and the device identifiers of multiple cache devices according to the matching direction; determining the cache device corresponding to the reference device identifier in the cache system as the reference cache device that matches the object identifier to be updated; the reference device identifier is a device identifier in the device identifiers of the multiple cache devices in the cache system, the characters of which completely match the characters in the object identifier to be updated.
[0181] S708: Update the identifier of the object to be updated into the reference cache device.
[0182] After determining the reference cache device that matches the object identifier to be updated, the object identifier to be updated can be updated to the reference cache device. The updating includes adding the object identifier to be updated to the reference cache device or deleting the object identifier to be updated from the reference cache device.
[0183] In the case of adding the identifier of the object to be updated to the reference cache device, when the identifier of the object to be updated needs to be added to the reference cache device, a common check can be performed on the identifier of the object to be updated; if the identifier of the object to be updated is a common object identifier and the identifier of the object to be updated does not exist in the reference cache device, the identifier of the object to be updated can be added to the reference cache device; if the identifier of the object to be updated is an uncommon object identifier, the updating of the identifier of the object to be updated can be refused; if the identifier of the object to be updated exists in the reference cache device, the updating of the identifier of the object to be updated can be refused. Among them, the common check means: checking the frequency of the existence determination of the identifier of the object to be updated according to the frequency threshold; if the frequency of the existence determination of the identifier of the object to be updated is higher than or equal to the frequency threshold, it can be determined that the identifier of the object to be updated is a common object identifier; if the frequency of the existence determination of the identifier of the object to be updated is lower than the frequency threshold, it can be determined that the identifier of the object to be updated is an uncommon object identifier.
[0184] In summary, for the case of adding to the reference cache device, such as Figure 9 As shown: After the block to be chained passes the consensus of the blockchain network, the block to be chained can be parsed from the block ledger submodule of the blockchain node to obtain the identifier of the object to be updated; the identifier of the object to be updated can be added to the write set, for example, Figure 9The write set in includes object identifiers 1 to be updated - object identifiers 8 to be updated. By traversing the write set, the frequently used object identifiers in the write set can be updated to (i.e., added to). Frequently used object identifiers are in the cache device that matches the frequently used object identifiers in the cache system, and infrequently used object identifiers are not updated. In other words, frequently used object identifiers, i.e., object identifiers with a high frequency of existence determination can be added to the cache device. Object identifiers with a high frequency of existence determination are more likely to require existence determination. Object identifiers with a high frequency of existence determination are stored in the cache device, which is conducive to the rational use of the storage space of the cache device. If infrequently used object identifiers with a low frequency of existence determination are stored in the cache device, the possibility of infrequently used object identifiers requiring existence determination is low, and the storage space of the cache device will be occupied for a long time, resulting in a waste of the storage space of the cache device.
[0185] After the object identifiers to be updated are updated in the reference cache device, a device split check can be triggered for the reference cache device. The device split check is to check whether the reference cache device meets the device split condition. The reference cache device meets the device split condition when the number of object identifiers stored in the reference cache device is greater than or equal to a first threshold. The reference cache device does not meet the device split condition when the number of object identifiers stored in the reference cache device is less than the first threshold.
[0186] If the reference cache device meets the device splitting condition, the reference cache device may be subjected to device splitting processing. The device splitting processing may include: splitting the object identifiers stored in the reference cache device into a first object identifier set and a second object identifier set; creating a first cache device and writing the object identifiers in the first object identifier set into the first cache device; and creating a second cache device and writing the object identifiers in the second object identifier set into the second cache device.
[0187] It should be noted that when splitting the object identifiers stored in the reference cache device, the split can be performed from the middle of consecutive object identifiers to ensure that the number of object identifiers in the first object identifier set and the second object identifier set are as equal as possible. In other words, the object identifiers stored in the reference cache device can be sorted, and the split can be performed from the middle of the sorted object identifiers to obtain the first object identifier set and the second object identifier set.
[0188] In the tree-like hierarchical structure, the first cache device and the second cache device are located at the next level of the reference cache device. Figure 10As shown, the cache device with the device identification key1-key1 needs to be split. Before the split, the cache device with the device identification key1-key1 is at the second level. After the split, the cache device with the device identification key1-key1 is split into a cache device with the device identification key1-key1-key[1-3] and a cache device with the device identification key1-key1-key[4-8]; the cache device with the device identification key1-key1-key[1-3] and the cache device with the device identification key1-key1-key[4-8] are at the third level, which is the next level below the second level.
[0189] It should be noted that the splitting of the cache device follows the asynchronous splitting mechanism, and the object identifier after the split is asynchronously written to the newly created cache device. Before the writing is completed, the cache device before the split is maintained. Specifically, the asynchronous splitting mechanism means: before the first cache device and the second cache device are written, if it is necessary to make an object identifier existence determination in the reference cache device, then the object identifier existence determination in the reference cache device remains unchanged; after the first cache device and the second cache device are written, the reference cache device is deleted, and if it is necessary to make an object identifier existence determination in the reference cache device, then the object identifier existence determination is made in the first cache device or the second cache device. Through the asynchronous splitting mechanism, it can be ensured that the existence determination operation of the smart contract will not be affected during the splitting of the cache device, thereby ensuring the correctness of the smart contract existence determination and the high availability and stability of the system.
[0190] For the case where the object identifier to be updated is deleted from the reference cache device, when the object identifier to be updated needs to be deleted from the reference cache device, if the object identifier to be updated exists in the reference cache device, the object identifier to be updated can be deleted from the reference cache device; if the object identifier to be updated does not exist in the reference cache device, the object identifier to be updated can be refused to be deleted from the reference cache device.
[0191] After deleting the object identifier to be updated from the reference cache device, a device reconstruction check can be triggered for the reference cache device. The device reconstruction check refers to checking whether the reference cache device meets the device reconstruction condition. The reference cache device meets the device reconstruction condition when the number of object identifiers stored in the reference cache device is less than or equal to a second threshold. The reference cache device does not meet the device reconstruction condition when the number of object identifiers stored in the reference cache device is greater than the second threshold.
[0192] If the reference cache device meets the device reconstruction condition, the reference cache device can be reconstructed. The device reconstruction process may include: determining an associated cache device of the reference cache device, where the associated cache device is a cache device in the cache system that belongs to the same parent node as the reference cache device; if the associated cache device meets the device reconstruction condition (i.e., if the number of object identifiers stored in the associated cache device is less than or equal to a second threshold), the reference cache device and the associated cache device can be reconstructed into a new cache device, and the object identifiers in the reference cache device and the associated cache device are both written to the new cache device.
[0193] In the tree-like hierarchical structure, the reconstructed cache device is at the upper level of the reference cache device and the associated cache device. Figure 11 As shown, the cache device with the device identification key1-key1 needs to be reconstructed, and its associated cache device is the cache device with the device identification key1-key2 that belongs to the same parent node. Before the reconstruction, the cache device with the device identification key1-key1 and the cache device with the device identification key1-key2 are at the second level. After the reconstruction, the cache device with the device identification key1-key1 and the cache device with the device identification key1-key2 are reconstructed into the cache device with the device identification key1, and the cache device with the device identification key1 is at the first level, and the first level is at the upper level of the second level.
[0194] Similar to the splitting of the cache device, the reconstruction of the cache device follows an asynchronous reconstruction mechanism, and the object identifier in the cache device before reconstruction is asynchronously written to the reconstructed cache device, and the cache device before reconstruction is maintained before the writing is completed. Specifically, the asynchronous reconstruction mechanism means: before the writing of the reconstructed cache device is completed, if it is necessary to make an object identifier existence determination in the reference cache device or the associated cache device, then the object identifier existence determination in the reference cache device or the associated cache device remains unchanged; after the writing of the reconstructed cache device is completed, the reference cache device and the associated cache device are deleted, and if it is necessary to make an object identifier existence determination in the reference cache device or the associated cache device, then the object identifier existence determination is made in the reconstructed cache device. Through the asynchronous reconstruction mechanism, it can be ensured that the existence determination operation of the smart contract will not be affected during the reconstruction of the cache device, thereby ensuring the correctness of the smart contract existence determination and the high availability and stability of the system.
[0195] Steps S706-S708 above describe how, after a block to be uploaded reaches consensus, the cache system can be checked and updated based on the block to be uploaded to ensure consistency with the blockchain. In addition to checking and updating the cache system after a block reaches consensus, the cache system can also perform regular checks and updates. Regular checks and updates refer to periodic checks and updates, with a fixed interval between any two checks and updates, such as daily checks and updates (with a one-day interval between any two checks and updates) or weekly checks and updates (with a one-week interval between any two checks and updates). Each check and update process can include: performing a regular check on object identifiers in multiple cache devices; deleting infrequently used object identifiers from multiple cache devices; and, after deleting the infrequently used object identifiers, reconstructing any cache device that meets the device reconstructing condition if any exists. The method for reconstructing the cache device that meets the device reconstructing condition is the same as the method for reconstructing the reference cache device. For details, please refer to the above-mentioned section on reconstructing the reference cache device and will not be repeated here.
[0196] Based on the above description of the cache system's inspection and update process, we can see that by introducing a cache that automatically splits and restructures, the system can dynamically adjust the size and depth (i.e., the depth of the layer) of the cache based on actual load and storage requirements. This adaptive capability not only ensures the stability of the blockchain network under varying workloads but also provides strong support for future expansion. As the blockchain network grows and the complexity of smart contracts increases, it can effectively adapt to these changes, maintaining the high performance of the blockchain network and a good user experience.
[0197] It should be noted that the above-mentioned check and update of the cache system (including checking and updating the cache system according to the block to be chained, and checking and updating the cache system regularly) needs to be executed by each blockchain node in the blockchain network. This is the node state synchronization mechanism. In other words, the node state synchronization mechanism means that: after the block to be chained reaches a consensus, each blockchain node in the blockchain network checks and updates its own cache device according to the block to be chained; and each blockchain node in the blockchain network regularly checks and updates its own cache device. Through the node state synchronization mechanism, it can be ensured that the status of the cache device can be synchronized in a timely and accurate manner between each blockchain node in the blockchain network; this mechanism significantly improves the consistency and reliability of smart contract queries in a distributed environment, while also reducing the performance overhead caused by inconsistent status.
[0198] In the embodiment of the present application, multiple cache devices in the cache system hierarchically store the object identifiers that have been chained according to the hierarchical storage rules, which optimizes the storage structure. Through hierarchical management and dynamic adjustment, the cache device can make more accurate existence judgments, thereby reducing the possibility of false alarms. This optimization not only improves the accuracy of existence judgments, but also helps to reduce unnecessary state database accesses caused by false alarms, saving computing and storage resources. In addition, the embodiment of the present application optimizes the structure and working mechanism of the cache device to adapt to the multi-dimensional characteristics of object identifiers in smart contracts. By analyzing the frequency and pattern of object identifier usage in smart contracts, the object identifier space can be adaptively segmented, and the object identifier space can be dynamically divided and reconstructed. This method not only improves the efficiency of object identifier existence judgment, but also can dynamically adjust the size and depth of the cache device according to the actual workload, thereby optimizing the use of storage space and reducing the error rate.
[0199] The embodiment of the present application provides a data processing method based on a blockchain network. The data processing method based on a blockchain network includes: a detailed existence determination process of an object identifier. Figure 12 As shown, the process may include but is not limited to the following steps S1201 to S1227:
[0200] S1201, the blockchain management object packages and encapsulates the smart contract information.
[0201] The blockchain management object refers to the manager of the blockchain. Smart contract information can include the contract name to be called, function name, parameters, etc.
[0202] S1202, the blockchain management object signs the smart contract information.
[0203] S1203, the blockchain management object sends the smart contract information, digital certificate and signature to the master node of the blockchain network.
[0204] S1204, the network module of the master node receives the smart contract information, digital certificate and signature.
[0205] S1205, the certificate verification submodule of the master node verifies the legality of the digital certificate and signature.
[0206] If the legal verification passes, step S1207 is executed; if the legal verification fails, step S1206 is executed.
[0207] S1206: Return the result of legal verification failure.
[0208] S1207, the authority verification submodule of the master node performs authority verification on the blockchain management object.
[0209] If the authority verification passes, execute step S1209; if the authority verification fails, execute step S1208.
[0210] S1208: Return the result indicating that the permission verification failed.
[0211] S1209: The block generator in the scheduling module of the master node obtains the pending transactions from the transaction pool and packages the pending transactions into the block to be uploaded to the chain.
[0212] S1210: The scheduling module of the master node starts the contract code of the smart contract in the contract repository and adds the started contract process to the contract process pool.
[0213] S1211: The master node's contract process starts to call the smart contracts in sequence to execute the pending transactions corresponding to the smart contracts.
[0214] S1212: The contract process of the master node executes the execution statements of the smart contract in sequence to determine whether the current execution statement is an existence judgment statement.
[0215] If the currently executed statement is an existence determination statement, step S1213 is executed; if the currently executed statement is not an existence determination statement, step S1220 is executed.
[0216] S1213, the contract process of the master node sends the object identifier of the business object requested for processing to the cache system.
[0217] S1214: The cache system of the master node determines a target cache device that matches the object identifier of the business object in the cache system.
[0218] S1215: The target cache device of the master node performs an existence determination on the object identifier of the business object in the target cache device.
[0219] If the object identifier of the business object exists in the target cache device, step S1217 is executed; if the object identifier of the business object does not exist in the target cache device, step S1216 is executed.
[0220] S1216: The target cache device of the master node returns a determination result that the object identifier of the business object does not exist.
[0221] Continue to step S1219.
[0222] S1217: The target cache device of the master node accesses the state database to determine the existence of the object identifier of the business object.
[0223] S1218, the status database of the master node returns the determination result to the cache system.
[0224] S1219, the master node's cache system will determine the return contract process.
[0225] Continue to step S1212.
[0226] S1220, the contract process of the master node determines whether the currently executed statement is a return result statement.
[0227] If yes, execute step S1221; if no, execute step S1222.
[0228] S1221, encapsulate the contract execution result and return it to the execution transaction.
[0229] Continue to step S1223.
[0230] S1222: The currently executed statement is neither an existence determination statement nor a result return statement, and the master node's contract process continues to execute the currently executed statement.
[0231] Continue to step S1212.
[0232] S1223: The master node determines whether the current pending transaction is the last pending transaction in the block to be on-chain.
[0233] If yes, execute step S1224; if no, execute step S1211.
[0234] S1224: The block generator of the master node encapsulates the transaction execution result into a block to be on-chain, generating a block to be verified.
[0235] S1225, the consensus module of the master node sends the block to be verified to the slave node for verification, so as to reach a consensus on the block to be verified.
[0236] The slave node can execute steps S1210-S1223 to obtain the transaction execution result of the slave node. The slave node can compare the transaction execution result of the slave node with the transaction execution result in the block to be verified. If the transaction execution result of the slave node is consistent with the transaction execution result in the block to be verified, it can be determined that the block to be verified has passed verification; if the transaction execution result of the slave node is inconsistent with the transaction execution result in the block to be verified, it can be determined that the block to be verified has failed verification. The slave node can send the block verification result to the master node. If the number of block verification results received by the master node indicating that the block to be verified has passed verification is greater than or equal to a quantity threshold (the quantity threshold can be, for example, 2 / 3 of the number of blockchain nodes included in the blockchain network), it can be determined that consensus has been achieved; if the number of block verification results received by the master node indicating that the block to be verified has passed verification is less than the quantity threshold, it can be determined that consensus has failed.
[0237] If the consensus is passed, step S1226 is executed; if the consensus is not passed, the process ends.
[0238] S1226, all blockchain nodes in the blockchain network append the latest block to the block ledger.
[0239] S1227, all blockchain nodes in the blockchain network append the latest state data to the state database.
[0240] In the embodiments of the present application, by introducing a multi-level cache device, the existence of an object identifier can be quickly determined without directly accessing the underlying state database, thereby significantly improving the efficiency of determining the existence of an object identifier. Furthermore, due to the high space efficiency of the cache device, it can achieve fast queries with lower resource consumption than a full database query, reducing the pressure on storage and computing resources.
[0241] The embodiment of the present application provides a data processing method based on a blockchain network. The data processing method based on a blockchain network includes: a detailed update process of a cache device (for the case of adding an object identifier). The detailed update process of the cache device is as follows: Figure 13 As shown, the process may include but is not limited to the following steps S1301 to S1309:
[0242] S1301: The consensus on the block to be chained in the blockchain node is completed, and the block to be chained is added to the block ledger.
[0243] S1302: The blockchain node parses the block to be chained, obtains the identifier of the object to be updated, and adds the identifier of the object to be updated to one or more write sets.
[0244] Specifically, a pending block may include one or more pending transactions. Each pending transaction may correspond to a write set, and the pending object identifier may be added to the write set corresponding to the pending transaction to which it belongs. The relationship between the pending object identifier and the pending transaction is that if the pending transaction is used to request business processing for the business object corresponding to the pending object identifier, the pending object identifier belongs to the pending transaction.
[0245] S1303: The storage module of the blockchain node sequentially traverses the identifiers of the objects to be updated in each write set.
[0246] S1304: The storage module of the blockchain node determines whether the current object identifier to be updated in the current write set is an infrequently used object identifier.
[0247] If yes (ie the object identifier to be updated is an uncommon object identifier), step S1308 is executed; if no (ie the object identifier to be updated is a common object identifier), step S1305 is executed.
[0248] S1305, the storage module of the blockchain node determines a reference cache device that matches the identifier of the object to be updated in the cache system.
[0249] S1306, the reference cache device of the blockchain node determines whether it contains the current object identifier to be updated.
[0250] If yes, execute step S1308; if no, execute step S1307.
[0251] S1307, the blockchain node adds the identifier of the object to be updated in the reference cache device.
[0252] S1308: The storage module of the blockchain node determines whether the current object identifier to be updated is the last object identifier to be updated in the current write set.
[0253] If yes, execute step S1309; if no, execute step S1304.
[0254] S1309: The storage module of the blockchain node determines whether the current write set is the last write set.
[0255] If so, the update ends; if not, execute step S1304.
[0256] In an embodiment of the present application, a node state synchronization mechanism is provided. This mechanism means that after consensus is reached on a block in a blockchain network, each blockchain node in the blockchain network updates its own cache system based on the identifier of the object to be updated in the block. This ensures that the state of the cache device can be synchronized promptly and accurately between each blockchain node in the blockchain network. This mechanism significantly improves the consistency and reliability of smart contract queries in a distributed environment, while also reducing the performance overhead caused by inconsistent state. The node state synchronization mechanism also ensures that the cache device state can be updated quickly and consistently across each blockchain node, thereby maintaining the overall performance and consistency of the system even when the number of blockchain nodes increases.
[0257] The embodiment of the present application provides a data processing method based on a blockchain network. The data processing method based on a blockchain network includes: a detailed splitting process of a cache device. The detailed splitting process of a cache device is as follows: Figure 14 As shown, the process may include but is not limited to the following steps S1401 to S1414:
[0258] S1401: The consensus on the block to be chained in the blockchain node is completed, and the block to be chained is added to the block ledger.
[0259] S1402: The blockchain node parses the block to be chained, obtains the identifier of the object to be updated, and adds the identifier of the object to be updated to one or more write sets.
[0260] Specifically, a pending block may include one or more pending transactions. Each pending transaction may correspond to a write set, and the pending object identifier may be added to the write set corresponding to the pending transaction to which it belongs. The relationship between the pending object identifier and the pending transaction is that if the pending transaction is used to request business processing for the business object corresponding to the pending object identifier, the pending object identifier belongs to the pending transaction.
[0261] S1403, the storage module of the blockchain node traverses the identifier of the object to be updated in each write set in turn.
[0262] S1404: The storage module of the blockchain node determines whether the current object identifier to be updated in the current write set is an infrequently used object identifier.
[0263] If yes (ie the object identifier to be updated is an uncommon object identifier), step S1413 is executed; if no (ie the object identifier to be updated is a common object identifier), step S1405 is executed.
[0264] S1405, the storage module of the blockchain node determines a reference cache device that matches the identifier of the object to be updated in the cache system.
[0265] S1406, the reference cache device of the blockchain node determines whether it contains the current object identifier to be updated.
[0266] If yes, execute step S1413; if no, execute step S1407.
[0267] S1407, the blockchain node adds the identifier of the object to be updated in the reference cache device.
[0268] S1408, the blockchain node determines whether the reference cache device meets the device splitting conditions.
[0269] Determining whether the reference cache device meets the device splitting condition refers to determining whether the number of object identifiers stored in the reference cache device reaches a first threshold. If the number of object identifiers stored in the reference cache device is greater than or equal to the first threshold, it can be determined that the reference cache device meets the device splitting condition. If the number of object identifiers stored in the reference cache device is less than the first threshold, it can be determined that the reference cache device does not meet the device splitting condition. If so, step S1409 is executed; if not, step S1413 is executed.
[0270] S1409, the blockchain node splits the object identifiers in the reference cache device into a first object identifier set and a second object identifier set.
[0271] S1410: The blockchain node creates a first cache device and a second cache device, asynchronously writes the first object identifier set to the first cache device, and asynchronously writes the second object identifier set to the second cache device.
[0272] Asynchronous writing means: before the writing of the first cache device and the second cache device is completed, if it is necessary to perform an object identification existence determination in the reference cache device, the object identification existence determination in the reference cache device remains unchanged; after the writing of the first cache device and the second cache device is completed, the reference cache device is deleted, and if it is necessary to perform an object identification existence determination in the reference cache device, the object identification existence determination is performed in the first cache device or the second cache device.
[0273] S1411, after the blockchain node is written, the reference cache device is deleted.
[0274] S1412, the blockchain node deploys the first cache device and the second cache device in a tree-shaped hierarchical structure, with reference to the next level of the level where the cache device is located.
[0275] 1413. The storage module of the blockchain node determines whether the current object identifier to be updated is the last object identifier to be updated in the current write set.
[0276] If yes, execute step S1414; if no, execute step S1404.
[0277] S1414: The storage module of the blockchain node determines whether the current write set is the last write set.
[0278] If so, the update ends; if not, execute step S1404.
[0279] In the embodiments of the present application, the multi-level cache device can automatically adjust its structure according to the usage pattern and frequency of the object identifier. This adaptive capability allows the cache device to more accurately reflect the current workload, thereby reducing the misjudgment rate. When the cache device reaches a certain capacity threshold, it will automatically adjust to maintain the efficiency and accuracy of the cache device. The design of the multi-level cache device also facilitates the future expansion of the blockchain network because it can dynamically adjust the number of layers and capacity of the cache devices in the cache system according to the actual needs of the blockchain network, adapting to blockchain networks of different sizes.
[0280] The above describes in detail the method of the embodiment of the present application. In order to facilitate better implementation of the above scheme of the embodiment of the present application, the device of the embodiment of the present application is provided below accordingly.
[0281] See Figure 15 , Figure 15This is a structural diagram of a data processing device based on a blockchain network provided in an embodiment of the present application. The data processing device based on a blockchain network can be set in the computer device provided in an embodiment of the present application. The computer device can be any blockchain node in the blockchain network. Figure 15 The data processing device based on the blockchain network shown can be a computer program running on a computer device, and the data processing device based on the blockchain network can be used to execute Figure 5 or Figure 7 Some or all of the steps in the method embodiment shown. Figure 15 , the data processing device based on the blockchain network may include the following units:
[0282] The acquisition unit 1501 is used to acquire a business processing request, where the business processing request is used to request business processing on a business object;
[0283] The acquisition unit 1501 is further configured to acquire a cache system associated with the blockchain network, the cache system being configured to store identifiers of objects on the blockchain network; the cache system comprising a plurality of cache devices in a hierarchical relationship, the plurality of cache devices storing identifiers of objects on the blockchain hierarchically according to a hierarchical storage rule;
[0284] Processing unit 1502 is configured to determine, in the cache system, a target cache device that matches the object identifier of the business object according to the hierarchical storage rule;
[0285] The processing unit 1502 is further configured to determine the existence of the object identifier of the business object in the target cache device;
[0286] The processing unit 1502 is further configured to perform business processing on the business object according to the determination result.
[0287] In one implementation, the hierarchical relationship of the plurality of cache devices means that the plurality of cache devices are organized in a tree-like hierarchical structure; the tree-like hierarchical structure includes one or more root nodes at a first level, each root node supports differentiation as a parent node into a child node at a next level, and the child node supports further differentiation; during the differentiation process, the child node inherits the node identifier of the parent node and adds its own node identifier;
[0288] Each terminal child node in the tree-like hierarchical structure corresponds to a cache device, and the device identifier of any cache device is the node identifier of the terminal child node corresponding to the cache device;
[0289] The hierarchical storage rule means that the chained object identifier is stored in the cache device corresponding to the device identifier that matches the chained object identifier.
[0290] In one implementation, both the device identifier and the object identifier are composed of characters; the hierarchical storage rule defines a matching direction between the device identifier and the object identifier; and the processing unit 1502 is configured to, in accordance with the hierarchical storage rule, determine, in the cache system, a target cache device that matches the object identifier of the business object, by performing the following steps:
[0291] performing character matching on the object identifier of the business object and the device identifiers of the plurality of cache devices according to the matching direction;
[0292] The cache device corresponding to the target device identifier in the cache system is determined as the target cache device that matches the object identifier of the business object; the target device identifier is a device identifier among the device identifiers of multiple cache devices, and the characters in the object identifier of the business object completely match the characters.
[0293] In one implementation, the business processing request includes a block to be uploaded to the chain; the processing unit 1502 is further configured to perform the following steps:
[0294] After the block to be chained passes the consensus of the blockchain network, the identifier of the object to be updated in the block to be chained is obtained and the identifier of the object to be updated needs to be updated in the cache system;
[0295] According to the hierarchical storage rule, determining, in the cache system, a reference cache device that matches the identifier of the object to be updated;
[0296] Update the identifier of the object to be updated in the reference cache device.
[0297] In one implementation, the processing unit 1502 is configured to update the identifier of the object to be updated in the reference cache device by performing the following steps:
[0298] When the object identifier to be updated needs to be added to the reference cache device, a common check is performed on the object identifier to be updated; if the object identifier to be updated is a common object identifier and the object identifier to be updated does not exist in the reference cache device, the object identifier to be updated is added to the reference cache device;
[0299] When the object identifier to be updated needs to be deleted from the reference cache device, if the object identifier to be updated exists in the reference cache device, the object identifier to be updated is deleted from the reference cache device.
[0300] In one implementation, the processing unit 1502 is further configured to perform the following steps after adding the identifier of the object to be updated to the reference cache device:
[0301] Performing a device split check on the reference cache device;
[0302] If the reference cache device meets the device splitting condition, splitting the object identifiers stored in the reference cache device into a first object identifier set and a second object identifier set;
[0303] Creating a first cache device, and writing object identifiers in a first object identifier set into the first cache device; and creating a second cache device, and writing object identifiers in a second object identifier set into the second cache device;
[0304] In the tree-shaped hierarchical structure, the first cache device and the second cache device are located at a level below the level where the reference cache device is located.
[0305] In one implementation, the processing unit 1502 is further configured to perform the following steps:
[0306] Before writing is completed in the first cache device and the second cache device, if it is necessary to perform an object identifier existence determination in the reference cache device, the object identifier existence determination in the reference cache device remains unchanged;
[0307] After writing is completed in the first cache device and the second cache device, the reference cache device is deleted. If an object identifier existence determination is required in the reference cache device, the object identifier existence determination is performed in the first cache device or the second cache device.
[0308] In one implementation, after deleting the identifier of the object to be updated from the reference cache device, the processing unit 1502 is further configured to perform the following steps:
[0309] Performing a device reconstruction check on the reference cache device;
[0310] If the reference cache device meets the device reconstruction condition, the reference cache device is reconstructed.
[0311] In one implementation, the processing unit 1502 is configured to perform the following steps when reconstructing the reference cache device:
[0312] Determine an associated cache device of the reference cache device; the associated cache device is a cache device in the cache system that belongs to the same parent node as the reference cache device;
[0313] If the associated cache device meets the device reconstruction condition, the reference cache device and the associated cache device are reconstructed into a new cache device.
[0314] In one implementation, the processing unit 1502 is further configured to perform the following steps:
[0315] Performing common checks on object identities in multiple cache devices;
[0316] Deleting infrequently used object identifiers in a plurality of cache devices;
[0317] After deleting the infrequently used object identifier, if there is a cache device that meets the device reconstruction condition, the cache device that meets the device reconstruction condition is reconstructed.
[0318] In one implementation, the business processing request includes a block to be uploaded to the chain, the block to be uploaded to the chain includes a transaction to be executed, and the transaction to be executed is used to perform business processing on the business object; the processing unit 1502 is further used to perform the following steps:
[0319] Call the smart contract corresponding to the pending transaction to execute the pending transaction; the smart contract includes multiple execution statements;
[0320] During the execution of a smart contract, if the current execution statement of the smart contract is an existence judgment statement, and the judgment object of the existence judgment statement is a business object, the execution is triggered to obtain the cache system associated with the blockchain network.
[0321] In one implementation, the smart contract is executed by calling a contract process; the contract process communicates with multiple cache devices via an interactive protocol; and the processing unit 1502 is further configured to perform the following steps:
[0322] The contract process sends an existence determination request to the target cache device through the interactive protocol;
[0323] The processing unit 1502 is configured to perform the following steps when determining the existence of the object identifier of the business object in the target cache device:
[0324] The target cache device responds to the existence determination request and performs an existence determination on the object identifier of the business object in the target cache device.
[0325] In one implementation, the business processing request includes a block to be uploaded to the chain, the block to be uploaded to the chain includes a transaction to be executed, and executing the transaction to be executed is used to perform business processing on the business object; the blockchain network includes two types of blockchain nodes: a master node and a slave node; the processing unit 1502 is further used to perform the following steps:
[0326] Determine the transaction execution result of the pending transaction based on the business processing result of the business object;
[0327] If the method is executed by the master node, the transaction execution results of the pending transaction are packaged into the block to be on-chain to obtain the block to be verified; the block to be verified is sent to the slave node for block verification;
[0328] If the method is executed by a slave node, the block to be chained also carries the transaction execution result of the transaction to be executed. The transaction execution result obtained by executing the transaction to be executed is compared with the transaction execution result carried in the block to be chained, and block verification is performed on the block to be chained.
[0329] According to one embodiment of the present application, Figure 15 The various units in the data processing device based on the blockchain network shown can be individually or all merged into one or several other units to constitute, or one (or some) of the units can be further divided into multiple smaller functional units to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In actual applications, the functions of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present application, the data processing device based on the blockchain network may also include other units. In actual applications, these functions can also be implemented with the assistance of other units and can be implemented by collaboration of multiple units.
[0330] According to another embodiment of the present application, the program can be executed by running on a general computing device such as a computer including a central processing unit (CPU), a random access memory (RAM), a read-only memory (ROM) and other processing elements and storage elements. Figure 5 or Figure 7 A computer program for each step involved in part or all of the method shown is constructed as follows Figure 15 The data processing device based on the blockchain network shown in the embodiment of the present application is used to implement the data processing method based on the blockchain network. The computer program can be recorded on a computer-readable storage medium, for example, and loaded into the computing device via the computer-readable storage medium and run therein.
[0331] In the embodiment of the present application, a cache system is set up specifically for storing the object identifiers that have been put on the chain. When it is necessary to make an existence determination on the object identifier of the business object in the process of processing a business processing request, the cache system can be directly accessed to make an existence determination on the object identifier of the business object in the cache system without accessing the underlying state database. The query efficiency of the cache system is higher than the query efficiency of the database, which can improve the efficiency of the existence determination of the object identifier, thereby improving the efficiency of business processing. In addition, the multiple cache devices in the cache system store the object identifiers that have been put on the chain hierarchically according to the hierarchical storage rules. When making an existence determination, the existence determination can be made in the cache device that matches the object identifier of the business object without accessing the entire cache system, thereby reducing the workload of the existence determination. This can further improve the efficiency of the existence determination of the object identifier, thereby further improving the efficiency of business processing.
[0332] Based on the above method and device embodiments, the present application provides a computer device. Figure 16 , Figure 16It is a structural diagram of a computer device provided in an embodiment of the present application. Figure 16 The computer device shown includes at least a processor 1601, an input interface 1602, an output interface 1603, and a computer-readable storage medium 1604. The processor 1601, the input interface 1602, the output interface 1603, and the computer-readable storage medium 1604 may be connected via a bus or other means.
[0333] Computer-readable storage medium 1604 may be stored in a memory of a computer device. Computer-readable storage medium 1604 is used to store a computer program, which includes computer instructions. Processor 1601 is used to execute the computer program stored in computer-readable storage medium 1604. Processor 1601 (or CPU (Central Processing Unit)) is the computing and control core of the computer device and is suitable for implementing computer programs, specifically loading and executing computer programs to implement corresponding method processes or corresponding functions.
[0334] The embodiment of the present application also provides a computer-readable storage medium (Memory), which is a memory device in a computer device for storing programs and data. It is understandable that the computer-readable storage medium here can include both built-in storage media in the computer device and, of course, extended storage media supported by the computer device. The computer-readable storage medium provides a storage space that stores the operating system of the computer device. In addition, a computer program suitable for being loaded and executed by the processor is also stored in the storage space. It should be noted that the computer-readable storage medium here can be a high-speed RAM memory or a non-volatile memory (Non-Volatile Memory), such as at least one disk memory; optionally, it can also be at least one computer-readable storage medium located away from the aforementioned processor.
[0335] The computer device can be any blockchain node in the blockchain network. In a specific implementation, the processor 1601 can load and execute the computer program stored in the computer-readable storage medium 1604 to implement the above-mentioned Figure 5 Or the corresponding steps in the data processing method based on the blockchain network shown in 7. In a specific implementation, the computer program in the computer-readable storage medium 1604 is loaded by the processor 1601 and executes the following steps:
[0336] Get the business processing request, which is used to request business processing on the business object;
[0337] Obtaining a cache system associated with the blockchain network, the cache system being configured to store identifiers of objects on the blockchain network; the cache system comprising a plurality of cache devices in a hierarchical relationship, the plurality of cache devices storing identifiers of objects on the blockchain hierarchically according to a hierarchical storage rule;
[0338] Determining, in the cache system, a target cache device that matches the object identifier of the business object according to the hierarchical storage rule;
[0339] In the target cache device, determining the existence of the object identifier of the business object;
[0340] Perform business processing on the business object based on the judgment result.
[0341] In one implementation, the hierarchical relationship of the plurality of cache devices means that the plurality of cache devices are organized in a tree-like hierarchical structure; the tree-like hierarchical structure includes one or more root nodes at a first level, each root node supports differentiation as a parent node into a child node at a next level, and the child node supports further differentiation; during the differentiation process, the child node inherits the node identifier of the parent node and adds its own node identifier;
[0342] Each terminal child node in the tree-like hierarchical structure corresponds to a cache device, and the device identifier of any cache device is the node identifier of the terminal child node corresponding to the cache device;
[0343] The hierarchical storage rule means that the chained object identifier is stored in the cache device corresponding to the device identifier that matches the chained object identifier.
[0344] In one implementation, the device identifier and the object identifier are both composed of characters; the hierarchical storage rule defines a matching direction between the device identifier and the object identifier; and the computer program in the computer-readable storage medium 1604 is loaded and executed by the processor 1601 to perform the following steps when determining, in the cache system, a target cache device that matches the object identifier of a business object according to the hierarchical storage rule:
[0345] performing character matching on the object identifier of the business object and the device identifiers of the plurality of cache devices according to the matching direction;
[0346] The cache device corresponding to the target device identifier in the cache system is determined as the target cache device that matches the object identifier of the business object; the target device identifier is a device identifier among the device identifiers of multiple cache devices, and the characters in the object identifier of the business object completely match the characters.
[0347] In one implementation, the business processing request includes a block to be uploaded to the blockchain; the computer program in the computer-readable storage medium 1604 is loaded by the processor 1601 and further configured to perform the following steps:
[0348] After the block to be chained passes the consensus of the blockchain network, the identifier of the object to be updated in the block to be chained is obtained and the identifier of the object to be updated needs to be updated in the cache system;
[0349] According to the hierarchical storage rule, determining, in the cache system, a reference cache device that matches the identifier of the object to be updated;
[0350] Update the identifier of the object to be updated in the reference cache device.
[0351] In one implementation, when the computer program in the computer-readable storage medium 1604 is loaded and executed by the processor 1601 to update the identifier of the object to be updated into the reference cache device, the computer program is specifically configured to perform the following steps:
[0352] When the object identifier to be updated needs to be added to the reference cache device, a common check is performed on the object identifier to be updated; if the object identifier to be updated is a common object identifier and the object identifier to be updated does not exist in the reference cache device, the object identifier to be updated is added to the reference cache device;
[0353] When the object identifier to be updated needs to be deleted from the reference cache device, if the object identifier to be updated exists in the reference cache device, the object identifier to be updated is deleted from the reference cache device.
[0354] In one implementation, the computer program in the computer-readable storage medium 1604 is loaded and executed by the processor 1601, and after adding the identifier of the object to be updated to the reference cache device, is further configured to perform the following steps:
[0355] Performing a device split check on the reference cache device;
[0356] If the reference cache device meets the device splitting condition, splitting the object identifiers stored in the reference cache device into a first object identifier set and a second object identifier set;
[0357] Creating a first cache device, and writing object identifiers in a first object identifier set into the first cache device; and creating a second cache device, and writing object identifiers in a second object identifier set into the second cache device;
[0358] In the tree-shaped hierarchical structure, the first cache device and the second cache device are located at a level below the level where the reference cache device is located.
[0359] In one implementation, the computer program in the computer-readable storage medium 1604 is loaded by the processor 1601 and is further configured to perform the following steps:
[0360] Before writing is completed in the first cache device and the second cache device, if it is necessary to perform an object identifier existence determination in the reference cache device, the object identifier existence determination in the reference cache device remains unchanged;
[0361] After writing is completed in the first cache device and the second cache device, the reference cache device is deleted. If an object identifier existence determination is required in the reference cache device, the object identifier existence determination is performed in the first cache device or the second cache device.
[0362] In one implementation, the computer program in the computer-readable storage medium 1604 is loaded and executed by the processor 1601, and after deleting the identifier of the object to be updated from the reference cache device, is further configured to perform the following steps:
[0363] Performing a device reconstruction check on the reference cache device;
[0364] If the reference cache device meets the device reconstruction condition, the reference cache device is reconstructed.
[0365] In one implementation, when the computer program in the computer-readable storage medium 1604 is loaded and executed by the processor 1601 to perform reconstruction processing on the reference cache device, the computer program is specifically configured to perform the following steps:
[0366] Determine an associated cache device of the reference cache device; the associated cache device is a cache device in the cache system that belongs to the same parent node as the reference cache device;
[0367] If the associated cache device meets the device reconstruction condition, the reference cache device and the associated cache device are reconstructed into a new cache device.
[0368] In one implementation, the computer program in the computer-readable storage medium 1604 is loaded by the processor 1601 and is further configured to perform the following steps:
[0369] Performing common checks on object identities in multiple cache devices;
[0370] Deleting infrequently used object identifiers in a plurality of cache devices;
[0371] After deleting the infrequently used object identifier, if there is a cache device that meets the device reconstruction condition, the cache device that meets the device reconstruction condition is reconstructed.
[0372] In one implementation, the business processing request includes a block to be uploaded, the block to be uploaded includes a transaction to be executed, and the transaction to be executed is used to perform business processing on the business object; the computer program in the computer-readable storage medium 1604 is loaded by the processor 1601 and is further used to perform the following steps:
[0373] Call the smart contract corresponding to the pending transaction to execute the pending transaction; the smart contract includes multiple execution statements;
[0374] During the execution of a smart contract, if the current execution statement of the smart contract is an existence judgment statement, and the judgment object of the existence judgment statement is a business object, the execution is triggered to obtain the cache system associated with the blockchain network.
[0375] In one implementation, a smart contract is executed by a contract process; the contract process communicates with multiple cache devices via an interactive protocol; and a computer program in a computer-readable storage medium 1604 is loaded by a processor 1601 and further configured to execute the following steps:
[0376] The contract process sends an existence determination request to the target cache device through the interactive protocol;
[0377] The computer program in the computer-readable storage medium 1604 is loaded by the processor 1601 and executed in the target cache device. When determining the existence of the object identifier of the business object, the computer program is specifically configured to perform the following steps:
[0378] The target cache device responds to the existence determination request and performs an existence determination on the object identifier of the business object in the target cache device.
[0379] In one implementation, a business processing request includes a block to be uploaded to the blockchain, the block to be uploaded to the blockchain includes a transaction to be executed, and executing the transaction to be executed is used to perform business processing on the business object; the blockchain network includes two types of blockchain nodes: a master node and a slave node; the computer program in the computer-readable storage medium 1604 is loaded by the processor 1601 and is further used to perform the following steps:
[0380] Determine the transaction execution result of the pending transaction based on the business processing result of the business object;
[0381] If the method is executed by the master node, the transaction execution results of the pending transaction are packaged into the block to be on-chain to obtain the block to be verified; the block to be verified is sent to the slave node for block verification;
[0382] If the method is executed by a slave node, the block to be chained also carries the transaction execution result of the transaction to be executed. The transaction execution result obtained by executing the transaction to be executed is compared with the transaction execution result carried in the block to be chained, and block verification is performed on the block to be chained.
[0383] In the embodiment of the present application, a cache system is set up specifically for storing the object identifiers that have been put on the chain. When it is necessary to make an existence determination on the object identifier of the business object in the process of processing a business processing request, the cache system can be directly accessed to make an existence determination on the object identifier of the business object in the cache system without accessing the underlying state database. The query efficiency of the cache system is higher than the query efficiency of the database, which can improve the efficiency of the existence determination of the object identifier, thereby improving the efficiency of business processing. In addition, the multiple cache devices in the cache system store the object identifiers that have been put on the chain hierarchically according to the hierarchical storage rules. When making an existence determination, the existence determination can be made in the cache device that matches the object identifier of the business object without accessing the entire cache system, thereby reducing the workload of the existence determination. This can further improve the efficiency of the existence determination of the object identifier, thereby further improving the efficiency of business processing.
[0384] The present application also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the aforementioned blockchain network-based data processing method.
[0385] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0386] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0387] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted via a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0388] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. A data processing method based on a blockchain network, characterized in that: include: Obtaining a business processing request, wherein the business processing request is used to request business processing for a business object; Obtaining a cache system associated with the blockchain network, the cache system being configured to store identifiers of objects on the blockchain network; the cache system comprising a plurality of cache devices in a hierarchical relationship, the plurality of cache devices storing the identifiers of objects on the blockchain hierarchically according to a hierarchical storage rule; Determining, in the cache system, a target cache device that matches the object identifier of the business object according to the hierarchical storage rule; In the target cache device, performing an existence determination on the object identifier of the business object; Perform business processing on the business object according to the determination result.
2. The method according to claim 1, wherein The plurality of cache devices having a hierarchical relationship means that the plurality of cache devices are organized according to a tree-like hierarchical structure; the tree-like hierarchical structure includes one or more root nodes at a first level, each root node supporting differentiation as a parent node into child nodes at a next level, and the child nodes supporting further differentiation; During the differentiation process, the child node inherits the node identifier of the parent node and adds the node identifier of the child node itself; Each terminal child node in the tree-shaped hierarchical structure corresponds to one of the cache devices, and the device identifier of any of the cache devices is the node identifier of the terminal child node corresponding to the cache device; The hierarchical storage rule means that the chained object identifier is stored in a cache device corresponding to a device identifier that matches the chained object identifier.
3. The method according to claim 2, wherein The device identifier and the object identifier are both composed of characters; the hierarchical storage rule defines the matching direction between the device identifier and the object identifier; Determining, in the cache system according to the hierarchical storage rule, a target cache device that matches the object identifier of the business object includes: performing character matching on the object identifier of the business object and the device identifiers of the plurality of cache devices according to the matching direction; The cache device corresponding to the target device identifier in the cache system is determined as the target cache device that matches the object identifier of the business object; the target device identifier is a device identifier among the device identifiers of the multiple cache devices, and the characters of the device identifier completely match the characters in the object identifier of the business object.
4. The method according to claim 2, wherein The business processing request includes a block to be uploaded to the chain; the method further includes: After the block to be chained passes the consensus of the blockchain network, obtaining the identifier of the object to be updated in the block to be chained, and the identifier of the object to be updated needs to be updated in the cache system; According to the hierarchical storage rule, determining, in the cache system, a reference cache device that matches the identifier of the object to be updated; The identifier of the object to be updated is updated in the reference cache device.
5. The method according to claim 4, wherein The updating of the identifier of the object to be updated into the reference cache device includes: When the to-be-updated object identifier needs to be added to the reference cache device, a common check is performed on the to-be-updated object identifier; if the to-be-updated object identifier is a common object identifier and the to-be-updated object identifier does not exist in the reference cache device, the to-be-updated object identifier is added to the reference cache device; When the to-be-updated object identifier needs to be deleted from the reference cache device, if the to-be-updated object identifier exists in the reference cache device, the to-be-updated object identifier is deleted from the reference cache device.
6. The method according to claim 5, wherein After adding the identifier of the object to be updated to the reference cache device, the method further includes: performing a device split check on the reference cache device; If the reference cache device meets the device splitting condition, splitting the object identifiers stored in the reference cache device into a first object identifier set and a second object identifier set; Creating a first cache device, and writing object identifiers in the first object identifier set into the first cache device; and creating a second cache device, and writing object identifiers in the second object identifier set into the second cache device; Wherein, in the tree-shaped hierarchical structure, the first cache device and the second cache device are located at a level below the level where the reference cache device is located.
7. The method according to claim 6, wherein The method further comprises: Before writing is completed in the first cache device and the second cache device, if it is necessary to perform an object identifier existence determination in the reference cache device, the object identifier existence determination in the reference cache device remains unchanged; After writing is completed in the first cache device and the second cache device, the reference cache device is deleted. If an object identifier existence determination is required in the reference cache device, the object identifier existence determination is performed in the first cache device or the second cache device.
8. The method according to claim 5, wherein After deleting the identifier of the object to be updated from the reference cache device, the method further includes: performing a device reconstruction check on the reference cache device; If the reference cache device meets the device reconstruction condition, the reference cache device is reconstructed.
9. The method according to claim 8, wherein The reconstructing the reference cache device includes: Determining an associated cache device of the reference cache device; the associated cache device is a cache device in the cache system that belongs to the same parent node as the reference cache device; If the associated cache device meets the device reconstruction condition, the reference cache device and the associated cache device are reconstructed into a new cache device.
10. The method according to claim 1 or 2, wherein: The method further comprises: performing a common check on the object identifiers in the plurality of cache devices; Deleting infrequently used object identifiers in the plurality of cache devices; After deleting the infrequently used object identifier, if there is a cache device that meets the device reconstruction condition, the cache device that meets the device reconstruction condition is reconstructed.
11. The method according to claim 1, wherein The business processing request includes a block to be uploaded to the chain, the block to be uploaded to the chain includes a transaction to be executed, and the transaction to be executed is executed to perform business processing on the business object; the method further includes: Calling the smart contract corresponding to the pending transaction to execute the pending transaction; the smart contract includes multiple execution statements; During the execution of the smart contract, if the current execution statement of the smart contract is an existence determination statement, and the determination object of the existence determination statement is the business object, then the execution of the cache system associated with the blockchain network is triggered.
12. The method according to claim 1, wherein The smart contract is called and executed by the contract process; The contract process communicates with the plurality of cache devices via an interactive protocol; the method further comprising: The contract process sends an existence determination request to the target cache device through the interactive protocol; The step of determining the existence of the object identifier of the business object in the target cache device includes: The target cache device responds to the existence determination request and performs an existence determination on the object identifier of the business object in the target cache device.
13. The method according to claim 1, wherein The business processing request includes a block to be uploaded to the chain, the block to be uploaded to the chain includes a transaction to be executed, and the transaction to be executed is executed to perform business processing on the business object; the blockchain network includes two types of blockchain nodes: a master node and a slave node; the method further includes: Determining a transaction execution result of the pending transaction according to a business processing result of the business object; If the method is executed by the master node, the transaction execution result of the to-be-executed transaction is packaged into the to-be-on-chain block to obtain a to-be-verified block; and the to-be-verified block is sent to the slave node for block verification; If the method is executed by the slave node, the block to be chained also carries the transaction execution result of the transaction to be executed. The transaction execution result obtained by executing the transaction to be executed is compared with the transaction execution result carried in the block to be chained, and block verification is performed on the block to be chained.
14. A data processing device based on a blockchain network, characterized in that: include: An acquiring unit, configured to acquire a business processing request, wherein the business processing request is used to request business processing to be performed on a business object; The acquisition unit is further configured to acquire a cache system associated with the blockchain network, the cache system being configured to store identifiers of objects that have been put on the blockchain in the blockchain network; the cache system comprising a plurality of cache devices having a hierarchical relationship, the plurality of cache devices storing the identifiers of objects that have been put on the blockchain hierarchically according to a hierarchical storage rule; a processing unit, configured to determine, in the cache system, a target cache device that matches the object identifier of the business object according to the hierarchical storage rule; The processing unit is further configured to perform an existence determination on the object identifier of the business object in the target cache device; The processing unit is further configured to perform business processing on the business object according to the determination result.
15. A computer device, characterized in that: The computer device comprises: a processor suitable for implementing a computer program; A computer-readable storage medium storing a computer program, wherein the computer program is suitable for being loaded by the processor and executing the data processing method based on the blockchain network according to any one of claims 1 to 13.
16. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which is suitable for being loaded by a processor and executing the data processing method based on a blockchain network according to any one of claims 1 to 13.
17. A computer program product, characterized in that The computer program product includes a computer program, which, when executed by a processor, implements the data processing method based on the blockchain network according to any one of claims 1 to 13.