CN113986922A - Block chain transaction processing method, equipment and computer readable storage medium - Google Patents

Block chain transaction processing method, equipment and computer readable storage medium Download PDF

Info

Publication number
CN113986922A
CN113986922A CN202111260228.0A CN202111260228A CN113986922A CN 113986922 A CN113986922 A CN 113986922A CN 202111260228 A CN202111260228 A CN 202111260228A CN 113986922 A CN113986922 A CN 113986922A
Authority
CN
China
Prior art keywords
transaction
metadata
transaction data
storage
storage pool
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111260228.0A
Other languages
Chinese (zh)
Inventor
陈宇杰
李辉忠
莫楠
张开翔
范瑞彬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
WeBank Co Ltd
Original Assignee
WeBank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by WeBank Co Ltd filed Critical WeBank Co Ltd
Priority to CN202111260228.0A priority Critical patent/CN113986922A/en
Publication of CN113986922A publication Critical patent/CN113986922A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Abstract

The invention discloses a block chain transaction processing method, equipment and a computer readable storage medium, wherein the method comprises the following steps: assigning transaction data to a target transaction storage pool; extracting metadata of the transaction data, and submitting the metadata to a metadata management service; storing the metadata to a metadata storage table, and storing the transaction data to a storage module; packaging a plurality of metadata from a metadata storage table to obtain a common identification block, and broadcasting the common identification block to each block link point so as to enable each second block link point to carry out common identification on the common identification block; and acquiring 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 storing the execution result and the consensus blocks into a storage module to finish the uplink of each transaction data after detecting that the consensus of the consensus blocks is successful. The invention solves the technical problem that the expandability of the transaction pool is insufficient to limit the performance of the whole block chain system.

Description

Block chain transaction processing method, equipment and computer readable storage medium
Technical Field
The present invention relates to the field of blockchain technologies, and in particular, to a method and an apparatus for processing blockchain transactions, and a computer-readable storage medium.
Background
Since the block chain has superior characteristics of distributivity, tamper resistance, traceability and the like, the block chain technology is widely applied to various industries. The block chain is a chain consisting of a series of blocks, and each block records a hash value of the block in addition to the data of the block, so that the chain is formed. The existing blockchain node is generally provided with only one transaction pool, and the transaction pool is simultaneously responsible for functions of verifying, storing, deleting uplink transaction data, synchronizing transaction data and the like of transaction data, and the performance of the whole blockchain system is limited due to the insufficient expandability of the transaction pool.
Disclosure of Invention
The invention mainly aims to provide a block chain transaction processing method, equipment and a computer readable storage medium, aiming at solving the technical problem that the performance of the whole block chain system is limited due to the insufficient expandability of a transaction pool when the transaction pool is set at a current block chain node.
To achieve the above object, the present invention provides a method for processing blockchain transactions, the method being applied to a first blockchain node, the first blockchain node including a plurality of transactional storage pools and including a metadata management service and a storage module corresponding to the plurality of transactional storage pools, the method including the steps of:
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;
extracting first metadata of the first transaction data, submitting the first metadata to the metadata management service, wherein the first metadata comprises a first transaction hash of the first transaction data and an ID of the target transaction storage pool;
after the first transaction data is verified through the target transaction storage pool and the first metadata is verified through the metadata management service, the first metadata is stored to a metadata storage table through the metadata management service, and the first transaction data is stored to the storage module through the target transaction storage pool;
when the first block link point serves as a consensus main node, a first consensus block is obtained by packaging a plurality of second metadata from the metadata storage table through accessing the metadata management service, and the first consensus block is broadcasted to each second block link point so that each second block link point can perform consensus on the first consensus block;
and acquiring second transaction data corresponding to the second metadata from a corresponding transaction storage pool according to the second metadata, executing each second transaction data to obtain a first execution result, and storing the first execution result and the first common identification block to the storage module to complete uplink of each second transaction data after detecting that the first common identification block is successfully identified.
Optionally, the step of determining a target trading storage pool from the plurality of trading storage pools comprises:
calculating the first transaction hash of the first transaction data, and taking the first transaction hash to balance the number of the transaction storage pools in the first block chain node to obtain a balance result;
and taking the transaction storage pool with the ID of the surplus result in each transaction storage pool as a target transaction storage pool.
Optionally, before the step of storing the first transaction data in the metadata storage table by the metadata management service and storing the first transaction data in the storage module by the target transaction storage pool after the first transaction data is verified by the target transaction storage pool and the first metadata is verified by the metadata management service, the method further includes:
caching the first transaction data via the target transaction pool when the target transaction pool is assigned the first transaction data;
verifying the cached first transaction data through the target transaction storage pool, and sending a verification result to the metadata management service, wherein the verification operation comprises a repeatability verification operation and a signature verification operation, and when the repeatability verification operation and the signature verification operation both pass, the verification of the first transaction data is passed;
caching, by the metadata management service, the first metadata to an alternative metadata cache table when the metadata management service is submitted with the first metadata;
when the metadata management service receives a verification result indicating that the first transaction data passes verification and the metadata management service passes repeated verification of the first metadata, the steps of storing the first metadata into a metadata storage table through the metadata management service and storing the first transaction data into the storage module through the target transaction storage pool are executed.
Optionally, after the step of performing a verification operation on the cached first transaction data through the target transaction storage pool and sending a verification result to the metadata management service, the method further includes:
deleting the cached first transaction data through the target transaction storage pool when the verification result indicates that the first transaction data is verified unsuccessfully;
after the step of caching the first metadata to an alternative metadata cache table by the metadata management service when the metadata management service is submitted with the first metadata, the method further includes:
deleting, by the metadata management service, the first metadata in the alternative metadata cache table when the metadata management service receives a verification result indicating that the first transaction data verification failed;
when the metadata management service receives a verification result indicating that the first transaction data passes verification and the repeated verification of the first metadata by the metadata management service fails, deleting the first metadata in the alternative metadata cache table by the metadata management service, and informing the target transaction storage pool of deleting the cached first transaction data by the metadata management service.
Optionally, when the first block link point is a non-consensus master node, the method further comprises:
decoding a third transaction hash in a second consensus chunk of the second chunk nexus broadcast when the second consensus chunk is received;
determining whether third metadata corresponding to the third transaction hash is stored in the metadata storage table by accessing the metadata management service;
if the third metadata is stored in the metadata storage table, acquiring third transaction data corresponding to the third metadata from a corresponding transaction storage pool according to the third metadata, executing the third transaction data to obtain a second execution result, and storing the second execution result and the second consensus block to the storage module to complete uplink of the third transaction data after successful consensus of the second consensus block is detected;
if the third metadata is not stored in the metadata storage table, requesting the second block link node to acquire the third transaction data corresponding to the third transaction hash;
if the third transaction data is acquired from the second block link point, executing the third transaction data to obtain a second execution result, and after detecting that the second consensus block is successful, storing the third transaction data, the second execution result and the second consensus block in the storage module to complete the uplink of the third transaction data;
and if the third transaction data is not acquired from the second block link node, determining that the second common identification block is invalid, and rejecting uplink of the second common identification block.
Optionally, the step of obtaining second transaction data corresponding to the second metadata from the corresponding transaction storage pool according to the second metadata includes:
extracting a storage pool ID from the second metadata, and accessing a trading storage pool corresponding to the storage pool ID to determine the state of the trading storage pool;
if the transaction storage pool corresponding to the storage pool ID is in a normal working state, acquiring second transaction data corresponding to a second transaction hash from the transaction storage pool corresponding to the storage pool ID according to the second transaction hash in the second metadata;
and if the transaction storage pool corresponding to the storage pool ID is in a downtime state, accessing the storage module, and acquiring second transaction data corresponding to the second metadata from the storage module according to the second transaction hash.
Optionally, the method further comprises:
after the metadata management service is restarted in a downtime manner, loading fourth metadata from the storage module to the metadata storage table;
and informing the transaction storage pool corresponding to the storage pool ID in the fourth metadata through the metadata management service to load and cache fourth transaction data corresponding to the fourth metadata from the storage module.
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 first transaction data includes:
receiving first transaction data sent by a blockchain client through any one blockchain access module; or, receiving first transaction data broadcasted by a link point of a second block through any one of the transaction synchronization modules;
the blockchain transaction processing method further comprises the following steps:
and after signature verification of the first transaction data is passed through the target transaction storage pool, broadcasting the first transaction data to each second block chain node by adopting one of the transaction synchronization modules.
To achieve the above object, the present invention further provides a blockchain transaction processing apparatus, including: a memory, a processor and a blockchain transaction processing program stored on the memory and executable on the processor, the blockchain transaction processing program when executed by the processor implementing the steps of the blockchain transaction processing method as described above.
In addition, to achieve the above object, the present invention further provides a computer readable storage medium, which stores a blockchain transaction processing program, and when the blockchain transaction processing program is executed by a processor, the blockchain transaction processing program implements the steps of the blockchain transaction processing method as described above.
The first block link point distributes the received transaction data to one of the transaction storage pools for storage, submits the metadata of the transaction data to the metadata management service independently, and contains transaction hash of the transaction data and ID of the transaction storage pool storing the transaction data in the metadata management service, 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 according to the needs without influencing the packaging and execution of the transaction data, thereby solving the technical problem that the performance of the whole block chain system is limited due to insufficient expandability of the transaction pool. After the transaction data in the transaction storage pool passes the verification of the transaction data and the first metadata passes the verification of the metadata management service, the metadata management service stores the first metadata into the metadata storage table, and then the metadata is packaged from the metadata storage table, so that the accuracy of the uplink transaction data is ensured; and after the transaction storage pool passes the transaction data verification and the metadata management service passes the first metadata verification, the first transaction data is stored to the storage module through the target transaction storage pool, so that only the execution result and the common identification block can be stored to the storage module without storing the transaction data during uplink, and the storage pressure during uplink of the transaction data is reduced.
Drawings
FIG. 1 is a schematic diagram of a hardware operating environment according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating a blockchain transaction processing method according to a first embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
As shown in fig. 1, fig. 1 is a schematic device structure diagram of a hardware operating environment according to an embodiment of the present invention.
It should be noted that, in the embodiment of the present invention, the blockchain transaction processing device may be a smart phone, a personal computer, a server, and the like, and is not limited herein. The blockchain transaction processing device may be deployed at a first blockchain node, the first blockchain node including a plurality of transactional storage pools and including a metadata management service and a storage module corresponding to the plurality of transactional storage pools.
As shown in fig. 1, 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, a communication bus 1002. Wherein a communication bus 1002 is used to enable connective 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, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the device configuration shown in fig. 1 does not constitute a limitation of a blockchain transaction processing device and may include more or fewer components than shown, or some components in combination, or a different arrangement of components.
As shown in fig. 1, the memory 1005, which is a type of computer storage medium, may include an operating system, a network communication module, a user interface module, and a blockchain transaction processing program therein. The operating system is a program that manages and controls the hardware and software resources of the device, supporting the execution of the blockchain transaction handler as well as other software or programs. In the device shown in fig. 1, the user interface 1003 is mainly used for data communication with a client; the network interface 1004 is mainly used for establishing communication connection with a server; and the processor 1001 may be configured to call the blockchain transaction handler stored in the memory 1005 and perform the following operations:
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;
extracting first metadata of the first transaction data, submitting the first metadata to the metadata management service, wherein the first metadata comprises a first transaction hash of the first transaction data and an ID of the target transaction storage pool;
after the first transaction data is verified through the target transaction storage pool and the first metadata is verified through the metadata management service, the first metadata is stored to a metadata storage table through the metadata management service, and the first transaction data is stored to the storage module through the target transaction storage pool;
when the first block link point serves as a consensus main node, a first consensus block is obtained by packaging a plurality of second metadata from the metadata storage table through accessing the metadata management service, and the first consensus block is broadcasted to each second block link point so that each second block link point can perform consensus on the first consensus block;
and acquiring second transaction data corresponding to the second metadata from a corresponding transaction storage pool according to the second metadata, executing each second transaction data to obtain a first execution result, and storing the first execution result and the first common identification block to the storage module to complete uplink of each second transaction data after detecting that the first common identification block is successfully identified.
Further, the determining a target trading storage pool from the plurality of trading storage pools comprises:
calculating the first transaction hash of the first transaction data, and taking the first transaction hash to balance the number of the transaction storage pools in the first block chain node to obtain a balance result;
and taking the transaction storage pool with the ID of the surplus result in each transaction storage pool as a target transaction storage pool.
Further, before the first transaction data 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 after the first transaction data is verified by the target transaction storage pool and the first transaction data is verified by the metadata management service, the processor 1001 may be further configured to call a blockchain transaction handler stored in the memory 1005, and perform the following operations:
caching the first transaction data via the target transaction pool when the target transaction pool is assigned the first transaction data;
verifying the cached first transaction data through the target transaction storage pool, and sending a verification result to the metadata management service, wherein the verification operation comprises a repeatability verification operation and a signature verification operation, and when the repeatability verification operation and the signature verification operation both pass, the verification of the first transaction data is passed;
caching, by the metadata management service, the first metadata to an alternative metadata cache table when the metadata management service is submitted with the first metadata;
when the metadata management service receives a verification result indicating that the first transaction data passes verification and the metadata management service passes repeated verification of the first metadata, the steps of storing the first metadata into a metadata storage table through the metadata management service and storing the first transaction data into the storage module through the target transaction storage pool are executed.
Further, after performing a verification operation on the cached first transaction data through the target transaction storage pool and sending a verification result to the metadata management service, the processor 1001 may be further configured to call a blockchain transaction handler stored in the memory 1005, and perform the following operations:
deleting the cached first transaction data through the target transaction storage pool when the verification result indicates that the first transaction data is verified unsuccessfully;
after the metadata management service caches the first metadata in the alternative metadata cache table when the metadata management service is submitted with the first metadata, the processor 1001 may be further configured to call a blockchain transaction handler stored in the memory 1005, and perform the following operations:
deleting, by the metadata management service, the first metadata in the alternative metadata cache table when the metadata management service receives a verification result indicating that the first transaction data verification failed;
when the metadata management service receives a verification result indicating that the first transaction data passes verification and the repeated verification of the first metadata by the metadata management service fails, deleting the first metadata in the alternative metadata cache table by the metadata management service, and informing the target transaction storage pool of deleting the cached first transaction data by the metadata management service.
Further, when the first blockchain link point serves as a non-consensus master node, the processor 1001 may be further configured to call a blockchain transaction processing program stored in the memory 1005 to perform the following operations:
decoding a third transaction hash in a second consensus chunk of the second chunk nexus broadcast when the second consensus chunk is received;
determining whether third metadata corresponding to the third transaction hash is stored in the metadata storage table by accessing the metadata management service;
if the third metadata is stored in the metadata storage table, acquiring third transaction data corresponding to the third metadata from a corresponding transaction storage pool according to the third metadata, executing the third transaction data to obtain a second execution result, and storing the second execution result and the second consensus block to the storage module to complete uplink of the third transaction data after successful consensus of the second consensus block is detected;
if the third metadata is not stored in the metadata storage table, requesting the second block link node to acquire the third transaction data corresponding to the third transaction hash;
if the third transaction data is acquired from the second block link point, executing the third transaction data to obtain a second execution result, and after detecting that the second consensus block is successful, storing the third transaction data, the second execution result and the second consensus block in the storage module to complete the uplink of the third transaction data;
and if the third transaction data is not acquired from the second block link node, determining that the second common identification block is invalid, and rejecting uplink of the second common identification block.
Further, the obtaining second transaction data corresponding to the second metadata from the corresponding transaction storage pool according to the second metadata includes:
extracting a storage pool ID from the second metadata, and accessing a trading storage pool corresponding to the storage pool ID to determine the state of the trading storage pool;
if the transaction storage pool corresponding to the storage pool ID is in a normal working state, acquiring second transaction data corresponding to a second transaction hash from the transaction storage pool corresponding to the storage pool ID according to the second transaction hash in the second metadata;
and if the transaction storage pool corresponding to the storage pool ID is in a downtime state, accessing the storage module, and acquiring second transaction data corresponding to the second metadata from the storage module according to the second transaction hash.
Further, the processor 1001 may be further configured to call the blockchain transaction handler stored in the memory 1005, and perform the following operations:
after the metadata management service is restarted in a downtime manner, loading fourth metadata from the storage module to the metadata storage table;
and informing the transaction storage pool corresponding to the storage pool ID in the fourth metadata through the metadata management service to load and cache fourth transaction data corresponding to the fourth metadata from the storage module.
Further, the first blockchain node further comprises at least one blockchain access module and at least one transaction synchronization module, and the receiving first transaction data comprises:
receiving first transaction data sent by a blockchain client through any one blockchain access module; or, receiving first transaction data broadcasted by a link point of a second block through any one of the transaction synchronization modules;
the processor 1001 may also be configured to invoke a blockchain transaction handler stored in the memory 1005 to perform the following operations:
and after signature verification of the first transaction data is passed through the target transaction storage pool, broadcasting the first transaction data to each second block chain node by adopting one of the transaction synchronization modules.
Based on the above structure, various embodiments of a blockchain transaction processing method are provided.
Referring to fig. 2, fig. 2 is a flowchart illustrating a blockchain transaction processing method according to a first embodiment of the invention.
While a logical order is shown in the flow chart, in some cases, the steps shown or described may be performed in an order different than that shown or described herein. In this embodiment, the method for processing blockchain transactions includes:
step S10, 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;
in this embodiment, the blockchain transaction processing method may be applied to any one blockchain node in a blockchain system, and in order to solve the problem that the overall performance of the blockchain system is limited by setting one transaction pool in the blockchain node, in this embodiment, a plurality of transaction storage pools (that is, transaction pools) are set in the blockchain node, and one metadata management service and one storage module corresponding to the plurality of transaction storage pools are additionally provided. For the sake of distinction, a block link point as an execution subject is referred to as a first block link node, and a block link node other than the first block link point is referred to as a second block link node. It is understood that one blockchain node may serve as both a first blockchain node in the present embodiment and a second blockchain node in the present embodiment.
When a first blockchain link point receives transaction data requiring uplink (hereinafter referred to as first transaction data to illustrate distinctions), a target transaction storage pool may be first determined from a plurality of transaction storage pools (where a plurality of transaction storage pools refer to a plurality of transaction storage pools in a first blockchain node), and the first transaction data may be allocated 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 perform memory caching on the first transaction data. The transaction data refers to data that needs to be linked, and the specific content included in the transaction data is not limited in this embodiment. The first transaction data may be received from a blockchain client or may be received from a second blockchain node.
The manner in which the first chunk link point determines the target trading storage pool from the plurality of trading storage pools is not limited in this embodiment. For example, the target transaction storage pool may be determined according to a certain load balancing policy, so that the transaction data allocated to each transaction storage pool is relatively balanced; for another example, a polling scheme may be used, and the target transaction storage pool may be determined in a polling order each time transaction data is received.
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;
after determining the target trading storage pool, the first chunk link point may extract metadata of the first trading data (hereinafter referred to as first metadata to distinguish). The first metadata may include a transaction hash of the first transaction data (hereinafter, referred to as the first transaction hash for distinction) and an ID of the target transaction storage pool, and besides, optionally, the first metadata may further include other data extracted from the first transaction data, for example, a random number Nonce, a transaction weight prevention upper limit BlockLimit, and the like, which is not limited in this embodiment. The first blockchain node may preset an ID of each transaction storage module to uniquely distinguish each transaction storage module. The first transaction hash is obtained by performing hash calculation on the first transaction data by using a hash algorithm on the first block link point, and the hash algorithm is not limited in this embodiment, and a common hash algorithm may be used. Due to the nature of the hashing algorithm, transaction hashes calculated for different transaction data are different, and a first transaction hash may be used to uniquely identify the first transaction data.
After the first metadata is extracted, the first block link node submits the first metadata to a metadata management service so as to cache the first metadata through the metadata management service.
Step S30, when the first transaction data is verified through the target transaction storage pool and the first metadata is verified through the metadata management service, storing the first transaction data to a metadata storage table through the metadata management service and storing the first transaction data to the storage module through the target transaction storage pool;
after assigning the first transaction data to the target transaction storage pool, a verification operation may be performed on the first transaction data via the target transaction storage pool, and the verification operation may include at least a repeatability verification operation and a signature verification operation. The repeated verification operation may be to determine whether the same transaction data is received by comparing the first transaction hash of the first transaction data with the transaction hash of the transaction data received historically, and if it is determined that the same transaction data is received, it indicates that the repeated verification operation fails, and if it is determined that the same transaction data is not received, it indicates that the repeated verification operation passes. The signature verification operation may be a conventional signature verification operation, and will not be described in detail herein. When both the signature verification operation and the repeatability verification operation are verified, the first transaction data can be determined to be verified, and when any one of the verification operations fails, the first transaction data can be determined to fail to be verified.
After submitting the first metadata to the metadata management service, a validation operation may be performed on the first metadata by the metadata management service. In an embodiment, if the allocation policy adopted by the first block link point is such that the same transaction data is always allocated to the same transaction storage pool, the operation of verifying the first metadata by the metadata management service may specifically be: and verifying whether a notice that the repeated verification operation and the signature verification operation of the first transaction data sent by the target transaction storage pool are both passed is received, if the notice that the two verification operations are both passed is received, determining that the first metadata is verified to be passed, and if the notice that one of the two verification operations is failed is received, determining that the first metadata is verified to be failed. In another embodiment, to avoid an abnormal situation that the first transaction data is repeatedly received transaction data but the target transaction storage pool is not detected, and the transaction data storage is in error, the metadata management service may perform a verification operation on the first metadata by separately performing a repeated verification operation on the first metadata, specifically, by comparing a first transaction hash in the first metadata with a transaction hash in the metadata received in history to determine whether the same metadata is received, if it is determined that the same metadata is received, it indicates that the repeated verification operation fails, and the first metadata verification fails, and if it is determined that the same metadata is not received, it indicates that the repeated verification passes, and the first metadata verification passes.
When both the first transaction data and the first metadata are verified, the first chunk link point may store the first metadata to a metadata storage table via a metadata management service and the first transaction data to a storage module via a target transaction storage pool. The metadata storage table is a data table managed by the metadata management service and used for storing first metadata which passes verification, wherein the stored first metadata are used for being packaged into a consensus block. The storage module may be a storage module for persisting transaction data, e.g., may be implemented using backend distributed storage. And after the transaction data passes the verification, the transaction data is persisted to the storage module, so that on one hand, the function of pre-writing the transaction data is achieved, the storage pressure during subsequent block submission is reduced, on the other hand, the transaction data can be conveniently retrieved after the transaction storage pool is down, support is provided for fault recovery of the blockchain nodes, and the reliability of the whole blockchain system is improved.
Step S40, when the first block link point is used as a consensus master node, obtaining a first consensus block by accessing the metadata management service to pack a plurality of second metadata from the metadata storage table, and broadcasting the first consensus block to each second block link point, so that each second block link point can perform consensus on the first consensus block;
each block chain link point in the block chain system can determine who is used as a consensus main node according to a certain mechanism, and the block chain link points used as the consensus main nodes are responsible for packing blocks and broadcasting the blocks to other block chain nodes for consensus.
When the first chunk link point serves as a consensus master node, a consensus chunk (hereinafter referred to as a first consensus chunk for distinction) can be obtained by packing a plurality of metadata (hereinafter referred to as second metadata for distinction) from a metadata storage table by accessing a metadata management service. The first block link point may pack a plurality of metadata that have not been packed from the metadata storage table at regular time or according to other rules, and the specific packing rule is not limited in this embodiment. It is understood that the first metadata may be packaged as the second metadata if the first metadata is stored in the metadata storage table and packaged. The first chunk link may set the packaged transaction data to a packaged state through a metadata management service. In one embodiment, the first common identification block may include a transaction hash list composed of transaction hashes in the respective second metadata. Compared with the existing block packing complete transaction data, the identification block only comprises the metadata information in the transaction data in the embodiment.
The first block link points broadcast the packed first common blocks to each second block link node, and each second block link point performs common identification on the first common blocks. The specific process of the second block link point recognizing the first common node is not limited in this embodiment.
Further, in one embodiment, when the first block link point is served as the non-common master node, the first block link point receives a common block broadcasted by the second block link point as the common master node, and common identification is performed on the common block.
Step S50, obtaining second transaction data corresponding to the second metadata from a corresponding transaction storage pool according to the second metadata, executing each second transaction data to obtain a first execution result, and after detecting that the first consensus block is successfully identified, storing the first execution result and the first consensus block in the storage module to complete uplink of each second transaction data.
In the consensus process, the first block link point needs to execute the complete transaction data corresponding to the consensus block, that is, the transaction data corresponding to the second metadata (hereinafter, referred to as the second transaction data to indicate differences) needs to be executed, and the execution result is linked. Wherein the second metadata is metadata extracted based on the second transaction data and including a transaction hash of the second transaction data and an ID of a transaction storage pool storing the second transaction data. Since the first consensus block does not include complete transaction data, the first block link point may first obtain the second transaction data from the corresponding transaction storage pool according to the second metadata, and then execute the second transaction data. In one embodiment, the first chunk link point may extract a storage pool ID and a 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.
After the first blockchain node acquires the second transaction data, the first blockchain node executes the second transaction data to obtain an execution result (hereinafter referred to as a first execution result for distinction). It should be noted that, the process of executing the transaction data to obtain the execution result may refer to the existing block chain transaction data execution process, which is not limited and described herein.
Each block chain link point in the block chain system is preset with a certain consensus mechanism, and the success of consensus of the consensus blocks is determined when certain conditions are met. In this embodiment, the consensus mechanism is not limited, for example, in an embodiment, each block node may calculate a hash of each execution result, compare the hash values, and if the hash values are consistent, the consensus is considered to be successful.
When the first block link point detects that the first common identification block is successfully identified, the first execution result and the first common identification block can be stored in the storage module to complete the uplink of each second transaction data. It should be noted that, since the second transaction data is pre-stored in the storage module, during uplink, only the first execution result and the first common identification block need to be stored in the storage module, and the second transaction data does not need to be stored, thereby reducing the storage pressure during uplink of the transaction data. It is to be understood that after storing the first consensus block to the storage module, the corresponding transaction data may be looked up by the transaction hash in the first consensus block.
Further, in an embodiment, in order to recycle the memory cache, after the first common block and the first execution result are successfully written, the first block link point may notify the metadata management service to delete the second metadata in the metadata storage table through the storage module, and further notify the transaction storage pool to delete the second transaction data in the memory cache through the metadata management service.
Further, in an embodiment, in order to facilitate finding the block where the transaction data is located according to the transaction hash, when the first execution result and the first shared block are stored in the storage module, the mapping relationship between the transaction hash of the second transaction data and the first shared block may also be written in the storage module.
In the embodiment, by arranging the block chain nodes to comprise a plurality of transaction storage pools, and one metadata management service and one storage module corresponding to the plurality of transaction storage pools, the first block chain node allocates the received transaction data to one of the transaction storage pools for storage, submits the metadata of the transaction data to the metadata management service separately, and contains the transaction hash of the transaction data and the ID of the transaction storage pool for 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 according to the needs without influencing the packaging and execution of the transaction data, thereby solving the technical problem that the performance of the whole block chain system is limited due to insufficient expandability of the transaction pools, on one hand, the storage limit of the trading storage pool is eliminated, and on the other hand, the lateral expansibility of the trading storage pool is improved. After the transaction data in the transaction storage pool passes the verification of the transaction data and the first metadata passes the verification of the metadata management service, the metadata management service stores the first metadata into the metadata storage table, and then the metadata is packaged from the metadata storage table, so that the accuracy of the uplink transaction data is ensured; and after the transaction storage pool passes the transaction data verification and the metadata management service passes the first metadata verification, the first transaction data is stored to the storage module through the target transaction storage pool, so that only the execution result and the common identification block can be stored to the storage module without storing the transaction data during uplink, and the storage pressure during uplink of the transaction data is reduced.
Further, in an 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:
step S101, receiving first transaction data sent by a block chain client through any one block chain access module; or, receiving first transaction data broadcasted by a link point of a second block through any one of the transaction synchronization modules;
the block chain access modules of the block chain nodes can be expanded in a stateless parallel mode, namely, the number of the block chain access modules can be expanded or reduced according to needs, other modules of the block chain nodes do not need to be changed, and the function realization of the other modules is not influenced. The block chain client can send the transaction data to any block chain entry module of any block chain node.
The transaction synchronization modules of blockchain nodes can also be extended stateless in parallel. When the blockchain client sends the first transaction data to the second blockchain node, the second blockchain node may broadcast the first transaction data to any one 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. The second blockchain link point can also receive first transaction data sent by the blockchain client through any one blockchain entry module of the second blockchain node, and the first transaction data is broadcasted to the first blockchain node through any one transaction synchronization module of the second blockchain node.
The blockchain transaction processing method further comprises the following steps:
step S60, after signature verification of the first transaction data is passed through the target transaction storage pool, broadcasting the first transaction data to each second block chain node by using one of the transaction synchronization modules.
And the first block link point performs signature verification on the first transaction data through the target transaction storage pool, and after the first block link point passes the signature verification, the first block link point broadcasts the first transaction data to each second block link node by adopting one transaction synchronization module in the plurality of transaction synchronization modules. The mode of selecting the transaction synchronization module by the first block link point may be selected according to a certain load balancing policy, and is not limited in this embodiment.
Similarly, if the second blockchain link node receives the first transaction data sent by the blockchain client, after signature verification is carried out on the first transaction data through the transaction storage pool of the second blockchain node, the first transaction data is broadcasted to the first blockchain node by adopting one of the transaction synchronization modules of the plurality of transaction synchronization modules of the second blockchain node.
Further, in an embodiment, each of the block link access module and the transaction synchronization module may include a transaction allocator, and upon receiving the first transaction data, the first block link node may determine the target transaction storage pool, 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 through the transaction allocator.
Further, in an embodiment, the first block link point may further include a consensus module, the consensus module may include a consensus packing module and a consensus engine, the first block link point may pack transaction data from the metadata storage table through the consensus packing module to obtain a consensus block, and the consensus block is broadcasted to the second block link node through the consensus engine, so as to advance the whole network node to agree on the consensus block.
Further, in an embodiment, the first block link point may further include an execution module, the execution module may include a block executor and a transaction acquisition module, and the first block link point may acquire, by the transaction acquisition module, transaction data corresponding to the metadata from the storage module according to the metadata, and execute the acquired transaction data by the block executor.
Further, based on the first embodiment, a second embodiment of the blockchain transaction processing method of the present invention is provided, 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 after the identification, in order to simplify the procedure of the repeated verification and improve the accuracy of the verification, a transaction allocation policy may be set, so that when the first blockchain link receives the same transaction data, the same transaction data may be allocated to the same transaction storage pool, and at this time, only the transaction storage pool is required to perform the repeated verification on the allocated transaction data, and the metadata storage module is not required to perform the repeated verification on the metadata alone. There are various allocation strategies that can always allocate the same transaction data to the same transaction storage module, and this embodiment is not limited thereto.
Further, in an embodiment, a simple transaction allocation strategy is provided to realize that the same transaction data is allocated to the allocation strategy of the same transaction storage module in a time period when the number of the transaction storage modules in the first blockchain node does not change, so that the procedure of the repeatability verification can be simplified in the time period. Specifically, the step of determining the target trading storage pool from the plurality of trading storage pools in step S10 includes:
step S102, calculating the first transaction hash of the first transaction data, and taking the first transaction hash to the number of the transaction storage pool in the first block chain node to obtain a surplus result;
step S103, the trading storage pool with the ID of the surplus result in each trading storage pool is used as a target trading storage pool.
The first block link node may calculate a first transaction hash of the first transaction data after receiving the first transaction data, and obtain a remainder result by adding the first transaction hash to the number of the transaction storage pools in the first block link node. After the remainder result is obtained through calculation, the first block link point takes the transaction storage pool with the ID of the remainder result in the transaction storage pool as the target transaction storage pool, that is, the ID of the target transaction storage pool is the remainder result. For example, if the first transaction hash is represented by txHash and the number of transaction pool is N, then the remainder is (txHash% N), (txHash% N) is also the ID of the target transaction pool. Since the transaction hashes calculated from the same transaction data are the same, and the outcome of the same transaction hash for the same number of transaction storage pools is also the same, the same transaction data will be allocated to the same transaction storage pool for a period of time when the number of transaction storage pools does not change.
Further, in an embodiment, before the step S30, the method further includes:
step A10, when the first transaction data is allocated to the target transaction storage pool, caching the first transaction data through the target transaction storage pool;
when an allocation policy that the same transaction data is always allocated to the same transaction storage pool is not adopted, or when an allocation policy that the same transaction data is always allocated to the same transaction storage pool is adopted but the accuracy of rejecting duplicate transaction data needs to be further improved, in the present embodiment, a manner of performing double-duplicate verification by the transaction storage pool and the metadata management service may be adopted.
Specifically, when the target trading pool is assigned to the first trading data, the first chunk link point may first cache the first trading data via the target trading pool.
Step A20, performing a verification operation on the cached first transaction data through the target transaction storage pool, and sending a 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 pass, the verification of the first transaction data is passed;
the first block link point performs a verification operation on the cached first transaction data through the target transaction storage pool, and the verification operation may include a repeatability verification operation and a signature verification operation, and when both the repeatability verification operation and the signature verification operation pass, the first transaction data verification is passed. The order of the repeated verification operation and the signature verification operation may not be limited, and when one verification operation fails, another verification operation may not be performed.
The first chunk link point sends the verification result to the metadata management service via the target transactional storage pool. In a specific implementation manner, the results of the two verification operations may be sent to the metadata management service in sequence, or may be summarized and sent to the metadata management service as a final result, but regardless of how the verification results are sent, the metadata management service may determine whether the first transaction data passes verification or fails verification according to the verification results.
Step A30, when the metadata management service submits the first metadata, caching the first metadata to an alternative metadata cache table through the metadata management service;
when the metadata management service is submitted with the first metadata, the first chunk node may first cache the first metadata to an alternative metadata cache table for storing metadata that has not yet been verified through the metadata management service.
Step A40, when the metadata management service receives a verification result indicating that the first transaction data is verified, and the first metadata is repeatedly verified by the metadata management service, performing the step S30.
When the metadata management service receives a verification result which is sent by the target transaction storage pool and indicates that the first transaction data passes verification, and the metadata management service repeatedly verifies the first metadata, the first block link point can store the first transaction data to the storage module through the target transaction storage pool, and the metadata management service stores the first metadata to the metadata storage table. Further, when the metadata management service receives a verification result indicating that the first transaction data passes verification and repeatedly verifies the first metadata, the first block link point notifies the target transaction storage pool through the metadata management service to store the first transaction data in the storage module, and the target transaction storage pool stores the first transaction data in the storage module after receiving the notification. Further, after storing the first metadata in the metadata storage table, the first blockchain node may delete the first metadata from the alternative metadata cache table.
It should be noted that, when the metadata management service receives the first metadata first and does not receive the verification result of the first transaction data sent by the target transaction storage pool, the first block link point may cache the first metadata in the alternative metadata cache table through the metadata management service first, and may perform repeated verification first, and perform subsequent operations according to the verification result after receiving the verification result sent by the target transaction storage pool. When the metadata management service receives the verification result of the first transaction data sent by the target transaction storage pool first and does not receive the first metadata yet, the verification result of the first transaction data may be cached, for example, in the alternative metadata cache table, and after receiving the first metadata, the metadata management service may perform subsequent operations.
Further, in an embodiment, after the step a20, the method further includes:
step A50, deleting the first transaction data cached in the target transaction storage pool when the verification result indicates that the first transaction data verification failed;
when the first block link point verifies the first transaction data through the target transaction storage pool to obtain a verification result for identifying that the first transaction data is verified unsuccessfully, the first block link point may delete the cached first transaction data directly through the target transaction storage pool to indicate rejection of the first transaction data. It will be appreciated that the first blockchain node will also notify the metadata management service of the failed verification result via the target transaction storage pool.
After the step a30, the method further includes:
a step a60, when the metadata management service receives a verification result indicating that the first transaction data is failed to be verified, deleting the first metadata in the alternative metadata cache table by the metadata management service;
when the metadata management service receives a verification result indicating that the first transaction data fails to be verified, the first block link point may delete the first metadata in the alternative metadata cache table through the metadata management service. When the metadata management service receives a verification result indicating that the first transaction data verification fails, the first metadata is not received, and then the metadata management service can delete the first metadata in the alternative metadata cache table after receiving the first metadata and caching the first metadata in the alternative metadata cache table without repeatedly verifying the first metadata; when the metadata management service receives the verification result indicating that the first transaction data is failed to be verified, the first metadata is received and cached in the alternative metadata cache table, the first block link point can delete the first metadata in the alternative metadata cache table directly through the metadata management service.
Step a70, when the metadata management service receives a verification result indicating that the first transaction data is verified, and when the metadata management service fails to repeatedly verify the first metadata, deleting the first metadata in the alternative metadata cache table by the metadata management service, and notifying the target transaction storage pool by the metadata management service of deleting the cached first transaction data.
When the metadata management service receives a verification result indicating that the first transaction data passes verification and the metadata management service fails to repeatedly verify the first metadata, the first block link point may delete the first metadata in the alternative 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. When the metadata management service receives a verification result indicating that the first transaction data passes the verification, the first metadata is not received, then the metadata management service can wait for the metadata management service to receive the first metadata and cache the first metadata in the alternative metadata cache table, then repeatedly verify the first metadata, delete the first metadata in the alternative metadata cache table when the repeated verification fails, and inform the target transaction storage pool of deleting the first transaction data; when the metadata management service receives a verification result indicating that the first transaction data passes the verification, the first transaction data is already received and cached in the alternative metadata cache table, and the verification result indicating that the repeated verification fails is obtained, the first block link point can delete the first transaction data in the alternative metadata cache table through the metadata management service, and inform the target transaction storage pool of deleting the first transaction data.
It should be noted that, when receiving the notification of deleting the cached first transaction data from the metadata management service, the target transaction storage pool may delete the first transaction data to indicate that the first transaction data is rejected from being received.
Further, based on the first and/or second embodiments, a third embodiment of the blockchain transaction processing method of the present invention is provided, in this embodiment, the method further includes:
step B10, when receiving a second consensus chunk broadcast by the second chunk link node, decoding a third transaction hash in the second consensus chunk;
when the first segment link point is a non-common master node, a common segment (hereinafter referred to as a second common segment for distinction) broadcasted by a second segment link point serving as a common master node may be received, and the second common segment may be common. The process of obtaining the second common block by the second block link point may refer to the process of obtaining the first common block by the first block link point, which is not described in detail in this embodiment.
Specifically, when the first chunk node receives a second consensus chunk broadcast by a second chunk node, the transaction hash in the second consensus chunk may be decoded (hereinafter referred to as a third transaction hash to distinguish).
Step B20, determining whether a third metadata corresponding to the third transaction hash is stored in the metadata storage table by accessing the metadata management service;
the first chunk link node may first determine whether the metadata corresponding to the third transaction hash (hereinafter referred to as third metadata for distinction) is included in the metadata storage table by accessing a metadata management service. It will be appreciated that the third metadata is metadata containing a third transaction hash.
Step B30, if the third metadata is stored in the metadata storage table, obtaining third transaction data corresponding to the third metadata from a corresponding transaction storage pool according to the third metadata, executing the third transaction data to obtain a second execution result, and after detecting that the second consensus block is successfully identified, storing the second execution result and the second consensus block in the storage module to complete the uplink of the third transaction data;
if the metadata storage table already stores third metadata, which indicates that the first chunk link point has received transaction data corresponding to the third transaction hash (hereinafter referred to as 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 chunk link point may directly obtain the third transaction data from the corresponding transaction storage pool according to the third metadata. After the third transaction data is acquired, the first block link point may execute the third transaction data to obtain an execution result (hereinafter referred to as a second execution result).
When the first block link point detects that the second consensus block is successful, the second execution result and the second consensus block can be stored in the storage module to complete the uplink of the third transaction data. It should be noted that, since the third transaction data is pre-stored in the storage module, during the uplink, only the second execution result and the second consensus block need to be stored in the storage module, and the third transaction data does not need to be stored, thereby reducing the storage pressure during the uplink of the transaction data. It is to be appreciated that after storing the second consensus chunk to the storage module, the corresponding transaction data can be looked up by the transaction hash in the second consensus chunk. Further, in an embodiment, in order to facilitate finding the block where the transaction data is located according to the transaction hash, when the second execution result and the second consensus block are stored in the storage module, the mapping relationship between the transaction hash of the third transaction data and the second consensus block may also be written in the storage module.
Step B40, if the third metadata is not stored in the metadata storage table, requesting the second chunk node to acquire the third transaction data corresponding to the third transaction hash;
if the metadata storage table does not store the third metadata, which indicates that the first block link point has not received the third transaction data before, at this time, the first block link point may request the second block link point serving as the consensus master node to acquire the third transaction data. Specifically, the first blockchain link may send the third transaction hash to the second blockchain node; and searching by the second blockchain node from the storage module according to the third transaction hash to obtain third transaction data, or searching metadata corresponding to the third transaction hash (not the third metadata, but the metadata stored in the metadata storage table of the second blockchain node) in the metadata management service, and obtaining the third transaction data from the corresponding transaction storage pool according to the metadata.
Step B50, if the third transaction data is obtained from the second block link point, executing the third transaction data to obtain the second execution result, and after detecting that the second consensus block is successfully identified, storing the third transaction data, the second execution result, and the second consensus block in the storage module to complete the uplink of the third transaction data;
if the first block link point can acquire the third transaction data from the second block link point, the execution of the acquired third transaction data obtains an execution result (also referred to as a second execution result here since the execution of the third transaction data is also the result obtained by executing the third transaction data). The operation after the second execution result is obtained is the same as the operation after the second execution result is obtained in step S30, except that the third transaction data is also stored in the storage module, because the third transaction data is not stored in the storage module by the first block link point before.
It should be noted that, the first block link point may determine whether the transaction data returned by the second block link point is the third transaction data by calculating a hash of the transaction data returned by the second block link point and comparing the hash with the third transaction hash to determine whether the transaction data returned by the second block link point is the third transaction data.
Step B60, if the third transaction data is not acquired from the second blockchain node, determining that the second consensus block is invalid, and rejecting uplink to the second consensus block.
If the first blockchain node does not acquire the third transaction data from the second blockchain node, the first blockchain node may determine that the second common identification block is invalid, and refuse to uplink the second common identification block.
Further, based on the first, second and/or third embodiments, a fourth embodiment of the method for processing blockchain transactions of the present invention is provided, in this embodiment, the step of obtaining second transaction data corresponding to the second metadata from a corresponding transaction storage pool according to the second metadata in step S50 includes:
step S501, extracting a storage pool ID from the second metadata, and accessing a trading storage pool corresponding to the storage pool ID to determine the state of the trading storage pool;
the process of the first block link point acquiring 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 an ID of a transaction storage pool storing the second transaction data. The first chunk link point accesses the transactional memory pool corresponding to the memory pool ID to determine the status of the transactional memory pool. The transactional memory pool may be in a normal operational state or in a down state due to a failure.
Step S502, if the transaction storage pool corresponding to the storage pool ID is in a normal working state, second transaction data corresponding to a second transaction hash is obtained from the transaction storage pool corresponding to the storage pool ID according to the second transaction hash in the second metadata;
when the transaction storage pool corresponding to the storage pool ID is in a normal operating state, the first chunk link point may obtain, according to a second transaction hash in the second metadata, second transaction data corresponding to the second transaction hash from the transaction storage pool corresponding to the storage pool ID. That is, when the transaction storage pool corresponding to the storage pool ID is in a normal state, the second transaction data may be normally acquired from the transaction storage pool.
Step S503, if the transaction storage pool corresponding to the storage pool ID is in a downtime state, accessing the storage module, and acquiring second transaction data corresponding to the second metadata from the storage module according to the second transaction hash.
When the transaction storage pool corresponding to the storage pool ID is in a downtime state, the second transaction data cannot be normally acquired from the transaction storage pool, and at this time, the first block link point may acquire, from the storage module, the second transaction data corresponding to the second metadata according to the second transaction hash in the second metadata.
In this embodiment, since the transaction data is stored in the storage module in advance, when the transaction storage pool goes down, the complete transaction data can be acquired from the storage module to be executed, so that the reliability of the blockchain system is improved.
Further, in an embodiment, the method further comprises:
step C10, loading fourth metadata from the storage module to the metadata storage table after the metadata management service is down and restarted;
when the metadata management service is down and restarted, the first block link point may load metadata (hereinafter referred to as fourth metadata for distinction) from the storage module and restore the metadata to the metadata storage table, so as to ensure that subsequent operations such as packaging, consensus and the like can be continuously and normally executed.
Step C20, notifying the transaction storage pool corresponding to the storage pool ID in the fourth metadata through the metadata management service to load and cache the fourth transaction data corresponding to the fourth metadata from the storage module.
After the fourth metadata is restored to the metadata storage table, the first block link point may further notify, through the metadata management service, the transaction storage pool corresponding to the storage pool ID in the fourth metadata to load fourth transaction data corresponding to the fourth metadata from the storage module, after receiving the notification, the transaction storage pool may check whether the fourth transaction data is cached, and if the fourth transaction data is not cached, the fourth transaction data may be cached, so as to ensure zero loss of the transaction data.
In addition, an embodiment of the present invention further provides a computer-readable storage medium, where the storage medium stores a blockchain transaction processing program, and the blockchain transaction processing program, when executed by a processor, implements the steps of the blockchain transaction processing method as described below.
For the embodiments of the blockchain transaction processing device and the computer-readable storage medium of the present invention, reference may be made to the embodiments of the blockchain transaction processing method of the present invention, and details are not repeated herein.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A blockchain transaction processing method applied to a first blockchain node, wherein the first blockchain node comprises a plurality of transaction storage pools and a metadata management service and a storage module corresponding to the plurality of transaction storage pools, the method comprising the steps of:
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;
extracting first metadata of the first transaction data, submitting the first metadata to the metadata management service, wherein the first metadata comprises a first transaction hash of the first transaction data and an ID of the target transaction storage pool;
after the first transaction data is verified through the target transaction storage pool and the first metadata is verified through the metadata management service, the first metadata is stored to a metadata storage table through the metadata management service, and the first transaction data is stored to the storage module through the target transaction storage pool;
when the first block link point serves as a consensus main node, a first consensus block is obtained by packaging a plurality of second metadata from the metadata storage table through accessing the metadata management service, and the first consensus block is broadcasted to each second block link point so that each second block link point can perform consensus on the first consensus block;
and acquiring second transaction data corresponding to the second metadata from a corresponding transaction storage pool according to the second metadata, executing each second transaction data to obtain a first execution result, and storing the first execution result and the first common identification block to the storage module to complete uplink of each second transaction data after detecting that the first common identification block is successfully identified.
2. The blockchain transaction processing method of claim 1, wherein said step of determining a target trading storage pool from among said plurality of trading storage pools comprises:
calculating the first transaction hash of the first transaction data, and taking the first transaction hash to balance the number of the transaction storage pools in the first block chain node to obtain a balance result;
and taking the transaction storage pool with the ID of the surplus result in each transaction storage pool as a target transaction storage pool.
3. The blockchain transaction processing method of claim 1, wherein said step of storing said first transaction data in a metadata storage table by said metadata management service and said first transaction data in said storage module by said target transaction storage pool after said first transaction data is verified by said target transaction storage pool and said first metadata is verified by said metadata management service further comprises, before said step of storing said first transaction data in said storage module by said target transaction storage pool:
caching the first transaction data via the target transaction pool when the target transaction pool is assigned the first transaction data;
verifying the cached first transaction data through the target transaction storage pool, and sending a verification result to the metadata management service, wherein the verification operation comprises a repeatability verification operation and a signature verification operation, and when the repeatability verification operation and the signature verification operation both pass, the verification of the first transaction data is passed;
caching, by the metadata management service, the first metadata to an alternative metadata cache table when the metadata management service is submitted with the first metadata;
when the metadata management service receives a verification result indicating that the first transaction data passes verification and the metadata management service passes repeated verification of the first metadata, the steps of storing the first metadata into a metadata storage table through the metadata management service and storing the first transaction data into the storage module through the target transaction storage pool are executed.
4. The blockchain transaction processing method of claim 3, wherein after the step of performing a verification operation on the cached first transaction data through the target transaction pool and sending a verification result to the metadata management service, further comprising:
deleting the cached first transaction data through the target transaction storage pool when the verification result indicates that the first transaction data is verified unsuccessfully;
after the step of caching the first metadata to an alternative metadata cache table by the metadata management service when the metadata management service is submitted with the first metadata, the method further includes:
deleting, by the metadata management service, the first metadata in the alternative metadata cache table when the metadata management service receives a verification result indicating that the first transaction data verification failed;
when the metadata management service receives a verification result indicating that the first transaction data passes verification and the repeated verification of the first metadata by the metadata management service fails, deleting the first metadata in the alternative metadata cache table by the metadata management service, and informing the target transaction storage pool of deleting the cached first transaction data by the metadata management service.
5. The blockchain transaction processing method of claim 1, wherein when the first blockchain link point is acting as a non-consensus master node, the method further comprises:
decoding a third transaction hash in a second consensus chunk of the second chunk nexus broadcast when the second consensus chunk is received;
determining whether third metadata corresponding to the third transaction hash is stored in the metadata storage table by accessing the metadata management service;
if the third metadata is stored in the metadata storage table, acquiring third transaction data corresponding to the third metadata from a corresponding transaction storage pool according to the third metadata, executing the third transaction data to obtain a second execution result, and storing the second execution result and the second consensus block to the storage module to complete uplink of the third transaction data after successful consensus of the second consensus block is detected;
if the third metadata is not stored in the metadata storage table, requesting the second block link node to acquire the third transaction data corresponding to the third transaction hash;
if the third transaction data is acquired from the second block link point, executing the third transaction data to obtain a second execution result, and after detecting that the second consensus block is successful, storing the third transaction data, the second execution result and the second consensus block in the storage module to complete the uplink of the third transaction data;
and if the third transaction data is not acquired from the second block link node, determining that the second common identification block is invalid, and rejecting uplink of the second common identification block.
6. The blockchain transaction processing method of claim 1, wherein the step of obtaining second transaction data corresponding to the second metadata from a corresponding transaction storage pool according to the second metadata comprises:
extracting a storage pool ID from the second metadata, and accessing a trading storage pool corresponding to the storage pool ID to determine the state of the trading storage pool;
if the transaction storage pool corresponding to the storage pool ID is in a normal working state, acquiring second transaction data corresponding to a second transaction hash from the transaction storage pool corresponding to the storage pool ID according to the second transaction hash in the second metadata;
and if the transaction storage pool corresponding to the storage pool ID is in a downtime state, accessing the storage module, and acquiring second transaction data corresponding to the second metadata from the storage module according to the second transaction hash.
7. The blockchain transaction processing method of claim 1, wherein the method further comprises:
after the metadata management service is restarted in a downtime manner, loading fourth metadata from the storage module to the metadata storage table;
and informing the transaction storage pool corresponding to the storage pool ID in the fourth metadata through the metadata management service to load and cache fourth transaction data corresponding to the fourth metadata from the storage module.
8. The blockchain transaction processing method of any one of claims 1 to 7, wherein the first blockchain node further includes at least one blockchain access module and at least one transaction synchronization module, the step of receiving first transaction data including:
receiving first transaction data sent by a blockchain client through any one blockchain access module; or, receiving first transaction data broadcasted by a link point of a second block through any one of the transaction synchronization modules;
the blockchain transaction processing method further comprises the following steps:
and after signature verification of the first transaction data is passed through the target transaction storage pool, broadcasting the first transaction data to each second block chain node by adopting one of the transaction synchronization modules.
9. A blockchain transaction processing device, the blockchain transaction processing device comprising: memory, a processor and a blockchain transaction processing program stored on the memory and executable on the processor, the blockchain transaction processing program when executed by the processor implementing the steps of the blockchain transaction processing method according to any one of claims 1 to 8.
10. A computer-readable storage medium having stored thereon a blockchain transaction processing program, which when executed by a processor implements the steps of the blockchain transaction processing method of any one of claims 1 to 8.
CN202111260228.0A 2021-10-28 2021-10-28 Block chain transaction processing method, equipment and computer readable storage medium Pending CN113986922A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111260228.0A CN113986922A (en) 2021-10-28 2021-10-28 Block chain transaction processing method, equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111260228.0A CN113986922A (en) 2021-10-28 2021-10-28 Block chain transaction processing method, equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN113986922A true CN113986922A (en) 2022-01-28

Family

ID=79743059

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111260228.0A Pending CN113986922A (en) 2021-10-28 2021-10-28 Block chain transaction processing method, equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN113986922A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115953243A (en) * 2022-12-28 2023-04-11 北京航天智造科技发展有限公司 Block chain-based bulk transaction management system, method and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115953243A (en) * 2022-12-28 2023-04-11 北京航天智造科技发展有限公司 Block chain-based bulk transaction management system, method and storage medium
CN115953243B (en) * 2022-12-28 2024-03-29 北京航天智造科技发展有限公司 Block chain-based block transaction management system, method and storage medium

Similar Documents

Publication Publication Date Title
CN107329820B (en) Task processing method and device for cluster system
CN109831487B (en) Fragmented file verification method and terminal equipment
CN111767347B (en) Switching method and device of consensus algorithm, node equipment and storage medium
CN111586147B (en) Node synchronization method, device, equipment and storage medium of block chain
US11107079B2 (en) Methods, systems, apparatuses and devices for verifying credibility of consortium blockchain
CN106802939B (en) Method and system for solving data conflict
CN107102908B (en) Data verification method, data fault tolerance method and device
CN105653406A (en) Method for managing distributed storage system and distributed storage system
CN111400330A (en) Task processing method, device, equipment and computer readable storage medium
CN113986922A (en) Block chain transaction processing method, equipment and computer readable storage medium
CN112559637A (en) Data processing method, device, equipment and medium based on distributed storage
KR20190015327A (en) Methods and Devices to Prevent Servers from Attacking
KR20180109921A (en) Data storage and service processing methods and devices
US10462258B2 (en) Resource download method, electronic device, and apparatus
CN116185623A (en) Task allocation method and device, electronic equipment and storage medium
CN107025129B (en) Data processing method and device
CN113672634A (en) Policy data verification method, device, equipment and storage medium
JP5857806B2 (en) Distributed processing system test method and distributed processing system
US20150095496A1 (en) System, method and medium for information processing
CN110275772B (en) Data processing method and related equipment thereof
CN115686368A (en) Method, system, apparatus and medium for storage capacity expansion of nodes of block chain network
CN106888244B (en) Service processing method and device
US10489239B2 (en) Multiplexing system, multiplexing method, and computer program product
CN113032188B (en) Method, device, server and storage medium for determining main server
CN116455753B (en) Data smoothing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination