Transaction Processing Method and Related Products

The method of using backup blockchain networks to maintain transaction data across multiple interconnected nodes addresses the instability and unreliability of blockchain systems, ensuring data integrity and reliability.

CN116107801BActive Publication Date: 2025-07-15TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111334943.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-11
Publication Date
2025-07-15
Estimated Expiration
2041-11-11

AI Technical Summary

Technical Problem

The stability and reliability of blockchain nodes are poor, resulting in data loss or failure to save.

Method used

By configuring multiple blockchains that are backed up by each other, transaction data is preferred on the target blockchain that matches the account identification of the transaction requester, and when the target blockchain is abnormal, switch to the peer blockchain that is backed up by each other for data storage.

Benefits of technology

Improves the stability and reliability of the blockchain to ensure that transaction data can still be successfully saved under abnormal circumstances.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116107801B_ABST
    Figure CN116107801B_ABST
Patent Text Reader

Abstract

This application belongs to the field of blockchain technology, and specifically relates to a transaction processing method, a transaction processing device, a computer-readable medium, an electronic device, and a computer program product. The method includes: in response to a transaction request, obtaining an account identifier of the transaction requestor, where the account identifier is a unique identifier assigned to the transaction requestor when registering the account; selecting a target blockchain that matches the account identifier from at least two mutually backup blockchains; if the target blockchain is in a healthy state, executing the transaction through the target blockchain network that maintains the target blockchain, and saving the transaction execution result to the target blockchain when the transaction is successfully executed; if the target blockchain is in an unhealthy state, or the transaction execution through the target blockchain network fails, executing the transaction through the peer blockchain network that maintains the peer blockchain, and saving the transaction execution result to the peer blockchain when the transaction is successfully executed. This application can improve the stability and reliability of the blockchain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the technical field of blockchain, and particularly relates to a transaction processing method, a transaction processing device, a computer-readable medium, an electronic device, and a computer program product. Background Art

[0002] As a distributed database, blockchain can use its decentralized feature to store the same ledger on all blockchain nodes, thereby improving the security and reliability of transaction data storage. Maintaining a blockchain by a large number of blockchain nodes places relatively high requirements on the stability and reliability of the blockchain nodes. Once a blockchain node fails, problems such as blockchain data loss or data storage failure will occur. Summary of the Invention

[0003] The purpose of this application is to provide a transaction processing method, a transaction processing device, a computer-readable medium, an electronic device, and a computer program product, which can at least overcome to some extent the technical problem of poor stability and reliability of the blockchain in the related art.

[0004] Other features and advantages of this application will become apparent through the following detailed description, or will be learned in part through the practice of this application.

[0005] According to one aspect of the embodiments of this application, a transaction processing method is provided, and the method includes:

[0006] In response to a transaction request, obtain the account identifier of the transaction requester, where the account identifier is a unique identifier assigned to the transaction requester when registering the account;

[0007] Select a target blockchain that matches the account identifier from at least two mutually backup blockchains;

[0008] If the target blockchain is in a healthy state, execute the transaction through the target blockchain network that maintains the target blockchain, and save the transaction execution result to the target blockchain when the transaction is successfully executed;

[0009] If the target blockchain is in an unhealthy state, or the transaction execution through the target blockchain network fails, execute the transaction through the peer blockchain network that maintains the peer blockchain, and save the transaction execution result to the peer blockchain when the transaction is successfully executed. The peer blockchain is a blockchain that is mutually backup with the target blockchain, and the peer blockchain network and the target blockchain network have at least one different blockchain node.

[0010] According to one aspect of the embodiments of this application, a transaction processing device is provided, and the device includes:

[0011] An identity acquisition module, configured to acquire an account identity of a transaction requester in response to a transaction request, where the account identity is a unique identity assigned to the transaction requester when registering the account;

[0012] A blockchain selection module, configured to select a target blockchain that matches the account identity from at least two mutually backup blockchains;

[0013] A first transaction saving module, configured to, if the target blockchain is in a healthy state, execute the transaction through a target blockchain network that maintains the target blockchain, and save the transaction execution result to the target blockchain when the transaction is successfully executed;

[0014] A second transaction saving module, configured to, if the target blockchain is in an unhealthy state, or the transaction execution through the target blockchain network fails, execute the transaction through a peer blockchain network that maintains a peer blockchain, and save the transaction execution result to the peer blockchain when the transaction is successfully executed, where the peer blockchain is a blockchain that is mutually backup with the target blockchain, and the peer blockchain network and the target blockchain network have at least one different blockchain node.

[0015] According to one aspect of the embodiments of the present application, there is provided a computer-readable medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the transaction processing method in the above technical solution.

[0016] According to one aspect of the embodiments of the present application, there is provided an electronic device, which includes: a processor; and a memory for storing executable instructions of the processor; wherein, the processor is configured to execute the transaction processing method in the above technical solution by executing the executable instructions.

[0017] According to one aspect of the embodiments of the present application, there is provided a computer program product or a computer program, which includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the transaction processing method in the above technical solution.

[0018] In the technical solution provided by the embodiments of the present application, by configuring multiple mutually backup blockchains, it is possible to preferentially save transaction data through a target blockchain that matches the account identity of the transaction requester when receiving a transaction request, and when the target blockchain is abnormal, the transaction data can be saved through a peer blockchain that is mutually backup with the target blockchain. Therefore, the stability and reliability of the blockchain can be improved.

[0019] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit the present application. Brief Description of the Drawings

[0020] The drawings herein are incorporated into and constitute a part of this specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application. Obviously, the drawings in the following description are only some embodiments of the present application, and those of ordinary skill in the art can obtain other drawings based on these drawings without creative efforts.

[0021] Figure 1 Shows a schematic diagram of the composition of the blockchain system in an embodiment of the present application.

[0022] Figure 2 Shows the composition structure of the blockchain maintained on the blockchain network.

[0023] Figure 3 Shows the network architecture of the blockchain network applying the technical solution of the present application.

[0024] Figure 4 Shows a flowchart of the steps of the transaction processing method in an embodiment of the present application.

[0025] Figure 5 Shows a flowchart of the steps of selecting a target blockchain in an embodiment of the present application.

[0026] Figure 6 Shows a flowchart of the steps of performing identity matching detection based on hash operation in an embodiment of the present application.

[0027] Figure 7 Shows a schematic diagram of the hash ring of nodes assigned with hash values in an embodiment of the present application.

[0028] Figure 8 Shows a schematic diagram of the hash ring of equivalently assigning hash values based on multiple hashes in an embodiment of the present application.

[0029] Figure 9 Shows a flowchart of the steps of determining the running state of the target blockchain according to historical running parameters in an embodiment of the present application.

[0030] Figure 10 Shows a schematic diagram of the business processing process in an application scenario of the embodiment of the present application.

[0031] Figure 11 Schematically shows a structural block diagram of the transaction processing device provided by the embodiment of the present application.

[0032] Figure 12A computer system block diagram of an electronic device suitable for implementing the embodiments of the present application is schematically shown. Detailed implementation manners

[0033] Example embodiments will now be described more fully with reference to the accompanying drawings. However, the example embodiments can be implemented in various forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more complete and comprehensive, and will fully convey the concept of the example embodiments to those skilled in the art.

[0034] In addition, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of the embodiments of this application. However, those skilled in the art will realize that the technical solutions of this application can be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of this application.

[0035] The block diagrams shown in the drawings are only functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0036] The flowcharts shown in the drawings are only illustrative and do not necessarily include all the contents and operations / steps, nor do they necessarily need to be executed in the described order. For example, some operations / steps can be decomposed, while some operations / steps can be combined or partially combined, so the actual execution order may change according to the actual situation.

[0037] A blockchain is a digital ledger with a chained-block data structure that is anti-counterfeiting, anti-tampering, and traceable, and is shared in a peer-to-peer network environment through transparent and trusted rules. The chained-block data structure stores the transaction processing that occurs within a period of time in blocks, and uses cryptographic algorithms to connect the blocks in chronological order into a chain. The ledger is distributed to all member nodes in the network, and in the sequential chain of blocks linked by hash cryptographic algorithms, the historical records of asset transactions that occur between peer nodes in the network are permanently recorded. All confirmed and proven transactions are linked from the beginning of the chain to the latest block, hence the name blockchain. The blockchain can serve as a single source of truth, and members in the blockchain network can only view the transactions related to them.

[0038] Figure 1 The figure shows a schematic diagram of the composition of the blockchain system in an embodiment of the present application. The blockchain system 100 may include at least one client 110 and a blockchain network 120, and the blockchain network 120 includes at least one blockchain node 121. The client 110 may be various electronic devices such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart wearable device, a smart vehicle-mounted device, a smart payment terminal, a face recognition terminal, etc. By installing the corresponding client application program, blockchain data services can be provided to users. The blockchain node 121 may be a terminal device or a server. For example, the blockchain node 121 may be an independent physical server, or a server cluster composed of multiple physical servers, or a cloud server providing cloud computing services.

[0039] In the blockchain network 120, each blockchain node 121 can receive input information during normal operation and maintain shared data within the blockchain network based on the received input information. To ensure information intercommunication, there may be information connections between the blockchain nodes 121, and the blockchain nodes 121 can transmit information through the information connections with each other. For example, when any blockchain node 121 in the blockchain network 120 receives input information and broadcasts the input information in the blockchain network 120, other node devices in the blockchain network 120 can obtain the input information according to the consensus algorithm and store the input information as shared data.

[0040] For each blockchain node 121 in the blockchain network 120, it has a corresponding node identifier, and each blockchain node 121 in the blockchain network 120 can store the node identifiers of other blockchain nodes in the same blockchain network, so as to broadcast the generated block to other nodes in the blockchain network 120 according to the node identifiers of other blockchain nodes in the future. A node identifier list as shown in Table 1 can be maintained in the blockchain node 121, and the node name and the node identifier are correspondingly stored in the node identifier list. Among them, the node identifier may be an IP (Internet Protocol) address and any other information that can be used to identify the node. Table 1 is a node identifier list taking the IP address as an example.

[0041] Table 1

[0042] Node Name Node Identifier Node 1 117.114.151.174 Node 2 117.116.189.145 … … Node N 119.123.789.258

[0043] Figure 2 The figure shows the composition structure of the blockchain maintained on the blockchain network. As Figure 2As shown in the figure, a blockchain consists of multiple sequentially connected blocks. Whenever new data needs to be written into the blockchain, this data will be aggregated into a newly generated block, and the newly generated block will be linked to the end of the blockchain. Through the consensus algorithm, it can be ensured that the newly added blocks on each node device 121 are exactly the same. In the block body of each block, the data of the current block is recorded, and at the same time, the hash value (Hash) of the previous block connected to it is saved in its block header. If the transaction data in the previous block changes, then the hash value of the current block will also change accordingly. Therefore, the data uploaded to the blockchain network is difficult to be tampered with, which can improve the reliability of shared data.

[0044] Figure 3 The network architecture of the blockchain network applying the technical solution of the present application is shown. As Figure 3 shown, the blockchain network applying the technical solution of the present application adopts a hierarchical model, specifically including a core network 310, a data node network 320, and a service network 330.

[0045] The core network 310 consists of consensus nodes 311, which are responsible for the consensus of the blockchain network, packing transactions into blocks and performing consensus accounting. The consensus nodes 311 are nodes with the right to account generated by blockchain nodes in the blockchain network through methods such as voting elections or rotation appointments.

[0046] The data node network 320 consists of data nodes 321, which are responsible for synchronizing the ledger information of the core network 310, that is, synchronizing the latest block data, and providing data reading services for the service network 330.

[0047] The service network 330 consists of service nodes 331 or light nodes 332, which are responsible for synchronizing the block data of the service itself from the data node network 320, and data isolation is performed by the data node network 320. The service nodes 331 are nodes directly connected to user terminal devices, and a complete blockchain copy including the block header and block body is stored on them, and they can independently provide blockchain service to users. The light nodes 332 are lightweight nodes, specifically nodes that do not store or maintain a complete blockchain copy and only store the minimum amount of state to send or transfer transaction information; only the block header data of each block in the blockchain can be stored on the light nodes 332. When receiving a service request from a user to query specific block data, the light nodes 332 can interact with adjacent service nodes 331 to indirectly provide services to users.

[0048] Adopt a network hierarchical structure, and each layer of the network can be infinitely expanded, especially the business network. The data node network and the core network can be restricted within a certain size range on the premise of ensuring the high performance and high availability of the overall network. A large number of business nodes will be connected to multiple data nodes and synchronize their own block data with the data nodes in a relatively real-time manner.

[0049] The following will make a detailed description of the technical solutions such as the transaction processing method, transaction processing device, computer-readable medium, electronic device, and computer program product provided by the present application in combination with specific implementation manners.

[0050] Figure 4 The flowchart of the steps of the transaction processing method in an embodiment of the present application is shown. This transaction processing method can be executed by Figure 1 the client or blockchain node shown. The method executed by the blockchain node in the embodiment of the present application is taken as an example for description. As Figure 4 shown, this transaction processing method mainly may include the following steps S410 to step S440.

[0051] Step S410: In response to a transaction request, obtain the account identifier of the transaction requestor. The account identifier is a unique identifier assigned to the transaction requestor when registering the account.

[0052] Step S420: Select a target blockchain that matches the account identifier from at least two mutually backup blockchains.

[0053] Step S430: If the target blockchain is in a healthy state, execute the transaction through the target blockchain network that maintains the target blockchain, and save the transaction execution result to the target blockchain when the transaction is successfully executed.

[0054] Step S440: If the target blockchain is in an unhealthy state, or the transaction execution by the target blockchain network fails, execute the transaction through the peer blockchain network that maintains the peer blockchain, and save the transaction execution result to the peer blockchain when the transaction is successfully executed. The peer blockchain is a blockchain that is mutually backup with the target blockchain, and the peer blockchain network and the target blockchain network have at least one different blockchain node.

[0055] In the transaction processing method provided by the embodiment of the present application, by configuring multiple mutually backup blockchains, when receiving a transaction request, the transaction data can be preferentially saved through the target blockchain that matches the account identifier of the transaction requestor. When the target blockchain has an abnormality, the transaction data can be saved through the peer blockchain that is mutually backup with the target blockchain. Therefore, the stability and reliability of the blockchain for saving data can be improved.

[0056] The following will make a detailed description of each method step of the transaction processing method respectively.

[0057] In step S410, in response to a transaction request, obtain the account identifier of the transaction requester. The account identifier is a unique identifier assigned to the transaction requester when registering the account.

[0058] Data processing operations such as data generation, data transfer, and data storage on the blockchain network are all implemented through transactions. A transaction request is a business request initiated by a user to process data on the blockchain. Taking digital resources such as electronic contracts and electronic invoices saved on the blockchain as an example, a user can initiate transaction requests such as querying, transferring, and storing digital resources.

[0059] When a user registers an account, the blockchain platform can assign a globally unique account identifier to the user. The transaction requests initiated by the user on the blockchain network will carry this account identifier to distinguish the source of the transaction requests.

[0060] In step S420, select a target blockchain that matches the account identifier from at least two mutually backup blockchains.

[0061] In an embodiment of the present application, multiple mutually backup blockchains can be maintained simultaneously on the blockchain network. Each blockchain stores exactly the same block data. When a blockchain has an access failure or read / write exception, the peer blockchain that is mutually backup with it can be used to continue executing transaction services.

[0062] In an embodiment of the present application, whenever a transaction request is received, the transaction request can be parsed to obtain the account identifier carried in the transaction request, and then the target blockchain is selected according to the matching relationship between the account identifier and multiple blockchains.

[0063] Figure 5 Shows the step flow chart of selecting the target blockchain in an embodiment of the present application. As Figure 5 shown, based on the above embodiments, selecting the target blockchain that matches the account identifier from at least two mutually backup blockchains in step S420 may include the following steps S510 to S530.

[0064] Step S510: Parse the transaction request to obtain the transaction service type carried in the transaction request.

[0065] In an embodiment of the present application, the blockchain network can provide multiple different types of transaction service services externally, such as querying, transferring, or paying services for digital resource accounts, generating, transferring, and signing services for electronic contracts, issuing, transferring, and redeeming services for electronic invoices, and so on.

[0066] In a transaction request, a service type field for marking the type of transaction service can be configured. When a user initiates a transaction request, according to the transaction service applied for, the corresponding field value can be written into the service type field.

[0067] When a blockchain node receives a transaction request initiated by a user, it can parse and process the transaction request, obtain the field value of the service type field therein, and determine the type of transaction service applied for by the user according to the mapping relationship between the field value and the service type.

[0068] Step S520: Obtain a blockchain set that matches the type of transaction service. The blockchain set includes at least two mutually backup blockchains.

[0069] For each type of transaction service provided by the blockchain network, a corresponding blockchain set can be maintained on the blockchain network. Each blockchain set includes at least two mutually backup blockchains. For example, for a business related to digital resources, a blockchain set including two blockchains, namely Blockchain A and Blockchain B, can be maintained; for a business related to electronic invoices, a blockchain set including three blockchains, namely Blockchain C, Blockchain D, and Blockchain E, can be maintained.

[0070] Each blockchain in a blockchain set should store exactly the same block data. Therefore, each blockchain in the blockchain set constitutes a peer blockchain of other blockchains for data backup.

[0071] In an embodiment of the present application, each blockchain in the blockchain set can perform data synchronization according to a preset synchronization period to keep the block data on each blockchain mutually equivalent.

[0072] Step S530: Select a target blockchain that matches the account identifier from the blockchain set.

[0073] According to a preset dynamic matching rule, the account identifier carried in the transaction request can be matched and detected with each blockchain in the blockchain set, so as to select a target blockchain that matches the account identifier.

[0074] When creating a blockchain on the blockchain network, a globally unique blockchain identifier can be configured for it. Subsequently, whenever a transaction service is completed on the blockchain, the transaction result can be associated with the blockchain identifier for transaction traceability.

[0075] In an embodiment of the present application, when selecting a target blockchain that matches the account identifier from the blockchain set, the blockchain identifiers of each blockchain in the blockchain set can be obtained first, and then the account identifier is matched and detected with the blockchain identifiers of each blockchain, and the blockchain with successful identifier matching is selected as the target blockchain.

[0076] In one embodiment of the present application, the method for performing identification matching detection between an account identifier and the blockchain identifiers of each blockchain may include: obtaining a first identifier value of a preset identifier bit in the account identifier; respectively obtaining second identifier values of preset identifier bits in the blockchain identifiers of each blockchain; and performing identification matching detection on the blockchain identifiers of each blockchain according to the numerical relationship between the first identifier value and the second identifier value.

[0077] The preset identifier bit is an identifier segment with a fixed length and a fixed position specified in the account identifier or the blockchain identifier. For example, the last bit field value of the account identifier or the blockchain identifier can be used as the preset identifier bit.

[0078] In one embodiment of the present application, the mapping rule between the account identifier and the blockchain identifier can be pre-configured, so as to determine the matching relationship according to the mapping rule. For example, the blockchain set includes two blockchains. The identifier value of one blockchain on the preset identifier bit is configured as 0, and the identifier value of the other blockchain on the preset identifier bit is configured as 1. The preset identifier bit of the account identifier can take any value between 0 and 9. Among them, the value range from 0 to 4 can be mapped to the identifier value 0, and the value range from 5 to 9 can be mapped to the identifier value 1. On this basis, according to the first identifier value of the account identifier on the preset identifier bit and the second identifier value of the blockchain identifier on the preset identifier bit, identification matching detection can be performed, and the blockchain identifier with successful matching corresponds to the target blockchain.

[0079] In one embodiment of the present application, identification matching detection can also be performed by performing a hash operation on relevant identifiers and based on the hash operation result.

[0080] Figure 6 The flowchart of the steps for performing identification matching detection based on the hash operation in one embodiment of the present application is shown. As Figure 6 shown, on the basis of the above embodiment, the method for performing identification matching detection between the account identifier and the blockchain identifiers of each blockchain may include the following steps S610 to step S640.

[0081] Step S610: Perform a hash operation on the blockchain identifiers of each blockchain to obtain the blockchain identifier hash values of each blockchain.

[0082] Hash operation is a method of mapping data through a hash function (also known as a hashing function) to create a small digital "fingerprint". The hash function compresses the message or data into a digest, reducing the amount of data and fixing the data format. The hash function can shuffle and mix the data to recreate a fingerprint called hash values, which are usually represented by a short string of random letters and numbers. Commonly used hash functions can include MD5, SHA-1, SHA-2, SHA-256, SHA-512, SHA-3, RIPEMD-160, and so on.

[0083] Step S620: On the hash ring representing the preset hash value space, allocate hash value nodes corresponding to the blockchain identity hash values for each blockchain.

[0084] Based on the hash function used in the hash operation, the value range of the hash function can be determined, and according to this value range, the hash ring representing the preset hash value space can be determined. Each point on the hash ring represents a hash value within the hash value space.

[0085] Figure 7 Shows a schematic diagram of a hash ring allocated with hash value nodes in an embodiment of the present application. As Figure 7 shown, in the embodiment of the present application, the hash ring 701 is used to represent the hash value space of 0 to 2 32 -1.

[0086] After performing a hash operation on the blockchain identity 703 of blockchain A using the hash function 702, the blockchain identity hash value 704 can be obtained, and the blockchain identity hash value 704 can be marked as the hash value node Node-A on the hash ring 701.

[0087] After performing a hash operation on the blockchain identity 705 of blockchain B using the hash function 702, the blockchain identity hash value 706 can be obtained, and the blockchain identity hash value 706 can be marked as the hash value node Node-B on the hash ring 701.

[0088] Step S630: Perform a hash operation on the account identity to obtain an account identity hash value corresponding to the account identity.

[0089] Continue to refer to Figure 7 shown, after performing a hash operation on the account identity 707 using the hash function 702, the corresponding account identity hash value 708 can be obtained, and the account identity hash value 708 can be marked as the hash value node Node-a on the hash ring 701.

[0090] Step S640: Search for the hash value node on the hash ring that is closest to the hash value of the account identifier in a preset direction, and obtain the blockchain identifier hash value corresponding to the found hash value node.

[0091] In an embodiment of the present application, the hash value node on the hash ring that is closest to the hash value of the account identifier may be searched in the clockwise direction or the counterclockwise direction, and then the corresponding blockchain identifier hash value may be obtained.

[0092] As Figure 7 shown, when searching in the clockwise direction, it can be determined that the hash value node closest to the hash value node Node-a is Node-A. Therefore, it can be determined that the match between the account identifier and the blockchain identifier of blockchain A is successful.

[0093] In an embodiment of the present application, in order to improve the uniformity of the distribution of the blockchain identifier hash value on the hash ring, multiple hash operations may be performed on the blockchain identifier hash value to obtain multiple equivalent hash values corresponding to the blockchain identifier hash value; on the hash ring representing the preset hash value space, hash value nodes corresponding to the blockchain identifier hash value and the equivalent hash values are allocated for each blockchain.

[0094] Figure 8 Fig. shows a schematic diagram of a hash ring for allocating equivalent hash values based on multiple hashes in an embodiment of the present application.

[0095] As Figure 8 shown, in the embodiment of the present application, the hash ring 801 is used to represent the hash value space of 0 to 2 32 -1.

[0096] After performing a hash operation on the blockchain identifier 803 of blockchain A using the hash function 802, the blockchain identifier hash value 804 can be obtained, and the blockchain identifier hash value 804 can be marked as the hash value node Node-A1 on the hash ring 801.

[0097] After continuing to perform a hash operation on the blockchain identifier hash value 804 of blockchain A using the hash function 802, the equivalent hash value 805 can be obtained, and the equivalent hash value 805 can be marked as the hash value node Node-A2 on the hash ring 801.

[0098] By analogy, continue to perform iterative hash operations on the equivalent hash value to obtain new equivalent hash values, and new hash value nodes Node-A3, Node-A4, Node-A5... can be marked on the hash ring.

[0099] When an account hash value successfully matches any one of multiple hash value nodes such as Node-A1, Node-A2, Node-A3, Node-A4, or Node-A5, it can be determined that Blockchain A is the target blockchain that matches the account identifier.

[0100] After performing a hashing operation on the blockchain identifier 806 of Blockchain B using the hash function 802, a blockchain identifier hash value 807 can be obtained, and the blockchain identifier hash value 807 can be marked as the hash value node Node-B1 on the hash ring 801.

[0101] After continuing to perform a hashing operation on the blockchain identifier hash value 807 of Blockchain B using the hash function 802, an equivalent hash value 808 can be obtained, and the equivalent hash value 808 can be marked as the hash value node Node-B2 on the hash ring 801.

[0102] And so on, by continuing to perform iterative hashing operations on the equivalent hash value, new equivalent hash values can be obtained, and new hash value nodes Node-B3, Node-B4, Node-B5... can be marked on the hash ring.

[0103] When an account hash value successfully matches any one of multiple hash value nodes such as Node-B1, Node-B2, Node-B3, Node-B4, or Node-B5, it can be determined that Blockchain B is the target blockchain that matches the account identifier.

[0104] As Figure 8 shown, when searching in the clockwise direction, it can be determined that the hash value node closest to the hash value node Node-a is Node-A1, so it can be determined that the account identifier successfully matches the blockchain identifier of Blockchain A.

[0105] According to the quantity requirements of the hash value nodes, the blockchain identifier hash value of the blockchain and one or more corresponding equivalent hash values can be marked on the hash ring. The more the number of equivalent hash values, the more evenly distributed the hash value nodes of each blockchain are, so the balance of each blockchain's processing of transaction services can be improved, and the problem of transaction congestion can be avoided.

[0106] In step S430, if the target blockchain is in a healthy state, the transaction is executed through the target blockchain network that maintains the target blockchain, and when the transaction is successfully executed, the transaction execution result is saved to the target blockchain.

[0107] In an embodiment of the present application, the blockchain network can monitor and count the historical operation parameters of each blockchain in real time, and determine whether the blockchain is in a healthy state or an unhealthy state based on the historical operation parameters. The healthy state means that multiple operation parameters of the blockchain meet the set parameter thresholds, and the unhealthy state means that one or more operation parameters of the blockchain do not meet the set parameter thresholds.

[0108] In an embodiment of the present application, the historical operation parameters of the target blockchain are counted, and the historical operation parameters are the operation data generated by the target blockchain within a preset historical time interval; it is determined whether the target blockchain is in an unhealthy state according to the historical operation parameters.

[0109] Figure 9 The flowchart of the steps for determining the running state of the target blockchain according to the historical operation parameters in an embodiment of the present application is shown. As Figure 9 shown, the method for determining the running state of the target blockchain according to the historical operation parameters may include the following step S901

[0110] Step S901: Screen the key error information in the historical operation parameters, and the key error information is the operation error information corresponding to the preset key business.

[0111] The key business may include, for example, transaction query business, transfer business, etc. When problems such as transaction query failure or transfer failure occur, a transaction error report can be triggered on the blockchain network, that is, key error information is generated in the operation data.

[0112] Step S902: Count the error reporting time and the number of error reports of the key error information.

[0113] The error reporting time can be continuous time segments obtained by dividing the historical time interval according to a preset time length, and the number of error reports of the key error information appearing in each time segment is counted respectively.

[0114] Step S903: Predict the real-time growth rate of the key error information according to the error reporting time and the number of error reports.

[0115] According to the number of error reports in two adjacent error reporting times (time segments), the historical growth rate of the key error information corresponding to each error reporting time can be calculated. By performing function fitting on the historical growth rates, the function model obtained by fitting can be used to predict the real-time growth rate of the key error information in the next time segment.

[0116] In an embodiment of the present application, an exponential function or a power function can be used to perform function fitting on the growth rate of the key error information.

[0117] Step S904: Determine whether the real-time growth rate of the key error information is greater than the growth rate threshold.

[0118] If the real-time growth rate is greater than the growth rate threshold, it is determined that the target blockchain is in an unhealthy state. If the real-time growth rate is less than or equal to the growth rate threshold, step S905 is continued to be executed.

[0119] Step S905: Obtain the transaction quantity and transaction results in the historical operation parameters, where the transaction results include transaction success or transaction failure.

[0120] Step S906: According to the transaction quantity and transaction results, count the transaction success rate of the target blockchain.

[0121] Among all transactions within the historical time interval, the ratio of the number of successful transactions to the total number of transactions is the transaction success rate of the target blockchain.

[0122] Step S907: Obtain the quantity interval where the transaction quantity is located, and obtain the success rate threshold corresponding to the quantity interval.

[0123] In an embodiment of the present application, the success rate threshold has a positive correlation with the quantity interval. When the quantity interval is higher, the corresponding success rate threshold is also higher. When the transaction quantity is small, a relatively low success rate threshold can be selected to increase a certain error tolerance rate.

[0124] Step S908: Determine whether the transaction success rate of the target blockchain is less than the success rate threshold.

[0125] If the transaction success rate is less than the success rate threshold, it is determined that the target blockchain is in an unhealthy state. If the transaction success rate is greater than or equal to the success rate threshold, step S909 is continued to be executed.

[0126] Step S909: According to the transaction quantity and transaction results, count the quantity of successful transactions of the target blockchain per unit time.

[0127] Count the number of transactions with transaction success as the transaction result within the historical time interval. According to the degree of the number of successful transactions and the historical time interval, the quantity of successful transactions of the target blockchain per unit time can be counted.

[0128] Step S910: Obtain the quantity interval where the transaction quantity is located, and obtain the success quantity threshold corresponding to the quantity interval.

[0129] In an embodiment of the present application, the success quantity threshold has a positive correlation with the quantity interval. When the quantity interval is higher, the corresponding success quantity threshold is also higher. When the transaction quantity is small, a relatively low success quantity threshold can be selected to increase a certain error tolerance rate.

[0130] Step S911: Determine whether the quantity of successful transactions of the target blockchain per unit time is less than the success quantity threshold.

[0131] If the successful transaction volume is less than the successful volume threshold, it is determined that the target blockchain is in an unhealthy state. If the successful transaction volume is greater than or equal to the successful volume threshold, it is determined that the target blockchain is in a healthy state.

[0132] In one embodiment of the present application, the above judgment steps can be executed in parallel, or the judgment steps between the real-time growth rate of key error information, the transaction success rate, and the successful transaction volume can be adjusted in other orders.

[0133] In one embodiment of the present application, when the target blockchain is in a healthy state and the transaction is successfully executed on the target blockchain, the transaction execution result can be saved on the target blockchain.

[0134] In one embodiment of the present application, saving the transaction execution result to the target blockchain when the transaction is successfully executed may include: when the transaction is successfully executed, saving the transaction execution result to the transaction buffer pool maintained by the target blockchain network; when the block generation condition is met, writing the data in the transaction buffer pools maintained by the target blockchain network and the peer blockchain network into the block to be chained; performing consensus authentication on the block to be chained on the target blockchain network, and when the authentication is passed, performing chaining processing on the block to be chained to save the transaction execution result to the target blockchain.

[0135] In one embodiment of the present application, the block generation condition includes at least one of a time condition and a data volume condition. If the block generation condition is a time condition, the blockchain node can monitor the time difference from the generation time of the nearest block. When the time difference is greater than the preset time threshold, it can be determined that the block generation condition is met, and then start packing a new block; taking the time condition as the block generation condition, blocks can be generated at fixed time intervals. If the block generation condition is a data volume condition, the blockchain node can monitor the data volume of the data saved in the transaction buffer pool. When the data volume is greater than the preset data volume threshold, it can be determined that the block generation condition is met, and then start packing a new block.

[0136] In one embodiment of the present application, while saving the transaction execution result to the target blockchain, the transaction execution result can also be synchronously shared on the peer blockchain in real time or periodically. When the synchronization condition is met, consensus authentication can be performed on the block to be chained on the peer blockchain, and when the authentication is passed, chaining processing can be performed on the block to be chained to save the transaction execution result to the peer blockchain.

[0137] In one embodiment of the present application, the peer blockchain network may periodically send a data synchronization request to the target blockchain network. Based on the data synchronization request, the data difference between the target blockchain and the peer blockchain can be determined. Based on the data difference, the target blockchain or the peer blockchain can be updated with data to achieve data synchronization between the target blockchain and the peer blockchain.

[0138] In step S440, if the target blockchain is in an unhealthy state or the target blockchain network fails to execute a transaction, the transaction is executed through the peer blockchain network that maintains the peer blockchain, and when the transaction is successfully executed, the transaction execution result is saved to the peer blockchain. The peer blockchain is a blockchain that serves as a backup for the target blockchain, and the peer blockchain network and the target blockchain network have at least one different blockchain node.

[0139] The process of saving the transaction execution result to the peer blockchain is similar to the process of saving the transaction execution result to the target blockchain, and will not be elaborated here.

[0140] Figure 10 It shows a schematic diagram of the business processing process in an application scenario of an embodiment of the present application.

[0141] As Figure 10 shown, the blockchain platform can be deployed as paired blockchain sub-chains to improve performance. Each sub-chain has a core consensus network composed of consensus nodes and a data node network composed of data nodes through a network hierarchical structure. The data node network provides transaction reading and writing services externally and transmits the received business transactions internally and synchronizes the ledger information of the core consensus network.

[0142] As Figure 10 exemplarily shown in [reference], two sub-chains are deployed in an application scenario of an embodiment of the present application: the first blockchain 1001 and the second blockchain 1002. The first blockchain 1001 and the second blockchain 1002 are backups of each other. The access layer 1003 shields all characteristics such as disaster tolerance, security, and performance of the blockchain platform from the outer-layer services. The blockchain platform is completely decoupled from the service end (for example, it may include Figure 3 the service nodes shown). Under normal circumstances, when a transaction request from the service end reaches the access layer 1003, the access layer 1003 can perform blockchain routing. Without considering the instant of disaster recovery switching, when the above-mentioned first blockchain 1001 and second blockchain 1002 are providing services normally, it is necessary to ensure that the user transaction requests for the same service are routed to the same sub-chain. For example, if a user makes multiple payments within a week, when the user queries the transactions, the blockchain platform only needs to query all transactions on the same sub-chain according to the fixed routing rules.

[0143] Each sub-chain has a unique number, which is the blockchain identifier chain ID; the business transaction order number uniquely identifies the content of a transaction, and the blockchain identifier chain ID should be included in the transaction order number to correspond to the changes in the blockchain platform. The transaction session identifier session id is the unique identifier of the context of the transaction process, and the blockchain identifier chainID should also be included in the session id to cope with the changes in the blockchain platform.

[0144] The access layer 1003 is the core of multi-chain routing. The access layer 1003 can determine through decision-making which blockchain a transaction request should be routed to.

[0145] When each business user registers, a static data account id will be allocated on the chain. After the business side queries the user account id, it can be cached on the business side, and the access layer 1003 will formulate routing rules based on the account id. For example, when the account id is 1 or 2, the transaction request will be routed to the first blockchain 1001; when the account id is 3 or 4, the transaction request will be routed to the second blockchain 1002.

[0146] Normally, after the business sends a transaction through the access layer 1003, the access layer 1003 will obtain the account id information through the transaction content and then forward it to a specific sub-chain according to the routing rules. Assume the account id is 1, then the business request will be routed to the first blockchain 1001. After the first blockchain 1001 executes the transaction, it will package the execution result into a block for consensus and write it into the ledger. In an embodiment of the present application, the first blockchain 1001 will return the transaction execution result carrying the above session id to the transaction requester, and the blockchain identifier chainID of the first blockchain 1001 will be recorded in the session id. The access layer will record the transaction data with the session id as the keyword for subsequent query use.

[0147] During the operation of the blockchain platform, the access layer 1003 can report to the watchdog service in real time about the sub-chain. The watchdog service adjusts the transaction routing rules according to the reported results. The access layer 1003 can implement an automatic transaction detection mechanism. When the transaction sent by the business side fails to execute on a sub-chain, the access layer 1003 will forward the request to another peer sub-chain for retry, thereby improving the overall reliability.

[0148] The access layer will count whether certain key error codes on the blockchain (such as ledger reading failure) suddenly increase and exceed the preset threshold. At the same time, the access layer will also calculate the transaction success rate and the number of successful transactions. For example, if the transaction success rate drops to 60%, or the number of successful transactions drops to only 500 transactions per second, then the access layer considers that the sub-chain has a fault and can switch the transaction traffic of subsequent services to the equivalent sub-chain.

[0149] After the switch occurs, when the access layer receives a transaction sent from the same business side as above, the access layer will first select the chain ID to be accessed according to the dynamic routing rule based on the account id, and then the access layer will determine whether the corresponding sub-chain is in a healthy state. After confirming that the sub-chain is healthy, the transaction will be sent to the sub-chain. If the sub-chain fails, the access layer will still judge whether to retry the transaction according to the dynamic routing rule and the health of the equivalent sub-chain. If the equivalent sub-chain is healthy, the transaction will be sent to the equivalent sub-chain. After the equivalent sub-chain processes the transaction successfully, it will return the transaction result and the session id, and the access layer will record the session id and the transaction information for subsequent query.

[0150] In the embodiment of the present application, the transaction traffic is split according to multiple chains, isolated from each other, deployed in a peer-to-peer manner among multiple chains, backed up with each other, and there is no concept of primary and standby. On this basis, each sub-chain can process transactions. In the case of peer-to-peer deployment among multiple chains, when a certain sub-chain fails, it can be quickly switched to another sub-chain. Through the multi-chain horizontal expansion method, the throughput can be effectively improved, and through the multi-chain mutual backup method, the high availability of multiple chains can be improved.

[0151] It should be noted that although the steps of the method in the present application are described in a specific order in the drawings, this does not require or imply that these steps must be executed in this specific order, or that all the steps shown must be executed to achieve the desired result. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step for execution, and / or one step may be decomposed into multiple steps for execution, etc.

[0152] The following introduces the device embodiment of the present application, which can be used to execute the transaction processing method in the above embodiments of the present application. Figure 11 The structural block diagram of the transaction processing device provided by the embodiment of the present application is schematically shown. As Figure 11 shown, the transaction processing device 1100 mainly may include:

[0153] An identity acquisition module 1110, configured to respond to a transaction request and acquire the account identity of the transaction requester, where the account identity is a unique identifier assigned to the transaction requester when registering the account;

[0154] A blockchain selection module 1120, configured to select a target blockchain that matches the account identifier from at least two mutually backup blockchains;

[0155] A first transaction saving module 1130, configured to, if the target blockchain is in a healthy state, execute a transaction through the target blockchain network of the target blockchain, and save the transaction execution result to the target blockchain when the transaction is successfully executed;

[0156] A second transaction saving module 1140, configured to, if the target blockchain is in an unhealthy state, or the transaction execution through the target blockchain network fails, execute a transaction through the peer blockchain network of the peer blockchain, and save the transaction execution result to the peer blockchain when the transaction is successfully executed, where the peer blockchain is a blockchain that is mutually backup with the target blockchain, and the peer blockchain network and the target blockchain network have at least one different blockchain node.

[0157] In an embodiment of the present application, based on the above embodiment, the blockchain selection module 1120 may further include:

[0158] A request parsing module 1121, configured to parse the transaction request to obtain the transaction service type carried in the transaction request;

[0159] A set obtaining module 1122, configured to obtain a blockchain set that matches the transaction service type, where the blockchain set includes at least two mutually backup blockchains;

[0160] A matching detection module 1123, configured to select a target blockchain that matches the account identifier from the blockchain set.

[0161] In an embodiment of the present application, based on the above embodiment, the matching detection module 1123 may include:

[0162] A blockchain identifier obtaining module, configured to obtain the blockchain identifier of each blockchain in the blockchain set, where the blockchain identifier is a unique identifier configured when the blockchain is created;

[0163] An identifier matching detection module, configured to perform identifier matching detection on the account identifier and the blockchain identifiers of the blockchains, and select the blockchain with successful identifier matching as the target blockchain.

[0164] In an embodiment of the present application, based on the above embodiment, the identifier matching detection module includes:

[0165] A first identifier value obtaining module, configured to obtain the first identifier value of a preset identifier bit in the account identifier;

[0166] A second identification value acquisition module, configured to respectively acquire second identification values of preset identification bits in the blockchain identifications of the respective blockchains;

[0167] A numerical value matching detection module, configured to perform identification matching detection on the blockchain identifications of the respective blockchains according to the numerical relationship between the first identification value and the second identification value.

[0168] In an embodiment of the present application, based on the above embodiment, the matching detection module 1123 may include:

[0169] A first hash module, configured to perform a hash operation on the blockchain identifications of the respective blockchains to obtain blockchain identification hash values of the respective blockchains;

[0170] A node allocation module, configured to allocate hash value nodes corresponding to the blockchain identification hash values to the respective blockchains on a hash ring for representing a preset hash value space;

[0171] A second hash module, configured to perform a hash operation on the account identification to obtain an account identification hash value corresponding to the account identification;

[0172] A node search module, configured to search on the hash ring in a preset direction for the hash value node closest to the account identification hash value, and obtain the blockchain identification hash value corresponding to the found hash value node.

[0173] In an embodiment of the present application, based on the above embodiment, the node allocation module includes:

[0174] A third hash module, configured to perform multiple hash operations on the blockchain identification hash value to obtain a plurality of equivalent hash values corresponding to the blockchain identification hash value;

[0175] An equivalent node allocation module, configured to allocate hash value nodes corresponding to the blockchain identification hash value and the equivalent hash values to the respective blockchains on a hash ring for representing a preset hash value space.

[0176] In an embodiment of the present application, based on the above embodiment, the transaction processing device further includes:

[0177] A parameter statistics module, configured to statistically analyze historical operation parameters of the target blockchain, where the historical operation parameters are operation data generated by the target blockchain within a preset historical time interval;

[0178] A status determination module, configured to determine whether the target blockchain is in a non - healthy state according to the historical operation parameters.

[0179] In one embodiment of the present application, based on the above embodiments, the status determination module includes:

[0180] An error screening module, configured to screen key error information in the historical operation parameters, where the key error information is operation error information corresponding to preset key services;

[0181] An error statistics module, configured to count the error reporting time and the number of error reports of the key error information;

[0182] An error prediction module, configured to predict the real-time growth rate of the key error information according to the error reporting time and the number of error reports;

[0183] A first status prediction module, configured to determine that the target blockchain is in an unhealthy state if the real-time growth rate is greater than the growth rate threshold.

[0184] In one embodiment of the present application, based on the above embodiments, the status determination module includes:

[0185] A transaction result acquisition module, configured to acquire the number of transactions and transaction results in the historical operation parameters, where the transaction results include transaction success or transaction failure;

[0186] A success rate statistics module, configured to count the transaction success rate of the target blockchain according to the number of transactions and transaction results;

[0187] A success rate comparison module, configured to obtain the quantity range where the number of transactions is located, and obtain the success rate threshold corresponding to the quantity range;

[0188] A second status prediction module, configured to determine that the target blockchain is in an unhealthy state if the transaction success rate is less than the success rate threshold.

[0189] In one embodiment of the present application, based on the above embodiments, the status determination module includes:

[0190] A transaction result acquisition module, configured to acquire the number of transactions and transaction results in the historical operation parameters, where the transaction results include transaction success or transaction failure;

[0191] A successful quantity statistics module, configured to count the transaction successful quantity of the target blockchain per unit time according to the number of transactions and transaction results;

[0192] A successful quantity comparison module, configured to obtain the quantity range where the number of transactions is located, and obtain the successful quantity threshold corresponding to the quantity range;

[0193] A third - state prediction module, configured to determine that the target blockchain is in an unhealthy state if the successful transaction volume is less than the successful volume threshold.

[0194] In an embodiment of the present application, based on the above - mentioned embodiment, the first transaction storage module 1130 includes:

[0195] A transaction cache module 1131, configured to save the transaction execution result to the transaction buffer pool maintained by the target blockchain network when the transaction execution is successful;

[0196] A transaction writing module 1132, configured to write the data in the transaction buffer pools maintained by the target blockchain network and the peer blockchain network into the block - to - be - chained when the block generation condition is met;

[0197] A transaction chaining module 1133, configured to perform consensus authentication on the block - to - be - chained on the target blockchain network, and perform chaining processing on the block - to - be - chained when the authentication passes, so as to save the transaction execution result to the target blockchain.

[0198] In an embodiment of the present application, based on the above - mentioned embodiment, the first transaction storage module 1130 further includes:

[0199] A transaction synchronization module, configured to perform consensus authentication on the block - to - be - chained on the peer blockchain, and perform chaining processing on the block - to - be - chained when the authentication passes, so as to save the transaction execution result to the peer blockchain.

[0200] The specific details of the transaction processing device provided in each embodiment of the present application have been described in detail in the corresponding method embodiments, and will not be repeated here.

[0201] Figure 12 Schematically shows a block diagram of a computer system of an electronic device for implementing the embodiments of the present application.

[0202] It should be noted that Figure 12 The computer system 1200 of the electronic device shown is only an example, and should not bring any limitation to the functions and usage scope of the embodiments of the present application.

[0203] Such as Figure 12As shown, computer system 1200 includes a central processing unit 1201 (CPU), which can perform various appropriate actions and processes according to a program stored in read-only memory 1202 (ROM) or a program loaded from storage section 1208 into random access memory 1203 (RAM). In random access memory 1203, various programs and data required for system operation are also stored. The central processing unit 1201, read-only memory 1202, and random access memory 1203 are connected to each other via bus 1204. Input / output interface 1205 (Input / Output interface, i.e., I / O interface) is also connected to bus 1204.

[0204] The following components are connected to input / output interface 1205: input section 1206 including a keyboard, mouse, etc.; output section 1207 including, for example, a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; storage section 1208 including a hard disk, etc.; and communication section 1209 including a network interface card such as a local area network card, modem, etc. Communication section 1209 performs communication processing via a network such as the Internet. Drive 1210 is also connected to input / output interface 1205 as needed. Removable medium 1211, such as a magnetic disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 1210 as needed so that a computer program read from it can be installed into storage section 1208 as needed.

[0205] In particular, according to an embodiment of the present application, the processes described in each method flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product that includes a computer program carried on a computer-readable medium, and the computer program contains program code for performing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network via communication section 1209 and / or installed from removable medium 1211. When the computer program is executed by central processing unit 1201, various functions defined in the system of the present application are executed.

[0206] It should be noted that the computer-readable medium shown in the embodiments of the present application may be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer-readable storage medium may be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, apparatus, or device. In the present application, the computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which computer-readable program code is carried. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than the computer-readable storage medium, and this computer-readable medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted by any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0207] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the above module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order from that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, as well as the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0208] It should be noted that although several modules or units of a device for action execution are mentioned in the above detailed description, such a division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of the two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0209] Through the description of the above embodiments, those skilled in the art can easily understand that the example embodiments described herein can be implemented by software, or by a combination of software and necessary hardware. Therefore, the technical solutions according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (such as a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present application.

[0210] After considering the specification and practicing the invention disclosed herein, those skilled in the art will readily conceive of other embodiments of the present application. The present application is intended to cover any variations, uses, or adaptations of the present application, which follow the general principles of the present application and include well-known knowledge or conventional technical means in the technical field not disclosed by the present application.

[0211] It should be understood that the present application is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present application is only limited by the appended claims.

Claims

1. A transaction processing method, characterized in that, including: In response to a transaction request, obtain the account identifier of the transaction requester, where the account identifier is a unique identifier assigned to the transaction requester during account registration; Select a target blockchain that matches the account identifier from at least two mutually backup blockchains; If the target blockchain is in a healthy state, execute the transaction through the target blockchain network that maintains the target blockchain, and save the transaction execution result to the target blockchain when the transaction is successfully executed; If the target blockchain is in an unhealthy state, or the transaction execution by the target blockchain network fails, execute the transaction through the peer blockchain network that maintains the peer blockchain, and save the transaction execution result to the peer blockchain when the transaction is successfully executed. The peer blockchain is a blockchain that is mutually backup with the target blockchain, and the peer blockchain network and the target blockchain network have at least one different blockchain node; Based on the data synchronization request regularly sent by the peer blockchain network to the target blockchain network, determine the data difference between the target blockchain and the peer blockchain; Update the data of the target blockchain or the peer blockchain based on the data difference to achieve data synchronization between the target blockchain and the peer blockchain.

2. The transaction processing method according to claim 1, wherein, Selecting a target blockchain that matches the account identifier from at least two mutually backup blockchains includes: Parse the transaction request to obtain the transaction service type carried in the transaction request; Obtain a blockchain set that matches the transaction service type, where the blockchain set includes at least two mutually backup blockchains; Select a target blockchain that matches the account identifier from the blockchain set.

3. The transaction processing method according to claim 2, wherein Selecting a target blockchain that matches the account identifier from the blockchain set includes: Obtain the blockchain identifier of each blockchain in the blockchain set, where the blockchain identifier is a unique identifier configured when the blockchain is created; Perform an identifier matching detection on the account identifier and the blockchain identifiers of each blockchain, and select the blockchain with a successful identifier matching as the target blockchain.

4. The transaction processing method according to claim 3, wherein Performing an identifier matching detection on the account identifier and the blockchain identifiers of each blockchain includes: Obtain the first identifier value of a preset identifier bit in the account identifier; Respectively obtain the second identifier values of the preset identifier bits in the blockchain identifiers of each blockchain; Perform an identifier matching detection on the blockchain identifiers of each blockchain according to the numerical relationship between the first identifier value and the second identifier value.

5. The transaction processing method according to claim 3, characterized in that Performing an identifier matching detection on the account identifier and the blockchain identifiers of each blockchain includes: Perform a hash operation on the blockchain identifiers of each blockchain to obtain the blockchain identifier hash values of each blockchain; Allocate hash value nodes corresponding to the blockchain identifier hash values for each blockchain on a hash ring used to represent a preset hash value space; Perform a hash operation on the account identifier to obtain an account identifier hash value corresponding to the account identifier; Search for the hash value node closest to the hash value of the account identifier on the hash ring in accordance with the preset direction, and obtain the blockchain identifier hash value corresponding to the found hash value node.

6. The transaction processing method according to claim 5, characterized in that, Allocating hash value nodes corresponding to the blockchain identifier hash values for the respective blockchains on a hash ring representing a preset hash value space includes: Performing multiple hash operations on the blockchain identifier hash value to obtain multiple equivalent hash values corresponding to the blockchain identifier hash value; Allocating hash value nodes corresponding to the blockchain identifier hash value and the equivalent hash values for the respective blockchains on a hash ring representing a preset hash value space.

7. The transaction processing method according to any one of claims 1 to 6, characterized in that, After selecting a target blockchain that matches the account identifier from at least two mutually backup blockchains, the method further includes: Counting historical operation parameters of the target blockchain, where the historical operation parameters are operation data generated by the target blockchain within a preset historical time interval; Determining whether the target blockchain is in a non - healthy state according to the historical operation parameters.

8. The transaction processing method according to claim 7, wherein Determining whether the target blockchain is in a non - healthy state according to the historical operation parameters includes: Filtering key error information in the historical operation parameters, where the key error information is operation error information corresponding to preset key services; Counting the reporting time and the number of reports of the key error information; Predicting the real - time growth rate of the key error information according to the reporting time and the number of reports; If the real - time growth rate is greater than the growth rate threshold, determine that the target blockchain is in a non - healthy state.

9. The transaction processing method according to claim 7, wherein Determining whether the target blockchain is in a non - healthy state according to the historical operation parameters includes: Obtaining the transaction quantity and transaction results in the historical operation parameters, where the transaction results include transaction success or transaction failure; Counting the transaction success rate of the target blockchain according to the transaction quantity and transaction results; Obtaining the quantity interval where the transaction quantity is located, and obtaining a success rate threshold corresponding to the quantity interval; If the transaction success rate is less than the success rate threshold, determine that the target blockchain is in a non - healthy state.

10. The transaction processing method according to claim 7, characterized in that, Determining whether the target blockchain is in a non - healthy state according to the historical operation parameters includes: Obtaining the transaction quantity and transaction results in the historical operation parameters, where the transaction results include transaction success or transaction failure; Counting the transaction success volume per unit time of the target blockchain according to the transaction quantity and transaction results; Obtaining the quantity interval where the transaction quantity is located, and obtaining a success volume threshold corresponding to the quantity interval; If the transaction success volume is less than the success volume threshold, determine that the target blockchain is in a non - healthy state.

11. The transaction processing method according to any one of claims 1 to 6, characterized in that, When a transaction is executed successfully, saving the transaction execution result to the target blockchain includes: When a transaction is executed successfully, saving the transaction execution result to a transaction buffer pool maintained by the target blockchain network; When the block generation condition is met, writing the data in the transaction buffer pools maintained by the target blockchain network and the peer blockchain network into a block to be chained. Perform consensus authentication on the block to be chained on the target blockchain network, and perform chaining processing on the block to be chained when the authentication is passed, so as to save the transaction execution result to the target blockchain.

12. The transaction processing method according to claim 11, wherein After saving the transaction execution result to the target blockchain, the method further includes: Perform consensus authentication on the block to be chained on the peer blockchain, and perform chaining processing on the block to be chained when the authentication is passed, so as to save the transaction execution result to the peer blockchain.

13. A transaction processing device, characterized in that, Includes: An identity acquisition module, configured to respond to a transaction request and acquire the account identity of the transaction requester, where the account identity is a unique identity assigned to the transaction requester when registering the account; A blockchain selection module, configured to select a target blockchain that matches the account identity from at least two mutually backup blockchains; A first transaction saving module, configured to, if the target blockchain is in a healthy state, execute a transaction through the target blockchain network that maintains the target blockchain, and save the transaction execution result to the target blockchain when the transaction is successfully executed; A second transaction saving module, configured to, if the target blockchain is in an unhealthy state, or the transaction execution through the target blockchain network fails, execute a transaction through the peer blockchain network that maintains the peer blockchain, and save the transaction execution result to the peer blockchain when the transaction is successfully executed, where the peer blockchain is a blockchain that is mutually backup with the target blockchain, and the peer blockchain network and the target blockchain network have at least one different blockchain node; Based on the data synchronization request regularly sent by the peer blockchain network to the target blockchain network, determine the data difference between the target blockchain and the peer blockchain; update the data of the target blockchain or the peer blockchain based on the data difference to achieve data synchronization between the target blockchain and the peer blockchain.

14. A computer-readable medium, characterized in that, A computer program is stored on the computer-readable medium, and when the computer program is executed by a processor, it implements the transaction processing method according to any one of claims 1 to 12.

15. An electronic device, characterized in that, Includes: A processor; And A memory for storing executable instructions of the processor; Wherein, the processor is configured to cause the electronic device to execute the transaction processing method according to any one of claims 1 to 12 by executing the executable instructions.

16. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the transaction processing method according to any one of claims 1 to 12.

Citation Information

Patent Citations

  • Multi-block chain sectional processing method and device

    CN106899680A

  • Monitoring and automatic switching method and system based on multiple blockchain nodes

    CN112272113A