Blockchain transaction processing method, device and computer-readable storage medium

By setting up multiple transaction storage pools and metadata management services in the blockchain nodes, the problem of insufficient scalability of transaction pools in the blockchain system is solved, and the system performance and accuracy of transaction data are improved.

CN113986922BActive Publication Date: 2025-04-25WEBANK (CHINA)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111260228.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-28
Publication Date
2025-04-25
Estimated Expiration
2041-10-28

AI Technical Summary

Technical Problem

The scalability of setting up a transaction pool in a blockchain node is insufficient, which limits the performance of the entire blockchain system.

Method used

Multiple transaction storage pools are set up in the blockchain node, and a metadata management service and a storage module are equipped. The received transaction data is allocated to the target transaction storage pool, and the metadata of the transaction data is submitted separately to the metadata management service.

Benefits of technology

Through the setting of multiple transaction storage pools and the use of metadata management services, the performance of the blockchain system is improved, the problem of insufficient scalability of transaction pools is solved, and the accuracy of transaction data and on-chain efficiency are ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113986922B_ABST
    Figure CN113986922B_ABST
Patent Text Reader

Abstract

The present invention discloses a blockchain transaction processing method, device and computer-readable storage medium, the method comprising: assigning transaction data to a target transaction storage pool; extracting metadata of the transaction data, submitting the metadata to a metadata management service; storing the metadata in a metadata storage table, and storing the transaction data in a storage module; packaging multiple metadata from the metadata storage table to obtain a consensus block, and broadcasting the consensus block to each blockchain node, so that each second blockchain node can reach a consensus on the consensus block; obtaining transaction data corresponding to the metadata from the corresponding transaction storage pool according to the metadata, executing each transaction data to obtain an execution result, and after detecting that the consensus block consensus is successful, storing the execution result and the consensus block in the storage module to complete the chaining of each transaction data. The present invention solves the technical problem that the performance of the entire blockchain system is limited due to the insufficient scalability of the transaction pool.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain technology, and in particular to a blockchain transaction processing method, device and computer-readable storage medium. Background Art

[0002] Due to the superior characteristics of blockchain, such as distribution, tamper-proof, and traceability, blockchain technology is widely used in all walks of life. Blockchain is a chain composed of a series of blocks. In addition to recording the data of the current block, each block also records the hash value of the previous block, forming a chain in this way. At present, there is generally only one transaction pool set up in the blockchain node, which is responsible for the verification, storage, deletion of transaction data on the chain, synchronization of transaction data, etc. Due to the lack of scalability of the transaction pool, the performance of the entire blockchain system will be limited. Summary of the invention

[0003] The main purpose of the present invention is to provide a blockchain transaction processing method, device and computer-readable storage medium, aiming to solve the technical problem that the current blockchain node sets a transaction pool, which limits the performance of the entire blockchain system due to insufficient scalability of the transaction pool.

[0004] To achieve the above object, the present invention provides a blockchain transaction processing method, which is applied to a first blockchain node, wherein the first blockchain node includes multiple transaction storage pools, and includes a metadata management service and a storage module corresponding to the multiple transaction storage pools, and the method includes the following steps:

[0005] receiving first transaction data, determining a target transaction storage pool from the plurality of transaction storage pools, and allocating the first transaction data to the target transaction storage pool;

[0006] Extracting first metadata of the first transaction data, and submitting the first metadata to the metadata management service, wherein the first metadata includes a first transaction hash of the first transaction data and an ID of the target transaction storage pool;

[0007] When the first transaction data is verified by the target transaction storage pool and the first metadata is verified by the metadata management service, the first metadata is stored in the metadata storage table by the metadata management service, and the first transaction data is stored in the storage module by the target transaction storage pool;

[0008] When the first blockchain node serves as a consensus master node, the first consensus block is obtained by accessing the metadata management service to package multiple second metadata from the metadata storage table, and the first consensus block is broadcast to each second blockchain node, so that each second blockchain node can reach a consensus on the first consensus block;

[0009] According to the second metadata, second transaction data corresponding to the second metadata is obtained from the corresponding transaction storage pool, each second transaction data is executed to obtain a first execution result, and after detecting that the first consensus block consensus is successful, the first execution result and the first consensus block are stored in the storage module to complete the chaining of each second transaction data.

[0010] Optionally, the step of determining a target transaction storage pool from the multiple transaction storage pools includes:

[0011] Calculating the first transaction hash of the first transaction data, and taking the modulus of the first transaction hash and the number of the transaction storage pools in the first blockchain node to obtain a modulus result;

[0012] The transaction storage pool whose ID is the remainder result in each of the transaction storage pools is used as the target transaction storage pool.

[0013] Optionally, after the first transaction data is verified by the target transaction storage pool and the first metadata is verified by the metadata management service, before the step of storing the first metadata in a metadata storage table by the metadata management service and storing the first transaction data in the storage module by the target transaction storage pool, the step further includes:

[0014] When the target transaction storage pool is allocated the first transaction data, the first transaction data is cached by the target transaction storage pool;

[0015] Performing a verification operation on the cached first transaction data through the target transaction storage pool, and sending the verification result to the metadata management service, wherein the verification operation includes a repeatability verification operation and a signature verification operation, and when both the repeatability verification operation and the signature verification operation are passed, it indicates that the first transaction data has passed the verification;

[0016] When the metadata management service is submitted with the first metadata, the first metadata is cached in a candidate metadata cache table through the metadata management service;

[0017] When the metadata management service receives a verification result indicating that the first transaction data has passed verification, and the first metadata has passed repeated verification through the metadata management service, the steps of storing the first metadata in the metadata storage table through the metadata management service and storing the first transaction data in the storage module through the target transaction storage pool are executed.

[0018] Optionally, after the step of performing a verification operation on the cached first transaction data through the target transaction storage pool and sending the verification result to the metadata management service, the step further includes:

[0019] When the verification result indicates that the first transaction data verification fails, deleting the cached first transaction data through the target transaction storage pool;

[0020] After the step of caching the first metadata to the candidate metadata cache table through the metadata management service when the first metadata is submitted to the metadata management service, the method further includes:

[0021] When the metadata management service receives a verification result indicating that the verification of the first transaction data fails, deleting the first metadata in the candidate metadata cache table through the metadata management service;

[0022] When the metadata management service receives a verification result indicating that the first transaction data has passed verification, and repeated verification of the first metadata through the metadata management service fails, the first metadata in the alternative metadata cache table is deleted through the metadata management service, and the target transaction storage pool is notified through the metadata management service to delete the cached first transaction data.

[0023] Optionally, when the first blockchain node serves as a non-consensus master node, the method further includes:

[0024] When receiving the second consensus block broadcasted by the second blockchain node, decoding the third transaction hash in the second consensus block;

[0025] Determine, by accessing the metadata management service, whether the metadata storage table stores third metadata corresponding to the third transaction hash;

[0026] If the third metadata is stored in the metadata storage table, the third transaction data corresponding to the third metadata is obtained from the corresponding transaction storage pool according to the third metadata, the third transaction data is executed to obtain the second execution result, and after detecting that the second consensus block consensus is successful, the second execution result and the second consensus block are stored in the storage module to complete the uploading of the third transaction data to the chain;

[0027] If the third metadata is not stored in the metadata storage table, requesting the second blockchain node to obtain the third transaction data corresponding to the third transaction hash;

[0028] If the third transaction data is obtained from the second blockchain node, the third transaction data is executed to obtain the second execution result, and after detecting that the second consensus block consensus is successful, the third transaction data, the second execution result and the second consensus block are stored in the storage module to complete the uploading of the third transaction data to the chain;

[0029] If the third transaction data is not obtained from the second blockchain node, the second consensus block is determined to be invalid, and the second consensus block is refused to be put on the chain.

[0030] Optionally, the step of acquiring second transaction data corresponding to the second metadata from a corresponding transaction storage pool according to the second metadata includes:

[0031] Extracting a storage pool ID from the second metadata, accessing a transaction storage pool corresponding to the storage pool ID to determine a state of the transaction storage pool;

[0032] If the transaction storage pool corresponding to the storage pool ID is in a normal working state, obtaining second transaction data corresponding to the second transaction hash from the transaction storage pool corresponding to the storage pool ID according to the second transaction hash in the second metadata;

[0033] If the transaction storage pool corresponding to the storage pool ID is in a downtime state, the storage module is accessed, and second transaction data corresponding to the second metadata is obtained from the storage module according to the second transaction hash.

[0034] Optionally, the method further comprises:

[0035] When the metadata management service crashes and restarts, loading the fourth metadata from the storage module into the metadata storage table;

[0036] The metadata management service notifies the transaction storage pool corresponding to the storage pool ID in the fourth metadata to load the fourth transaction data corresponding to the fourth metadata from the storage module and cache it.

[0037] Optionally, the first blockchain node further includes at least one blockchain access module and at least one transaction synchronization module, and the step of receiving the first transaction data includes:

[0038] Receiving the first transaction data sent by the blockchain client through any one of the blockchain access modules; or receiving the first transaction data broadcasted by the second blockchain node through any one of the transaction synchronization modules;

[0039] The blockchain transaction processing method further includes:

[0040] After the first transaction data is signed and verified by the target transaction storage pool, one of the transaction synchronization modules is used to broadcast the first transaction data to each second blockchain node.

[0041] To achieve the above-mentioned objectives, the present invention also provides a blockchain transaction processing device, which includes: a memory, a processor, and a blockchain transaction processing program stored in the memory and executable on the processor, and the blockchain transaction processing program, when executed by the processor, implements the steps of the blockchain transaction processing method as described above.

[0042] In addition, to achieve the above-mentioned purpose, the present invention also proposes a computer-readable storage medium, on which a blockchain transaction processing program is stored, and when the blockchain transaction processing program is executed by a processor, the steps of the blockchain transaction processing method as described above are implemented.

[0043] In the present invention, by setting a blockchain node including multiple transaction storage pools, and including a metadata management service and a storage module corresponding to the multiple transaction storage pools, the first blockchain node assigns the received transaction data to one of the transaction storage pools for storage, and submits the metadata of the transaction data to the metadata management service separately, and includes the transaction hash of the transaction data and the ID of the transaction storage pool storing the transaction data in the metadata, so that the packaging and execution of the transaction data can be carried out according to the metadata in the metadata storage table of the metadata management service, and the transaction storage pool can be expanded and reduced as needed without affecting the packaging and execution of the transaction data, thereby solving the technical problem of limiting the performance of the entire blockchain system due to insufficient scalability of the transaction pool. Furthermore, when the transaction storage pool verifies the transaction data and the metadata management service verifies the first metadata, the metadata management service stores the first metadata in the metadata storage table, and then packages the metadata from the metadata storage table, thereby ensuring the accuracy of the transaction data on the chain; and when the transaction storage pool verifies the transaction data and the metadata management service verifies the first metadata, the target transaction storage pool stores the first transaction data in the storage module, so that when the transaction data is on the chain, only the execution result and the consensus block need to be stored in the storage module, without storing the transaction data, thereby reducing the storage pressure when the transaction data is on the chain. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 A schematic diagram of the structure of the hardware operating environment involved in the embodiment of the present invention;

[0045] Figure 2 This is a flowchart of the first embodiment of the blockchain transaction processing method of the present invention.

[0046] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0047] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0048] like Figure 1 As shown, Figure 1 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention.

[0049] It should be noted that the blockchain transaction processing device in the embodiment of the present invention can be a smart phone, a personal computer, a server and other devices, and is not specifically limited here. The blockchain transaction processing device can be deployed on a first blockchain node, and the first blockchain node includes multiple transaction storage pools, and includes a metadata management service and a storage module corresponding to the multiple transaction storage pools.

[0050] like Figure 1 As shown, the blockchain transaction processing device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0051] Those skilled in the art will understand that Figure 1 The device structure shown in the figure does not constitute a limitation on the blockchain transaction processing device, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.

[0052] like Figure 1 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a blockchain transaction processing program. The operating system is a program that manages and controls the hardware and software resources of the device and supports the operation of the blockchain transaction processing program and other software or programs. Figure 1 In the device shown, the user interface 1003 is mainly used for data communication with the client; the network interface 1004 is mainly used for establishing a communication connection with the server; and the processor 1001 can be used to call the blockchain transaction processing program stored in the memory 1005 and perform the following operations:

[0053] receiving first transaction data, determining a target transaction storage pool from the plurality of transaction storage pools, and allocating the first transaction data to the target transaction storage pool;

[0054] Extracting first metadata of the first transaction data, and submitting the first metadata to the metadata management service, wherein the first metadata includes a first transaction hash of the first transaction data and an ID of the target transaction storage pool;

[0055] When the first transaction data is verified by the target transaction storage pool and the first metadata is verified by the metadata management service, the first metadata is stored in the metadata storage table by the metadata management service, and the first transaction data is stored in the storage module by the target transaction storage pool;

[0056] When the first blockchain node serves as a consensus master node, the first consensus block is obtained by accessing the metadata management service to package multiple second metadata from the metadata storage table, and the first consensus block is broadcast to each second blockchain node, so that each second blockchain node can reach a consensus on the first consensus block;

[0057] According to the second metadata, second transaction data corresponding to the second metadata is obtained from the corresponding transaction storage pool, each second transaction data is executed to obtain a first execution result, and after detecting that the first consensus block consensus is successful, the first execution result and the first consensus block are stored in the storage module to complete the chaining of each second transaction data.

[0058] Further, determining a target transaction storage pool from the multiple transaction storage pools includes:

[0059] Calculating the first transaction hash of the first transaction data, and taking the modulus of the first transaction hash and the number of the transaction storage pools in the first blockchain node to obtain a modulus result;

[0060] The transaction storage pool whose ID is the remainder result in each of the transaction storage pools is used as the target transaction storage pool.

[0061] Further, when the first transaction data is verified by the target transaction storage pool and the first metadata is verified by the metadata management service, the first metadata is stored in the metadata storage table by the metadata management service, and before the first transaction data is stored in the storage module by the target transaction storage pool, the processor 1001 can also be used to call the blockchain transaction processing program stored in the memory 1005 to perform the following operations:

[0062] When the target transaction storage pool is allocated the first transaction data, the first transaction data is cached by the target transaction storage pool;

[0063] Performing a verification operation on the cached first transaction data through the target transaction storage pool, and sending the verification result to the metadata management service, wherein the verification operation includes a repeatability verification operation and a signature verification operation, and when both the repeatability verification operation and the signature verification operation are passed, it indicates that the first transaction data has passed the verification;

[0064] When the metadata management service is submitted with the first metadata, the first metadata is cached in a candidate metadata cache table through the metadata management service;

[0065] When the metadata management service receives a verification result indicating that the first transaction data has passed verification, and the first metadata has passed repeated verification through the metadata management service, the steps of storing the first metadata in the metadata storage table through the metadata management service and storing the first transaction data in the storage module through the target transaction storage pool are executed.

[0066] Further, after the target transaction storage pool verifies the cached first transaction data and sends the verification result to the metadata management service, the processor 1001 may also be used to call the blockchain transaction processing program stored in the memory 1005 to perform the following operations:

[0067] When the verification result indicates that the first transaction data verification fails, deleting the cached first transaction data through the target transaction storage pool;

[0068] When the metadata management service is submitted with the first metadata, after the metadata management service caches the first metadata to the candidate metadata cache table, the processor 1001 may also be used to call the blockchain transaction processing program stored in the memory 1005 to perform the following operations:

[0069] When the metadata management service receives a verification result indicating that the verification of the first transaction data fails, deleting the first metadata in the candidate metadata cache table through the metadata management service;

[0070] When the metadata management service receives a verification result indicating that the first transaction data has passed verification, and repeated verification of the first metadata through the metadata management service fails, the first metadata in the alternative metadata cache table is deleted through the metadata management service, and the target transaction storage pool is notified through the metadata management service to delete the cached first transaction data.

[0071] Further, when the first blockchain node serves as a non-consensus master node, the processor 1001 may also be used to call a blockchain transaction processing program stored in the memory 1005 to perform the following operations:

[0072] When receiving the second consensus block broadcasted by the second blockchain node, decoding the third transaction hash in the second consensus block;

[0073] Determine, by accessing the metadata management service, whether the metadata storage table stores third metadata corresponding to the third transaction hash;

[0074] If the third metadata is stored in the metadata storage table, the third transaction data corresponding to the third metadata is obtained from the corresponding transaction storage pool according to the third metadata, the third transaction data is executed to obtain the second execution result, and after detecting that the second consensus block consensus is successful, the second execution result and the second consensus block are stored in the storage module to complete the uploading of the third transaction data to the chain;

[0075] If the third metadata is not stored in the metadata storage table, requesting the second blockchain node to obtain the third transaction data corresponding to the third transaction hash;

[0076] If the third transaction data is obtained from the second blockchain node, the third transaction data is executed to obtain the second execution result, and after detecting that the second consensus block consensus is successful, the third transaction data, the second execution result and the second consensus block are stored in the storage module to complete the uploading of the third transaction data to the chain;

[0077] If the third transaction data is not obtained from the second blockchain node, the second consensus block is determined to be invalid, and the second consensus block is refused to be put on the chain.

[0078] Further, acquiring second transaction data corresponding to the second metadata from a corresponding transaction storage pool according to the second metadata includes:

[0079] Extracting a storage pool ID from the second metadata, accessing a transaction storage pool corresponding to the storage pool ID to determine a state of the transaction storage pool;

[0080] If the transaction storage pool corresponding to the storage pool ID is in a normal working state, obtaining second transaction data corresponding to the second transaction hash from the transaction storage pool corresponding to the storage pool ID according to the second transaction hash in the second metadata;

[0081] If the transaction storage pool corresponding to the storage pool ID is in a downtime state, the storage module is accessed, and second transaction data corresponding to the second metadata is obtained from the storage module according to the second transaction hash.

[0082] Furthermore, the processor 1001 may also be used to call the blockchain transaction processing program stored in the memory 1005 to perform the following operations:

[0083] When the metadata management service crashes and restarts, loading the fourth metadata from the storage module into the metadata storage table;

[0084] The metadata management service notifies the transaction storage pool corresponding to the storage pool ID in the fourth metadata to load the fourth transaction data corresponding to the fourth metadata from the storage module and cache it.

[0085] Furthermore, the first blockchain node further includes at least one blockchain access module and at least one transaction synchronization module, and the receiving the first transaction data includes:

[0086] Receiving the first transaction data sent by the blockchain client through any one of the blockchain access modules; or receiving the first transaction data broadcasted by the second blockchain node through any one of the transaction synchronization modules;

[0087] The processor 1001 may also be used to call the blockchain transaction processing program stored in the memory 1005 to perform the following operations:

[0088] After the first transaction data is signed and verified by the target transaction storage pool, one of the transaction synchronization modules is used to broadcast the first transaction data to each second blockchain node.

[0089] Based on the above structure, various embodiments of the blockchain transaction processing method are proposed.

[0090] Reference Figure 2 , Figure 2 This is a flowchart of the first embodiment of the blockchain transaction processing method of the present invention.

[0091] The embodiment of the present invention provides an embodiment of a blockchain transaction processing method. It should be noted that although the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than here. In this embodiment, the blockchain transaction processing method includes:

[0092] Step S10, receiving first transaction data, determining a target transaction storage pool from the multiple transaction storage pools, and allocating the first transaction data to the target transaction storage pool;

[0093] In this embodiment, the blockchain transaction processing method can be applied to any blockchain node in the blockchain system. In order to solve the problem of setting a transaction pool in the blockchain node and limiting the overall performance of the blockchain system, this embodiment sets multiple transaction storage pools (i.e., transaction pools) in the blockchain node, and adds a metadata management service and a storage module corresponding to the multiple transaction storage pools. To distinguish, the blockchain node as the execution subject is called the first blockchain node, and the blockchain node other than the first blockchain node is called the second blockchain node. It can be understood that a blockchain node can be used as a first blockchain node to implement the function of the first blockchain node in this embodiment, and can also be used as a second blockchain node to implement the function of the second blockchain node in this embodiment.

[0094] When the first blockchain node receives transaction data that needs to be uploaded to the chain (hereinafter referred to as the first transaction data for distinction), it can first determine a target transaction storage pool from multiple transaction storage pools (here, multiple transaction storage pools refer to multiple transaction storage pools in the first blockchain node), and assign the first transaction data to the target transaction storage pool to cache the first transaction data in the target transaction storage pool. It should be noted that the transaction storage pool is set in the memory, and caching the first transaction data in the target transaction storage pool is to cache the first transaction data in memory. Transaction data refers to data that needs to be uploaded to the chain, and the specific content contained therein is not limited in this embodiment. The first transaction data may be received from the blockchain client or from the second blockchain node.

[0095] The manner in which the first blockchain node determines the target transaction storage pool from multiple transaction storage pools is not limited in this embodiment. For example, the target transaction storage pool may be determined according to a certain load balancing strategy so that the transaction data allocated to each transaction storage pool is more balanced; for another example, a polling method may be adopted, and each time transaction data is received, the target transaction storage pool is determined according to the polling order.

[0096] Step S20, extracting first metadata of the first transaction data, and submitting the first metadata to the metadata management service, wherein the first metadata includes a first transaction hash of the first transaction data and an ID of the target transaction storage pool;

[0097] After determining the target transaction storage pool, the first blockchain node can extract the metadata of the first transaction data (hereinafter referred to as the first metadata for distinction). Among them, the first metadata may include the transaction hash of the first transaction data (hereinafter referred to as the first transaction hash for distinction) and the ID of the target transaction storage pool. In addition, optionally, the first metadata may also include other data extracted from the first transaction data, such as the random number Nonce, the transaction anti-heavy upper limit BlockLimit, etc., which are not specifically limited in this embodiment. The ID of each transaction storage module can be pre-set in the first blockchain node to uniquely distinguish each transaction storage module. The first transaction hash is obtained by the first blockchain node using a hash algorithm to hash the first transaction data. The hash algorithm is not limited in this embodiment, and a commonly used hash algorithm can be used. Due to the characteristics of the hash algorithm, the transaction hashes calculated from different transaction data are different, and the first transaction hash can be used to uniquely identify the first transaction data.

[0098] After extracting the first metadata, the first blockchain node submits the first metadata to the metadata management service so that the first metadata is cached by the metadata management service.

[0099] Step S30: when the first transaction data is verified by the target transaction storage pool and the first metadata is verified by the metadata management service, the first metadata is stored in the metadata storage table by the metadata management service, and the first transaction data is stored in the storage module by the target transaction storage pool;

[0100] After the first transaction data is assigned to the target transaction storage pool, the first transaction data can be verified through the target transaction storage pool, and the verification operation can at least include a repetitive verification operation and a signature verification operation. Among them, the repetitive verification operation can be performed by comparing the first transaction hash of the first transaction data with the transaction hash of the historically received transaction data to determine whether the same transaction data has been received. If it is determined that the same transaction data has been received, it means that the repetitive verification operation has failed. If it is determined that the same transaction data has not been received, it means that the repetitive verification operation has passed. The signature verification operation can be a conventional signature verification operation, which will not be described in detail here. When both the signature verification operation and the repetitive verification operation are verified, it can be determined that the first transaction data has been verified. When any of the verification operations fails, it can be determined that the first transaction data has failed.

[0101] After submitting the first metadata to the metadata management service, the metadata management service can perform a verification operation on the first metadata. In one embodiment, if the allocation strategy adopted by the first blockchain node makes the same transaction data always allocated to the same transaction storage pool, the metadata management service can perform a verification operation on the first metadata by: verifying whether the target transaction storage pool has received a notification that both the repetitive verification operation and the signature verification operation of the first transaction data have passed. If the notification that both verification operations have passed is received, it is determined that the first metadata verification has passed. If the notification that one of the two verification operations has failed is received, it is determined that the first metadata verification has failed. In another embodiment, in order to avoid the abnormal situation that the first transaction data is repeatedly received transaction data but the target transaction storage pool has not detected it, and the transaction data storage has an error, the metadata management service can perform a verification operation on the first metadata by performing a repetitive verification operation on the first metadata separately. Specifically, the first transaction hash in the first metadata can be compared with the transaction hash in the metadata received historically to determine whether the same metadata has been received. If it is determined that the same metadata has been received, it means that the repetitive verification operation has failed and the first metadata verification has failed. If it is determined that the same metadata has not been received, it means that the repetitive verification has passed and the first metadata verification has passed.

[0102] When both the first transaction data and the first metadata are verified, the first blockchain node can store the first metadata in the metadata storage table through the metadata management service, and store the first transaction data in the storage module through the target transaction storage pool. Among them, the metadata storage table is a data table managed by the metadata management service for storing the first metadata that has passed the verification, wherein the stored first metadata is used to be packaged into a consensus block. The storage module can be a storage module for persisting transaction data, for example, it can be implemented by back-end distributed storage. After the transaction data is verified, the transaction data is persisted to the storage module. On the one hand, it can play a pre-writing function of the transaction data and reduce the storage pressure when the subsequent block is submitted. On the other hand, it can facilitate the retrieval of transaction data after the transaction storage pool crashes, provide support for the fault recovery of the blockchain node, and improve the reliability of the entire blockchain system.

[0103] Step S40, when the first blockchain node serves as the consensus master node, the first consensus block is obtained by accessing the metadata management service to package multiple second metadata from the metadata storage table, and the first consensus block is broadcast to each second blockchain node, so that each second blockchain node can reach a consensus on the first consensus block;

[0104] In the blockchain system, each blockchain node can determine who will serve as the consensus master node according to a certain mechanism. The blockchain node that serves as the consensus master node is responsible for packaging blocks and broadcasting them to other blockchain nodes for consensus.

[0105] When the first blockchain node acts as the consensus master node, it can access the metadata management service to package multiple metadata (hereinafter referred to as the second metadata for distinction) from the metadata storage table to obtain a consensus block (hereinafter referred to as the first consensus block for distinction). Among them, the first blockchain node can package multiple metadata that have not been packaged from the metadata storage table regularly or according to other rules, and the specific packaging rules are not limited in this embodiment. It can be understood that if the above-mentioned first metadata is stored in the metadata storage table and is packaged, it may be packaged as the second metadata. The first blockchain node can set the packaged transaction data to a packaged state through the metadata management service. In one embodiment, the first consensus block may include a transaction hash list consisting of transaction hashes in each second metadata. Compared with the existing block packaging of complete transaction data, the consensus block in this embodiment only includes metadata information in the transaction data.

[0106] The first blockchain node broadcasts the packaged first consensus block to each second blockchain node, and each second blockchain node reaches a consensus on the first consensus block. The specific process of the second blockchain node reaching a consensus on the first consensus node is not limited in this embodiment.

[0107] Furthermore, in one embodiment, when the first blockchain node acts as a non-consensus master node, the first blockchain node receives a consensus block broadcasted by the second blockchain node acting as a consensus master node, and reaches consensus on the consensus block.

[0108] Step S50, according to the second metadata, obtain the second transaction data corresponding to the second metadata from the corresponding transaction storage pool, execute each of the second transaction data to obtain a first execution result, and after detecting that the first consensus block consensus is successful, store the first execution result and the first consensus block in the storage module to complete the chaining of each of the second transaction data.

[0109] During the consensus process, the first blockchain node needs to execute the complete transaction data corresponding to the consensus block, that is, it needs to execute the transaction data corresponding to the second metadata (hereinafter referred to as the second transaction data for distinction), and upload the execution result to the chain. Among them, the second metadata is the metadata including the transaction hash of the second transaction data and the ID of the transaction storage pool storing the second transaction data extracted based on the second transaction data. Since the first consensus block does not include complete transaction data, the first blockchain node can first obtain the second transaction data from the corresponding transaction storage pool according to the second metadata, and then execute the second transaction data. Among them, in one embodiment, the first blockchain node can extract the storage pool ID and transaction hash in the second metadata, access the transaction storage pool corresponding to the storage pool ID, and obtain the second transaction data corresponding to the transaction hash from the transaction storage pool.

[0110] After obtaining the second transaction data, the first blockchain node executes the second transaction data to obtain an execution result (hereinafter referred to as the first execution result for distinction). It should be noted that the process of executing the transaction data to obtain the execution result can refer to the existing blockchain transaction data execution process, which is not limited or elaborated here.

[0111] Each blockchain node in the blockchain system pre-sets a certain consensus mechanism, and determines that the consensus block consensus is successful when certain conditions are met. In this embodiment, the consensus mechanism is not limited. For example, in one implementation, each blockchain node can calculate the hash of its own execution result, compare the hash values, and if they are consistent, it is considered that the consensus is successful.

[0112] When the first blockchain node detects that the first consensus block has reached consensus successfully, the first execution result and the first consensus block can be stored in the storage module to complete the chaining of each second transaction data. It should be noted that since the second transaction data has been pre-stored in the storage module, when it is chained, it is only necessary to store the first execution result and the first consensus block in the storage module without storing the second transaction data, thereby reducing the storage pressure when the transaction data is chained. It is understandable that after the first consensus block is stored in the storage module, the corresponding transaction data can be found through the transaction hash in the first consensus block.

[0113] Furthermore, in one embodiment, in order to reclaim the memory cache, after the first consensus block and the first execution result are successfully written, the first blockchain node can notify the metadata management service through the storage module to delete the second metadata in the metadata storage table, and further notify the transaction storage pool through the metadata management service to delete the second transaction data in the memory cache.

[0114] Furthermore, in one embodiment, in order to facilitate the search for the block where the transaction data is located according to the transaction hash, when the first execution result and the first consensus block are stored in the storage module, the mapping relationship between the transaction hash of the second transaction data and the first consensus block can also be written into the storage module.

[0115] In this embodiment, by setting the blockchain node to include multiple transaction storage pools, and including a metadata management service and a storage module corresponding to the multiple transaction storage pools, the first blockchain node assigns the received transaction data to one of the transaction storage pools for storage, and submits the metadata of the transaction data to the metadata management service separately, and includes the transaction hash of the transaction data and the ID of the transaction storage pool storing the transaction data in the metadata, so that the packaging and execution of the transaction data can be performed according to the metadata in the metadata storage table of the metadata management service, and the transaction storage pool can be expanded and reduced as needed without affecting the packaging and execution of the transaction data, thereby solving the technical problem of limiting the performance of the entire blockchain system due to insufficient scalability of the transaction pool, on the one hand eliminating the storage limitation of the transaction storage pool, and on the other hand improving the horizontal scalability of the transaction storage pool. Furthermore, when the transaction storage pool verifies the transaction data and the metadata management service verifies the first metadata, the metadata management service stores the first metadata in the metadata storage table, and then packages the metadata from the metadata storage table, thereby ensuring the accuracy of the transaction data on the chain; and when the transaction storage pool verifies the transaction data and the metadata management service verifies the first metadata, the target transaction storage pool stores the first transaction data in the storage module, so that when the transaction data is on the chain, only the execution result and the consensus block need to be stored in the storage module, without storing the transaction data, thereby reducing the storage pressure when the transaction data is on the chain.

[0116] Furthermore, in one embodiment, the blockchain node further includes at least one blockchain access module and at least one transaction synchronization module, and the step of receiving the first transaction data in step S10 includes:

[0117] Step S101, receiving first transaction data sent by a blockchain client through any one of the blockchain access modules; or receiving first transaction data broadcasted by a second blockchain node through any one of the transaction synchronization modules;

[0118] The blockchain access modules of blockchain nodes can be expanded in parallel without state, that is, the number of blockchain access modules can be expanded or reduced as needed without changing other modules of the blockchain node or affecting the functional implementation of other modules. The blockchain client can send transaction data to any blockchain access module of any blockchain node.

[0119] The transaction synchronization module of the blockchain node can also be expanded in stateless parallel. When the blockchain client sends the first transaction data to the second blockchain node, the second blockchain node can broadcast the first transaction data to any transaction synchronization module of the first blockchain node, and the first blockchain node receives the first transaction data broadcast by the second blockchain node through the transaction synchronization module. Among them, the second blockchain node can also receive the first transaction data sent by the blockchain client through any blockchain access module of the second blockchain node, and broadcast the first transaction data to the first blockchain node through any transaction synchronization module of the second blockchain node.

[0120] The blockchain transaction processing method further includes:

[0121] Step S60: After the signature verification of the first transaction data is passed through the target transaction storage pool, one of the transaction synchronization modules is used to broadcast the first transaction data to each second blockchain node.

[0122] The first blockchain node performs signature verification on the first transaction data through the target transaction storage pool. After the verification is passed, the first blockchain node uses one of the multiple transaction synchronization modules to broadcast the first transaction data to each second blockchain node. The first blockchain node may select the transaction synchronization module in accordance with a certain load balancing strategy, which is not specifically limited in this embodiment.

[0123] Similarly, if the second blockchain node receives the first transaction data sent by the blockchain client, after the signature of the first transaction data is verified through the transaction storage pool of the second blockchain node, one of the multiple transaction synchronization modules of the second blockchain node is used to broadcast the first transaction data to the first blockchain node.

[0124] Furthermore, in one embodiment, each blockchain access module and transaction synchronization module may respectively include a transaction allocator. After receiving the first transaction data, the first blockchain node may determine the target transaction storage pool through the transaction allocator, allocate the first transaction data to the target transaction storage pool, extract the first metadata, and submit the first metadata to the metadata management service.

[0125] Furthermore, in one embodiment, the first blockchain node may also include a consensus module, which may include a consensus packaging module and a consensus engine. The first blockchain node may package transaction data from the metadata storage table through the consensus packaging module to obtain a consensus block, and broadcast the consensus block to the second blockchain node through the consensus engine to promote all network nodes to reach a consensus on the consensus block.

[0126] Furthermore, in one embodiment, the first blockchain node may also include an execution module, which may include a block executor and a transaction acquisition module. The first blockchain node may obtain transaction data corresponding to the metadata from the storage module according to the metadata through the transaction acquisition module, and execute the acquired transaction data through the block executor.

[0127] Further, based on the above first embodiment, a second embodiment of the blockchain transaction processing method of the present invention is proposed. In this embodiment, when the same transaction data is received, the first blockchain data needs to be able to identify and reject the same transaction data received later. In order to simplify the repeatability verification procedure and improve the accuracy of verification, a transaction allocation strategy can be set so that when the first blockchain node receives the same transaction data, the same transaction data will be allocated to the same transaction storage pool. At this time, only the transaction storage pool needs to perform repeatability verification on the allocated transaction data, and there is no need for the metadata storage module to perform repeatability verification on the metadata separately. There are many allocation strategies that can make the same transaction data always be allocated to the same transaction storage module, which are not limited in this embodiment.

[0128] Furthermore, in one embodiment, a simple transaction allocation strategy is provided to implement an allocation strategy in which the same transaction data is allocated to the same transaction storage module during a period of time when the number of transaction storage modules in the first blockchain node does not change, thereby simplifying the procedure of repeatability verification during the period of time. Specifically, the step of determining the target transaction storage pool from the multiple transaction storage pools in step S10 includes:

[0129] Step S102, calculating the first transaction hash of the first transaction data, and taking the modulus of the first transaction hash and the number of the transaction storage pool in the first blockchain node to obtain a modulus result;

[0130] Step S103: taking the transaction storage pool whose ID is the remainder result in each of the transaction storage pools as the target transaction storage pool.

[0131] After receiving the first transaction data, the first blockchain node can calculate the first transaction hash of the first transaction data, and take the modulus of the first hash with the number of transaction storage pools in the first blockchain node to obtain a modulus result. After calculating the modulus result, the first blockchain node uses the transaction storage pool whose ID in the transaction storage pool is the modulus result as the target transaction storage pool, that is, the ID of the target transaction storage pool is the modulus result. For example, the first transaction hash is represented by txHash, and the number of transaction storage pools is N, then the modulus result is (txHash%N), and (txHash%N) is also the ID of the target transaction storage pool. Since the transaction hashes calculated for the same transaction data are the same, the results obtained by taking the modulus of the same transaction hash with the same number of transaction storage pools are also the same, so when the number of transaction storage pools does not change for a period of time, the same transaction data will be assigned to the same transaction storage pool.

[0132] Furthermore, in one embodiment, before step S30, the following steps are further included:

[0133] Step A10: when the target transaction storage pool is allocated the first transaction data, the first transaction data is cached by the target transaction storage pool;

[0134] When the allocation strategy of always allocating the same transaction data to the same transaction storage pool is not adopted, or when the allocation strategy of always allocating the same transaction data to the same transaction storage pool is adopted but the accuracy of rejecting duplicate transaction data needs to be further improved, in this embodiment, the transaction storage pool and metadata management service can be used to perform double repeatability verification.

[0135] Specifically, when the target transaction storage pool is allocated to the first transaction data, the first blockchain node can first cache the first transaction data through the target transaction storage pool.

[0136] Step A20, performing a verification operation on the cached first transaction data through the target transaction storage pool, and sending the verification result to the metadata management service, wherein the verification operation includes a repeatability verification operation and a signature verification operation, and when both the repeatability verification operation and the signature verification operation are passed, it indicates that the first transaction data verification is passed;

[0137] The first blockchain node performs a verification operation on the cached first transaction data through the target transaction storage pool. The verification operation may include a repeatability verification operation and a signature verification operation. When both the repeatability verification operation and the signature verification operation are passed, it means that the first transaction data has passed the verification. There is no restriction on the order of the repeatability verification operation and the signature verification operation. When one verification operation fails, the other verification operation may not be performed.

[0138] The first blockchain node sends the verification result to the metadata management service through the target transaction storage pool. In a specific implementation, the results of the two verification operations can be sent to the metadata management service successively, or they can be aggregated as a final result and sent to the metadata management service. However, no matter how the verification result is sent, the metadata management service can determine whether the first transaction data has passed or failed the verification according to the verification result.

[0139] Step A30: When the metadata management service is submitted with the first metadata, the metadata management service caches the first metadata to a candidate metadata cache table;

[0140] When the metadata management service is submitted with the first metadata, the first blockchain node may cache the first metadata into an alternative metadata cache table through the metadata management service, where the alternative metadata cache table is used to store metadata that has not yet been verified.

[0141] Step A40: When the metadata management service receives a verification result indicating that the first transaction data has passed the verification, and the metadata management service has repeatedly verified the first metadata, the step S30 is executed.

[0142] When the metadata management service receives the verification result sent by the target transaction storage pool indicating that the first transaction data has been verified, and the first metadata has been repeatedly verified through the metadata management service, the first blockchain node can store the first transaction data in the storage module through the target transaction storage pool, and store the first metadata in the metadata storage table through the metadata management service. Further, when the metadata management service receives the verification result indicating that the first transaction data has been verified, and the first metadata has been repeatedly verified, the first blockchain node notifies the target transaction storage pool through the metadata management service to store the first transaction data in the storage module, and after receiving the notification, the target transaction storage pool stores the first transaction data in the storage module. Furthermore, after storing the first metadata in the metadata storage table, the first blockchain node can delete the first metadata from the alternative metadata cache table.

[0143] It should be noted that when the metadata management service first receives the first metadata and has not yet received the verification result of the first transaction data sent by the target transaction storage pool, the first blockchain node can first cache the first metadata to the alternative metadata cache table through the metadata management service, and can first perform repeated verification, and then make subsequent operations based on the verification result after receiving the verification result sent by the target transaction storage pool. When the metadata management service first receives the verification result of the first transaction data sent by the target transaction storage pool and has not yet received the first metadata, the verification result of the first transaction data can be cached first, for example, cached in the alternative metadata cache table, and then subsequent operations can be performed after receiving the first metadata.

[0144] Furthermore, in one embodiment, after step A20, the method further includes:

[0145] Step A50: when the verification result indicates that the first transaction data verification fails, deleting the cached first transaction data through the target transaction storage pool;

[0146] When the first blockchain node verifies the first transaction data through the target transaction storage pool and obtains a verification result indicating that the verification of the first transaction data fails, the first blockchain node can directly delete the cached first transaction data through the target transaction storage pool to indicate rejection of the first transaction data. It is understandable that the first blockchain node will also notify the metadata management service of the failed verification result through the target transaction storage pool.

[0147] After step A30, the method further includes:

[0148] Step A60: when the metadata management service receives a verification result indicating that the verification of the first transaction data fails, the metadata management service deletes the first metadata in the candidate metadata cache table;

[0149] When the metadata management service receives a verification result indicating that the verification of the first transaction data has failed, the first blockchain node can delete the first metadata in the alternative metadata cache table through the metadata management service. Wherein, when the metadata management service receives a verification result indicating that the verification of the first transaction data has failed, but the first metadata has not been received, then the first metadata in the alternative metadata cache table can be deleted after the metadata management service receives the first metadata and caches it in the alternative metadata cache table, without the need to perform repeated verification of the first metadata; when the metadata management service receives a verification result indicating that the verification of the first transaction data has failed, but the first metadata has been received and cached in the alternative metadata cache table, then the first blockchain node can directly delete the first metadata in the alternative metadata cache table through the metadata management service.

[0150] Step A70, when the metadata management service receives a verification result indicating that the first transaction data has passed the verification, and the repeated verification of the first metadata through the metadata management service fails, the first metadata in the alternative metadata cache table is deleted through the metadata management service, and the target transaction storage pool is notified through the metadata management service to delete the cached first transaction data.

[0151] When the metadata management service receives a verification result indicating that the first transaction data has been verified, and the first metadata fails to be verified for repeatability through the metadata management service, the first blockchain node can delete the first metadata in the candidate metadata cache table through the metadata management service, and notify the target transaction storage pool through the metadata management service to delete the cached first transaction data. Wherein, when the metadata management service receives a verification result indicating that the first transaction data has been verified, the first metadata has not been received yet, then the metadata management service can wait for the metadata management service to receive the first metadata and cache it in the candidate metadata cache table, and then perform repeatability verification on the first metadata. When the repeatability verification fails, the first metadata in the candidate metadata cache table is deleted, and the target transaction storage pool is notified to delete the first transaction data; when the metadata management service receives a verification result indicating that the first transaction data has been verified, the first metadata has been received, and has been cached in the candidate metadata cache table, and a verification result indicating that the repeatability verification has failed has been obtained, then the first blockchain node can delete the first metadata in the candidate metadata cache table through the metadata management service, and notify the target transaction storage pool to delete the first transaction data.

[0152] It should be noted that, when the target transaction storage pool receives a notification from the metadata management service to delete the cached first transaction data, it may delete the first transaction data to indicate that it refuses to receive the first transaction data.

[0153] Further, based on the above-mentioned first and / or second embodiments, a third embodiment of the blockchain transaction processing method of the present invention is proposed. In this embodiment, the method further includes:

[0154] Step B10, when receiving the second consensus block broadcasted by the second blockchain node, decoding the third transaction hash in the second consensus block;

[0155] When the first blockchain node is used as a non-consensus master node, it can receive the consensus block (hereinafter referred to as the second consensus block for distinction) broadcast by the second blockchain node as the consensus master node, and reach a consensus on the second consensus block. The process of the second blockchain node obtaining the second consensus block can refer to the process of the first blockchain node obtaining the first consensus block, which is not described in detail in this embodiment.

[0156] Specifically, when the first blockchain node receives the second consensus block broadcast by the second blockchain node, it can decode the transaction hash in the second consensus block (hereinafter referred to as the third transaction hash for distinction).

[0157] Step B20, determining whether the metadata storage table stores third metadata corresponding to the third transaction hash by accessing the metadata management service;

[0158] The first blockchain node may first determine whether the metadata storage table contains metadata corresponding to the third transaction hash (hereinafter referred to as third metadata for distinction) by accessing the metadata management service. It is understandable that the third metadata is metadata containing the third transaction hash.

[0159] Step B30: if the third metadata is stored in the metadata storage table, the third transaction data corresponding to the third metadata is obtained from the corresponding transaction storage pool according to the third metadata, the third transaction data is executed to obtain the second execution result, and after the second consensus block consensus is detected to be successful, the second execution result and the second consensus block are stored in the storage module to complete the uploading of the third transaction data to the chain;

[0160] If the third metadata is already stored in the metadata storage table, it means that the first blockchain node has received the transaction data corresponding to the third transaction hash (hereinafter referred to as the third transaction data) before, and the third metadata has been verified by the metadata management service, and the third transaction data has also been verified by the transaction storage pool. Then, at this time, the first blockchain node can directly obtain the third transaction data from the corresponding transaction storage pool according to the third metadata. After obtaining the third transaction data, the first blockchain node can execute the third transaction data to obtain an execution result (hereinafter referred to as the second execution result).

[0161] When the first blockchain node detects that the second consensus block has reached a consensus successfully, the second execution result and the second consensus block can be stored in the storage module to complete the chaining of the third transaction data. It should be noted that, since the third transaction data has been pre-stored in the storage module, when it is chained, it is only necessary to store the second execution result and the second consensus block in the storage module, without storing the third transaction data, thereby reducing the storage pressure when the transaction data is chained. It is understandable that after the second consensus block is stored in the storage module, the corresponding transaction data can be found through the transaction hash in the second consensus block. Furthermore, in one embodiment, in order to facilitate the search for the block where the transaction data is located according to the transaction hash, the mapping relationship between the transaction hash of the third transaction data and the second consensus block can also be written into the storage module when the second execution result and the second consensus block are stored in the storage module.

[0162] Step B40: If the third metadata is not stored in the metadata storage table, request the second blockchain node to obtain the third transaction data corresponding to the third transaction hash;

[0163] If the third metadata is not stored in the metadata storage table, it means that the first blockchain node has not received the third transaction data before. At this time, the first blockchain node can request the second blockchain node as the consensus master node to obtain the third transaction data. Specifically, the first blockchain node can send the third transaction hash to the second blockchain node; the second blockchain node searches the storage module according to the third transaction hash to obtain the third transaction data, or searches the metadata management service for the metadata corresponding to the third transaction hash (here it is not the third metadata, but the metadata stored in the metadata storage table of the second blockchain node), and obtains the third transaction data from the corresponding transaction storage pool according to the metadata.

[0164] Step B50: if the third transaction data is obtained from the second blockchain node, the third transaction data is executed to obtain the second execution result, and after detecting that the second consensus block consensus is successful, the third transaction data, the second execution result and the second consensus block are stored in the storage module to complete the uploading of the third transaction data to the chain;

[0165] If the first blockchain node can obtain the third transaction data from the second blockchain node, the obtained third transaction data is executed to obtain an execution result (since it is also the result obtained by executing the third transaction data, it is also referred to as the second execution result here). The operation after obtaining the second execution result is the same as the operation after obtaining the second execution result in step S30, except that the third transaction data is also stored in the storage module because the first blockchain node has not previously stored the third transaction data in the storage module.

[0166] It should be noted that the first blockchain node can determine whether the transaction data returned by the second blockchain node is the third transaction data by calculating the hash of the transaction data returned by the second blockchain node and comparing it with the third transaction hash to see whether they are consistent.

[0167] Step B60: If the third transaction data is not obtained from the second blockchain node, the second consensus block is determined to be invalid, and the second consensus block is refused to be put on the chain.

[0168] If the first blockchain node fails to obtain the third transaction data from the second blockchain node, the first blockchain node may determine that the second consensus block is invalid and refuse to put the second consensus block on the chain.

[0169] Further, based on the above-mentioned first, second and / or third embodiments, a fourth embodiment of the blockchain transaction processing method of the present invention is proposed. In this embodiment, the step of obtaining the second transaction data corresponding to the second metadata from the corresponding transaction storage pool according to the second metadata in step S50 includes:

[0170] Step S501, extracting a storage pool ID from the second metadata, and accessing a transaction storage pool corresponding to the storage pool ID to determine a state of the transaction storage pool;

[0171] The process of the first blockchain node obtaining the second transaction data according to the second metadata may specifically be to extract a storage pool ID from the second metadata, where the storage pool ID is the ID of the transaction storage pool storing the second transaction data. The first blockchain node accesses the transaction storage pool corresponding to the storage pool ID to determine the status of the transaction storage pool. The transaction storage pool may be in a normal working state or may be in a downtime state due to a fault.

[0172] Step S502: if the transaction storage pool corresponding to the storage pool ID is in a normal working state, obtaining second transaction data corresponding to the second transaction hash from the transaction storage pool corresponding to the storage pool ID according to the second transaction hash in the second metadata;

[0173] When the transaction storage pool corresponding to the storage pool ID is in a normal working state, the first blockchain node can obtain the second transaction data corresponding to the second transaction hash from the transaction storage pool corresponding to the storage pool ID according to the second transaction hash in the second metadata. That is, when the transaction storage pool corresponding to the storage pool ID is in a normal state, the second transaction data can be normally obtained from the transaction storage pool.

[0174] Step S503: If the transaction storage pool corresponding to the storage pool ID is in a downtime state, access the storage module, and obtain second transaction data corresponding to the second metadata from the storage module according to the second transaction hash.

[0175] When the transaction storage pool corresponding to the storage pool ID is in a downtime state, the second transaction data cannot be normally obtained from the transaction storage pool. At this time, the first blockchain node can obtain the second transaction data corresponding to the second metadata from the storage module according to the second transaction hash in the second metadata.

[0176] In this embodiment, since the transaction data is stored in the storage module in advance, when the transaction storage pool crashes, the complete transaction data can be obtained from the storage module for execution, thereby improving the reliability of the blockchain system.

[0177] Furthermore, in one embodiment, the method further comprises:

[0178] Step C10, when the metadata management service crashes and restarts, loading the fourth metadata from the storage module into the metadata storage table;

[0179] When the metadata management service crashes and restarts, the first blockchain node can load metadata (hereinafter referred to as the fourth metadata for distinction) from the storage module and restore it to the metadata storage table to ensure that subsequent packaging, consensus and other operations can continue to be executed normally.

[0180] Step C20: Notify, through the metadata management service, the transaction storage pool corresponding to the storage pool ID in the fourth metadata to load the fourth transaction data corresponding to the fourth metadata from the storage module and cache it.

[0181] After restoring the fourth metadata to the metadata storage table, the first blockchain node can also notify the transaction storage pool corresponding to the storage pool ID in the fourth metadata through the metadata management service to load the fourth transaction data corresponding to the fourth metadata from the storage module. After receiving the notification, the transaction storage pool can check whether the fourth transaction data is cached. If not, the fourth transaction data can be cached to ensure zero loss of transaction data.

[0182] In addition, an embodiment of the present invention further proposes a computer-readable storage medium, on which a blockchain transaction processing program is stored. When the blockchain transaction processing program is executed by a processor, the steps of the blockchain transaction processing method described below are implemented.

[0183] The various embodiments of the blockchain transaction processing device and computer-readable storage medium of the present invention can refer to the various embodiments of the blockchain transaction processing method of the present invention, and will not be repeated here.

[0184] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0185] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0186] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0187] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A blockchain transaction processing method, characterized in that: The method is applied to a first blockchain node, the first blockchain node includes multiple transaction storage pools, and includes a metadata management service and a storage module corresponding to the multiple transaction storage pools, and the method includes the following steps: receiving first transaction data, calculating a first transaction hash of the first transaction data, and taking the modulus of the first transaction hash and the number of the transaction storage pool in the first blockchain node to obtain a modulus result; taking the transaction storage pool whose ID is the remainder result in each of the transaction storage pools as the target transaction storage pool, and allocating the first transaction data to the target transaction storage pool; Extracting first metadata of the first transaction data, and submitting the first metadata to the metadata management service, wherein the first metadata includes a first transaction hash of the first transaction data and an ID of the target transaction storage pool; When the first transaction data is verified by the target transaction storage pool and the first metadata is verified by the metadata management service, the first metadata is stored in the metadata storage table by the metadata management service, and the first transaction data is stored in the storage module by the target transaction storage pool; When the first blockchain node serves as a consensus master node, the first consensus block is obtained by accessing the metadata management service to package multiple second metadata from the metadata storage table, and the first consensus block is broadcast to each second blockchain node, so that each second blockchain node can reach a consensus on the first consensus block; Extracting a storage pool ID from the second metadata, and accessing a transaction storage pool corresponding to the storage pool ID to determine a state of the transaction storage pool; If the transaction storage pool corresponding to the storage pool ID is in a normal working state, obtaining second transaction data corresponding to the second transaction hash from the transaction storage pool corresponding to the storage pool ID according to the second transaction hash in the second metadata; If the transaction storage pool corresponding to the storage pool ID is in a downtime state, the storage module is accessed, and the second transaction data corresponding to the second metadata is obtained from the storage module according to the second transaction hash, and each of the second transaction data is executed to obtain a first execution result. After detecting that the first consensus block consensus is successful, the first execution result and the first consensus block are stored in the storage module to complete the chaining of each of the second transaction data.

2. The blockchain transaction processing method according to claim 1, characterized in that: Before the step of storing the first metadata in a metadata storage table through the metadata management service after the first transaction data is verified by the target transaction storage pool and the first metadata is verified by the metadata management service and storing the first transaction data in the storage module through the target transaction storage pool, the method further includes: When the target transaction storage pool is allocated the first transaction data, the first transaction data is cached by the target transaction storage pool; Performing a verification operation on the cached first transaction data through the target transaction storage pool, and sending the verification result to the metadata management service, wherein the verification operation includes a repeatability verification operation and a signature verification operation, and when both the repeatability verification operation and the signature verification operation are passed, it indicates that the first transaction data has passed the verification; When the metadata management service is submitted with the first metadata, the first metadata is cached in a candidate metadata cache table through the metadata management service; When the metadata management service receives a verification result indicating that the first transaction data has passed verification, and the first metadata has passed repeated verification through the metadata management service, the steps of storing the first metadata in the metadata storage table through the metadata management service and storing the first transaction data in the storage module through the target transaction storage pool are executed.

3. The blockchain transaction processing method according to claim 2, characterized in that: After the step of performing a verification operation on the cached first transaction data through the target transaction storage pool and sending the verification result to the metadata management service, the method further includes: When the verification result indicates that the first transaction data verification fails, deleting the cached first transaction data through the target transaction storage pool; After the step of caching the first metadata to the candidate metadata cache table through the metadata management service when the first metadata is submitted to the metadata management service, the method further includes: When the metadata management service receives a verification result indicating that the verification of the first transaction data fails, deleting the first metadata in the candidate metadata cache table through the metadata management service; When the metadata management service receives a verification result indicating that the first transaction data has passed verification, and repeated verification of the first metadata through the metadata management service fails, the first metadata in the alternative metadata cache table is deleted through the metadata management service, and the target transaction storage pool is notified through the metadata management service to delete the cached first transaction data.

4. The blockchain transaction processing method according to claim 1, characterized in that: When the first blockchain node serves as a non-consensus master node, the method further includes: When receiving the second consensus block broadcasted by the second blockchain node, decoding the third transaction hash in the second consensus block; Determine, by accessing the metadata management service, whether the metadata storage table stores third metadata corresponding to the third transaction hash; If the third metadata is stored in the metadata storage table, the third transaction data corresponding to the third metadata is obtained from the corresponding transaction storage pool according to the third metadata, the third transaction data is executed to obtain the second execution result, and after detecting that the second consensus block consensus is successful, the second execution result and the second consensus block are stored in the storage module to complete the uploading of the third transaction data to the chain; If the third metadata is not stored in the metadata storage table, requesting the second blockchain node to obtain the third transaction data corresponding to the third transaction hash; If the third transaction data is obtained from the second blockchain node, the third transaction data is executed to obtain the second execution result, and after detecting that the second consensus block consensus is successful, the third transaction data, the second execution result and the second consensus block are stored in the storage module to complete the uploading of the third transaction data to the chain; If the third transaction data is not obtained from the second blockchain node, the second consensus block is determined to be invalid, and the second consensus block is refused to be put on the chain.

5. The blockchain transaction processing method according to claim 1, characterized in that: The method further comprises: When the metadata management service crashes and restarts, loading the fourth metadata from the storage module into the metadata storage table; The metadata management service notifies the transaction storage pool corresponding to the storage pool ID in the fourth metadata to load the fourth transaction data corresponding to the fourth metadata from the storage module and cache it.

6. The blockchain transaction processing method according to any one of claims 1 to 5, characterized in that: The first blockchain node further includes at least one blockchain access module and at least one transaction synchronization module, and the step of receiving the first transaction data includes: Receiving the first transaction data sent by the blockchain client through any one of the blockchain access modules; or receiving the first transaction data broadcasted by the second blockchain node through any one of the transaction synchronization modules; The blockchain transaction processing method further includes: After the first transaction data is signed and verified by the target transaction storage pool, one of the transaction synchronization modules is used to broadcast the first transaction data to each second blockchain node.

7. A blockchain transaction processing device, characterized in that: The blockchain transaction processing device includes: a memory, a processor, and a blockchain transaction processing program stored in the memory and executable on the processor. When the blockchain transaction processing program is executed by the processor, the steps of the blockchain transaction processing method as described in any one of claims 1 to 6 are implemented.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a blockchain transaction processing program, which, when executed by a processor, implements the steps of the blockchain transaction processing method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Transaction processing method, system, apparatus and storage medium for license chain

    CN109087098A

  • Block chain consensus method and device and electronic equipment

    CN111522822A