A cross-blockchain distributed message processing method, platform and storage medium

Through the distributed message processing method across blockchains, the first smart contract and the second smart contract are managed by using the first smart contract and the blockchain, the problem of low reliability of distributed message queues is solved, and decentralized high-reliability message processing is achieved.

CN112788108BActive Publication Date: 2025-03-14WEBANK (CHINA)
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011594607.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-29
Publication Date
2025-03-14
Estimated Expiration
2040-12-29

AI Technical Summary

Technical Problem

Distributed message queues have low reliability and are prone to inability to provide services in situations such as computer room failure, downtime and hacker attacks.

Method used

A cross-blockchain distributed message processing method is adopted to receive target transactions through a cross-blockchain distributed message processing platform running the first smart contract, determine the second blockchain with the second smart contract, and perform target operations for the blockchain to realize the storage or acquisition of messages.

Benefits of technology

It improves the reliability of distributed messages, reduces the risk of inability to provide services in situations such as computer room failure, downtime and hacker attacks, and realizes a decentralized message processing solution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112788108B_ABST
    Figure CN112788108B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a cross-blockchain distributed message processing method, the method comprising: receiving a target transaction sent by a client device; based on the target transaction, determining at least one second blockchain with a second smart contract; wherein the first smart contract is used to manage the second smart contract, and each second blockchain is used to store at least one type of transaction message; based on the target transaction, executing a target operation for at least one second blockchain; wherein the target operation has an association relationship with the target transaction, and the target operation includes a storage operation or an acquisition operation. The embodiment of the present application also discloses a cross-blockchain distributed message processing platform and a storage medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of blockchain technology, and in particular to a cross-blockchain distributed message processing method, platform and storage medium. Background Art

[0002] With the rapid development of computer technology, more and more technologies are applied in the financial field. The traditional financial industry is gradually transforming to Fintech. However, due to the security and real-time requirements of the financial industry, higher requirements are also placed on technology. Since distributed message queues can be run as independent services and can help distributed systems achieve high performance, high availability, scalability, and eventual consistency, distributed message queues have been widely used in distributed systems and have become an important component, effectively solving problems such as application coupling, asynchronous messages, and traffic peak shaving.

[0003] However, the distributed message queues in the current distributed system are deployed in a centralized manner in a certain organization and are controlled by a single organization. In the event of computer room failure, downtime, and hacker attacks, the distributed message queues cannot provide services, resulting in low reliability of the distributed message queues.

[0004] Application Contents

[0005] In order to solve the above technical problems, the embodiments of the present application hope to provide a cross-blockchain distributed message processing method, platform and storage medium, which solves the problem of low reliability of distributed message queues, proposes a cross-blockchain distributed message processing solution, realizes decentralization, effectively improves the reliability of distributed messages, and reduces the risk of not being able to provide services in the event of computer room failure, downtime and hacker attacks.

[0006] The technical solution of this application is implemented as follows:

[0007] In a first aspect, a cross-blockchain distributed message processing method is applied to a cross-blockchain distributed message processing platform that runs a first smart contract, the cross-blockchain distributed message processing platform is used to maintain the first blockchain, the method comprising:

[0008] receiving a target transaction sent by a client device;

[0009] Based on the target transaction, determining at least one second blockchain having a second smart contract; wherein the first smart contract is used to manage the second smart contract, and each second blockchain is used to store at least one type of transaction message;

[0010] Based on the target transaction, a target operation is performed on at least one of the second blockchains; wherein the target operation is associated with the target transaction, and the target operation includes a storage operation or an acquisition operation.

[0011] In a second aspect, a cross-blockchain distributed message processing platform is provided, wherein the cross-blockchain distributed message processing platform for running a first smart contract is used to maintain a first blockchain, and the cross-blockchain distributed message processing platform includes: a memory, a processor, and a communication bus; wherein:

[0012] The memory is used to store executable instructions;

[0013] The communication bus is used to realize the communication connection between the processor and the memory;

[0014] The processor is used to execute the cross-blockchain distributed message processing program stored in the memory to implement the steps of the cross-blockchain distributed message processing method as described in any one of the above items.

[0015] In a third aspect, a storage medium is provided, on which a cross-blockchain distributed message processing program is stored, and when the cross-blockchain distributed message processing program is executed by a processor, the steps of the cross-blockchain distributed message processing method as described in any one of the above items are implemented.

[0016] In an embodiment of the present application, after receiving the target transaction sent by the client device through the cross-blockchain distributed message processing platform running the first smart contract, at least one second blockchain with a second smart contract is determined based on the target transaction, and based on the target transaction, the target operation for the at least one second blockchain is performed, that is, the second smart contract is managed by the first smart contract, and the message is stored in the blockchain corresponding to the second smart contract for storing messages of the corresponding type, or the message is obtained from the blockchain corresponding to the second smart contract storing messages of the corresponding type, which solves the problem of low reliability of distributed message queues, proposes a cross-blockchain distributed message processing solution, realizes decentralization, effectively improves the reliability of distributed messages, and reduces the risk of not being able to provide services in the event of computer room failures, downtime, and hacker attacks. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 A schematic diagram of a cross-blockchain distributed message processing method provided in an embodiment of the present application;

[0018] Figure 2 A flowchart of another cross-blockchain distributed message processing method provided in an embodiment of the present application;

[0019] Figure 3A schematic diagram of the structure of a message provided in an embodiment of the present application;

[0020] Figure 4 A schematic diagram of the structure of the first smart contract provided in an embodiment of the present application;

[0021] Figure 5 A schematic diagram of the structure of a second smart contract provided in an embodiment of the present application;

[0022] Figure 6 A flowchart of another cross-blockchain distributed message processing method provided in an embodiment of the present application;

[0023] Figure 7 A schematic diagram of a cross-blockchain distributed message processing method provided in another embodiment of the present application;

[0024] Figure 8 A schematic diagram of a cross-blockchain message queue architecture provided in an embodiment of the present application;

[0025] Fig. 9 A schematic diagram of a smart contract structure of a cross-blockchain distributed message queue provided in an embodiment of the present application;

[0026] Fig.10 A schematic diagram of the structure of a cross-blockchain distributed message processing platform provided in an embodiment of the present application. DETAILED DESCRIPTION

[0027] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.

[0028] The embodiment of the present application provides a cross-blockchain distributed message processing method, referring to Figure 1 As shown, the method is applied to a cross-blockchain distributed message processing platform that runs a first smart contract, and the cross-blockchain distributed message processing platform is used to maintain the first blockchain. The method includes the following steps:

[0029] Step 101: Receive a target transaction sent by a client device.

[0030] In the embodiment of the present application, the cross-blockchain distributed message processing platform is composed of multiple cross-blockchain distributed message processing devices that have computing and analysis capabilities and can serve as blockchain operation nodes. The cross-blockchain distributed message processing platform includes multiple blockchain operation nodes. The cross-blockchain distributed message processing device can run at least one blockchain node, and the corresponding physical device can be, for example, various forms of servers, desktop computers, laptops, tablet computers, smart phones, and even car computers; it can also be a virtual device, corresponding to the virtual machine (Etherium Virtual Machine, EVM) that executes smart contracts in the Ethereum blockchain.

[0031] The client device may be a device running a client node in a blockchain. The first smart contract is a management smart contract set in a blockchain in the current blockchain system, such as the first blockchain, and has the management function of managing other blockchains. When the client node needs to communicate with other blockchains, it needs to be implemented through the node running the first smart contract. The target transaction may be a transaction in which the first client node needs to store data in the blockchain or obtain data from the blockchain.

[0032] Step 102: Based on the target transaction, determine at least one second blockchain having a second smart contract.

[0033] The first smart contract is used to manage the second smart contract, and each second blockchain is used to store at least one type of transaction message.

[0034] In the embodiment of the present application, the second smart contract is used to manage the data in the second blockchain, and the transaction message can be the data information transmitted between the client node and the blockchain. Since the second smart contract defines the type of data that can be stored in the corresponding second blockchain, the corresponding at least one second blockchain with the second smart contract can be determined according to the type of data to be processed included in the target transaction.

[0035] Step 103: Based on the target transaction, execute a target operation on at least one second blockchain.

[0036] The target operation is associated with the target transaction, and the target operation includes a storage operation or an acquisition operation.

[0037] In the embodiment of the present application, the target operation is determined by the target transaction, that is, according to the transaction requirements of the target transaction, the corresponding target operation for at least one second blockchain can be determined. For example, when the transaction requirement of the target transaction is to store data, the corresponding target operation for at least one second blockchain is to store the corresponding data on the corresponding second blockchain; when the transaction requirement of the target transaction is to obtain data, the corresponding target operation for at least one second blockchain is to obtain the corresponding data from the corresponding second blockchain.

[0038] In an embodiment of the present application, after receiving the target transaction sent by the client device through the cross-blockchain distributed message processing platform running the first smart contract, at least one second blockchain with a second smart contract is determined based on the target transaction, and based on the target transaction, the target operation for the at least one second blockchain is performed, that is, the second smart contract is managed by the first smart contract, and the message is stored in the blockchain corresponding to the second smart contract for storing messages of the corresponding type, or the message is obtained from the blockchain corresponding to the second smart contract storing messages of the corresponding type, which solves the problem of low reliability of distributed message queues, proposes a cross-blockchain distributed message processing solution, realizes decentralization, effectively improves the reliability of distributed messages, and reduces the risk of not being able to provide services in the event of computer room failures, downtime, and hacker attacks.

[0039] Based on the above embodiments, the embodiments of the present application provide a cross-blockchain distributed message processing method, referring to Figure 2 As shown, the method comprises the following steps:

[0040] Step 201: The cross-blockchain distributed message processing platform receives the target transaction sent by the client device.

[0041] Among them, the first smart contract includes at least the following contents: blockchain identification information of multiple reference blockchains managed by the first smart contract and the address of the reference smart contract running on each reference blockchain, the second blockchain belongs to multiple reference blockchains, and the second smart contract is used for message storage management.

[0042] In the embodiment of the present application, all client devices have previously determined the cross-blockchain distributed message processing platform running the first smart contract, so that when all client devices communicate with the blockchain system, they will directly establish a communication link with the cross-blockchain distributed message processing platform running the first smart contract. In some application scenarios, the client device may not determine the cross-blockchain distributed message processing platform running the first smart contract. In this way, when the client device communicates with the blockchain system, the blockchain system will notify the client device of the cross-blockchain distributed message processing platform running the first smart contract, and then the client device will establish a communication link with the cross-blockchain distributed message processing platform to realize the distributed message storage and retrieval process.

[0043] After the cross-blockchain distributed message processing platform establishes a communication link with the client device, the client device sends the target transaction to the cross-blockchain distributed message processing platform.

[0044] After the cross-blockchain distributed message processing platform executes step 201, it can choose to execute steps 202 to 207, or choose to execute steps 208 to 211. If the target transaction is a message storage transaction, choose to execute steps 202 to 207 to implement the message writing operation. If the target transaction is a message acquisition transaction, choose to execute steps 208 to 211 to implement the message reading operation:

[0045] Step 202: If the target transaction is a message storage transaction, the cross-blockchain distributed message processing platform obtains the target message from the target transaction.

[0046] In an embodiment of the present application, the cross-blockchain distributed message processing platform determines the transaction requirements corresponding to the received target transaction. If the target transaction is determined to be a message storage transaction, the cross-blockchain distributed message processing platform obtains the target message to be stored from the target transaction.

[0047] For example, the structure of the target message can refer to Figure 3 As shown, it includes a message body and a message content, wherein the message body is used to identify the type of message, and the message content is used to identify the data content contained in the target message. The target message is a transaction message.

[0048] Step 203: The cross-blockchain distributed message processing platform determines the first message type of the target message.

[0049] In an embodiment of the present application, a cross-blockchain distributed message processing platform analyzes the target message to determine a first message type of the target message, which may be, for example, the data type of the data included in the target message, or the object from which the target message comes, etc. The first message type may not be obtained by analyzing the target message, but the first message type is set in the target message, that is, the first message type of the target message can be directly obtained from the target message.

[0050] Step 204: The cross-blockchain distributed message processing platform determines at least one second blockchain based on the first message type.

[0051] In an embodiment of the present application, the cross-blockchain distributed message processing platform determines at least one second blockchain for storing the target message based on the chain identification information of multiple third blockchains for storing different types of data content and the first message type. The at least one second blockchain belongs to multiple third blockchains.

[0052] For example, in the structure of the target message, Figure 3 As shown, the message subject of the target message can be directly obtained from the structure of the target message to obtain the message type of the target message, which is recorded as the first message type. Since different second blockchains are used to store different types of data content, the cross-blockchain distributed message processing platform can determine at least one second blockchain for storing target information based on the first message type.

[0053] Correspondingly, such as Figure 4 As shown, in the first smart contract run by the cross-blockchain distributed message processing platform, a list of second smart contracts managed by the first smart contract is stored, and the list at least indicates the chain identification information of the blockchain where each corresponding second smart contract is located and the contract address of each second smart contract, for example, including chain identification information 1, contract address 1, chain identification information 2, contract address 2, chain identification information 3, contract address 3, .... Among them, the chain identification information of the blockchain where the second smart contract is located can also have the function of indicating the data type of the data stored in the blockchain, or the data type stored in the blockchain where the second smart contract is located can be directly identified in the list. In this way, the cross-blockchain distributed message processing platform can determine the corresponding second smart contract according to the list stored in the first smart contract, and determine the corresponding second blockchain according to the determined second smart contract.

[0054] Among them, after the cross-blockchain distributed message processing platform executes step 204, it can choose to execute step 205 or steps 206-207. If the number of types included in the first message type is 1, you can choose to execute step 205. If the number of types included in the first message type is greater than 1, you can choose to execute steps 206-207.

[0055] Step 205: If the number of types included in the first message type is 1, the cross-blockchain distributed message processing platform stores the target message to the second blockchain.

[0056] In an embodiment of the present application, when it is determined that the number of types included in the first message type is 1, the cross-blockchain distributed message processing platform directly stores the target message in the second blockchain used to store messages of the first message type, thereby implementing a write operation on the second blockchain.

[0057] Step 206: If the number of types included in the first message type is greater than 1, the cross-blockchain distributed message processing platform classifies the target message according to the sub-message types included in the first message type to obtain multiple sub-messages.

[0058] In the embodiments of the present application, in some application scenarios, the target message may also be a plurality of sub-messages that have been classified according to sub-message types.

[0059] Step 207: The cross-blockchain distributed message processing platform stores each sub-message in a second blockchain of the corresponding sub-message type.

[0060] The target operation includes a sending operation.

[0061] In the embodiment of the present application, since different second blockchains store data information of different message types, different sub-messages need to be stored in the second blockchain of the corresponding sub-message type. In this way, different sub-messages are stored in different second blockchains, thereby realizing the distributed storage of different messages in different blockchains, which can effectively ensure the security and reliability of the messages based on the characteristics of the blockchain.

[0062] Exemplarily, taking the target message as an example of bank sending account flow information, it is assumed that the account flow contains the following fields: account time: September 1 to November 30, account amount: unit yuan. Among them, in the corresponding second blockchain, each second blockchain is used to store one month's data. In this way, it can be determined that the first message type includes 3 sub-message types: September, October and November. Therefore, the 3 sub-messages that can be obtained are: account amount in September, account amount in October and account amount in November; then the account amount in September is stored in the second blockchain used to store September data, the account amount in October is stored in the second blockchain used to store October data, and the account amount in November is sent to the second blockchain used to store November data.

[0063] For example, after the second blockchain for storing September data receives the account amount for September sent by the first blockchain, the account amount for September is stored in the message list corresponding to the second smart contract managed and operated by the second blockchain. The corresponding message list in the second smart contract managed and operated by the second blockchain can refer to Figure 5 As shown, the account amounts for September can be stored at the end of the list of the current message list.

[0064] Step 208: If the target transaction is a message acquisition transaction, the cross-blockchain distributed message processing platform determines a second message type of the message to be acquired from the target transaction.

[0065] In the embodiment of the present application, the target transaction may be, for example, obtaining data information for July. In this way, it can be determined from the target transaction that the message to be obtained is the data information for July, and the corresponding second message type is July.

[0066] Step 209: The cross-blockchain distributed message processing platform determines at least one second blockchain based on the second message type.

[0067] In the embodiment of the present application, based on the fact that the second message type is July, the second blockchain for storing July data can be determined.

[0068] Step 210: The cross-blockchain distributed message processing platform obtains the message to be obtained from at least one second blockchain.

[0069] In an embodiment of the present application, since the cross-blockchain distributed message processing platform can determine the chain identification information of the second blockchain, the cross-blockchain distributed message processing platform can determine the second blockchain based on the chain identification information of the second blockchain, and obtain the message to be obtained that matches the target transaction from the second blockchain.

[0070] Exemplarily, when the cross-blockchain distributed message processing platform obtains July data information from the message list of the second blockchain storing July data, assuming that the messages in the current message list are in the order of the list from top to bottom from the head to the tail, and include message 1, message 2, and message 3, it can be determined that message 1 is the message stored farthest from the current moment, followed by message 2, and message 3 is the message stored closest to the current moment. In this way, the cross-blockchain distributed message processing platform obtains the oldest message from the message list of the second blockchain used to store July data and feeds it back to the client device, that is, obtains the head message, that is, information 1, as the message to be obtained, that is, the message list in the second blockchain can store data in a first-in-first-out manner. In some application scenarios, after the second blockchain sends the head message in the information list to the cross-blockchain distributed message processing platform, it can also delete the head message and move the message after the original head forward, so that the message after the head is called the new head message.

[0071] Step 211: The cross-blockchain distributed message processing platform sends the message to be obtained to the client device.

[0072] In an embodiment of the present application, the cross-blockchain distributed message processing platform sends the acquired message to be acquired to the client device to respond to the target transaction sent by the client device.

[0073] Based on the above embodiments, in other embodiments of the present application, refer to Figure 6 As shown, after the cross-blockchain distributed message processing platform executes step 205 or 207, it is also used to execute steps 212 to 214:

[0074] Step 212: The cross-blockchain distributed message processing platform obtains an event notification template corresponding to the target device based on at least one second blockchain.

[0075] The target device is a device used to call a message stored in at least one second blockchain.

[0076] In the embodiment of the present application, the first smart contract running on the cross-blockchain distributed message processing platform has a pre-set target device that can call messages in each third blockchain, and an event notification template that notifies the target device that calls messages in each third blockchain when a new message is stored in each third blockchain. The event notification template can be pre-written into the first smart contract corresponding to the first blockchain by each target device according to its own requirements. The target device can be a client device in the blockchain system, or a node device such as other server devices.

[0077] Step 213: The cross-blockchain distributed message processing platform generates a target event notification based on the event notification template.

[0078] Step 214: The cross-blockchain distributed message processing platform sends a target event notification to the target device.

[0079] The target event notification is used to notify the target device that there are pending messages that need to be processed.

[0080] In an embodiment of the present application, once the cross-blockchain distributed message processing platform stores the message in the corresponding second blockchain, it immediately generates a target event notification to notify the corresponding device that uses the message, so that the corresponding device that uses the message obtains the latest message, effectively improving the efficiency of distributed message use.

[0081] In this way, the target device receives the target event notification, responds to the target event notification, and sends the target transaction for the message acquisition transaction to the cross-blockchain distributed message processing platform; the cross-blockchain distributed message processing platform receives the target transaction sent by the target device; the cross-blockchain distributed message processing platform determines the second message type of the message to be acquired from the target transaction; then the cross-blockchain distributed message processing platform determines at least one second blockchain based on the second message type, and acquires the message to be acquired from the at least one second blockchain; the cross-blockchain distributed message processing platform sends the message to be acquired to the target device.

[0082] Based on the foregoing embodiments, in other embodiments of the present application, refer to Figure 7 As shown, after the cross-blockchain distributed message processing platform executes step 201, it can also be used to execute steps 215 to 220:

[0083] Step 215: The cross-blockchain distributed message processing platform detects a first survival rate of nodes included in the cross-blockchain distributed message processing platform.

[0084] In an embodiment of the present application, the survival rate of the nodes included in the cross-blockchain distributed message processing platform can be determined based on various consensus mechanisms, that is, all abnormal nodes included in the cross-blockchain distributed message processing platform are excluded.

[0085] Step 216: If the first survival rate is less than the first preset threshold and the target transaction is a message storage transaction, the cross-blockchain distributed message processing platform ends the target transaction.

[0086] In the embodiment of the present application, the first preset threshold is an empirical value obtained based on a large number of experiments, for example, it may be one-third of the number of nodes included in the cross-blockchain distributed message processing platform or one-half of the number of nodes, etc. In this way, when the first survival rate of the nodes included in the cross-blockchain distributed message processing platform is less than the first preset threshold, the write operation, i.e., the storage operation, for the multiple third blockchains managed by the cross-blockchain distributed message processing platform is prohibited.

[0087] Step 217: If the first survival rate is less than the first preset threshold, and the target transaction is a message acquisition transaction, the cross-blockchain distributed message processing platform acquires the message to be acquired from at least one second blockchain, and sends the message to be acquired to the client device.

[0088] In the embodiment of the present application, when the first survival rate is less than the first preset threshold, the read operation may be performed.

[0089] Step 218: If the first survival rate is greater than or equal to the first preset threshold, the cross-blockchain distributed message processing platform detects the second survival rates of the nodes corresponding to the n second blockchains.

[0090] Wherein, n is the number of blockchains of at least one second blockchain, and n is an integer greater than or equal to 1.

[0091] Step 219: If the second survival rate of the i second blockchains is less than the second preset threshold, and the target transaction is a message storage transaction for the i second blockchains, the cross-blockchain distributed message processing platform ends the target transaction for the i second blockchains.

[0092] Here, i is an integer greater than or equal to 1 and less than or equal to n.

[0093] Step 220: If the second survival rate of the i second blockchains is less than the second preset threshold, and the target transaction is a message acquisition transaction for the i second blockchains, the cross-blockchain distributed message processing platform acquires the message to be acquired from the i second blockchains and sends the message to be acquired to the client device.

[0094] Step 221: If the second survival rates of the j second blockchains are greater than or equal to the second preset threshold, the cross-blockchain distributed message processing platform executes the target operation on the j second blockchains based on the target transaction.

[0095] Wherein, j is an integer greater than or equal to 1 and less than or equal to n, and the sum of i and j is n.

[0096] In the embodiment of the present application, the cross-blockchain distributed message processing platform performs the target operation on j second blockchains based on the target transaction. The specific implementation process can refer to the implementation process of multiple embodiments composed of steps 202 to 214, which will not be described in detail here. In this way, when the second survival rate of part of the second blockchain is low, the part of the second blockchain can implement the readable operation, and when the second survival rate of the other normal second blockchain is high, the write operation and the readable operation can be implemented, which effectively improves the use of distributed messages and ensures the user experience effect.

[0097] It should be noted that steps 202 to 214 are performed when the first survival rate is greater than the first preset threshold, and each second survival rate is greater than the second preset threshold.

[0098] Based on the above embodiments, the present application embodiment provides a cross-blockchain message queue architecture. Figure 8 As shown, the cross-blockchain message queue architecture includes blockchain A and blockchain B. Among them, blockchain A is deployed with management smart contract and data smart contract 1, blockchain 2 is deployed with data smart contract 2, and client device C directly communicates with blockchain A where management smart contract is deployed. Figure 8 The circles shown in blockchain A and blockchain B represent the nodes that make up the blockchain. It should be noted that the management smart contract corresponds to the aforementioned first smart contract, and data smart contract 1 and data smart contract 2 correspond to the aforementioned second smart contract. The management smart contract is responsible for managing the queue data smart contract, exposing the message interface to the outside, and does not directly store message data. The management smart contract contains a list of data smart contracts, which stores the chain identification information and contract address of all queue data smart contracts. The data smart contract is responsible for storing message data, which contains a message list and stores multiple messages. Multiple data smart contracts are deployed on different blockchains by partition to achieve parallel expansion of message queues.

[0099] A management smart contract saves the addresses of multiple data smart contracts. The data is stored in data smart contracts on different blockchains according to the partitioning rules. According to actual needs, the partitioning rules can be set to time partitioning and business partitioning, for example. Different partitioning rules affect the message sending and receiving process.

[0100] Exemplarily, when partitioned by time, different blockchains are used to store message data of different dates. Assuming that it can be stored by month, the message data of September, October and November are stored in blockchain 1, blockchain 2 and blockchain 3 respectively, and the contract addresses of these three blockchains are written into the management smart contract.

[0101] When partitioned by business, data smart contracts are created based on business types. Assuming that the cross-chain message queue is used for banking business, the data smart contract can be divided into customer transaction data, credit card transaction data, and interbank transaction data. The data of these three business types are stored in blockchain 1, blockchain 2, and blockchain 3 respectively, and the three contract addresses are written into the management smart contract.

[0102] and Figure 8 The cross-blockchain distributed message queue architecture shown in the figure corresponds to the cross-blockchain distributed message queue smart contract structure, which can be referred to Fig. 9 As shown. Fig. 9As shown, the management smart contract A1 includes a list of data smart contracts, the data smart contract 1A2 includes a message list 1, and the data smart contract 2B1 includes a message list 2. The externally exposed message interface included in the management smart contract A1 includes at least three interfaces, such as the transceiver interface A11, the monitoring interface A12, and the message event A13. In this way, the cross-blockchain distributed queue consists of two types of contracts: the management smart contract and the data smart contract. Among them:

[0103] A process for managing smart contract receiving message data provided by an embodiment of the present application can be shown in the following steps:

[0104] Step 1: After receiving the user's operation instruction, the client device constructs a message sending transaction and sends the message sending transaction to the management smart contract of blockchain 1 through the sending and receiving interface A11.

[0105] Step 2: The management smart contract parses the parameters in the message sending transaction and determines the type of transaction parameters included in the message sending transaction.

[0106] Step 3: Manage smart contracts and select the corresponding data smart contract according to the type of transaction parameters.

[0107] Step 4: The management smart contract inserts the message data in the message sending transaction into the end of the message list of the corresponding data smart contract.

[0108] Step 5: After the management smart contract inserts the message data into the end of the message list of the corresponding data smart contract, a new message event is triggered.

[0109] For example, taking the bank sending account flow information as an example, the account flow contains the following fields: account time: for example, September 1, 2020, account type: for example, customer transaction, credit card, account amount: unit yuan, when writing message data to the cross-blockchain message queue: assuming that the message queue is partitioned by time, blockchain 1 saves messages in September, and blockchain 2 saves messages in October, then the message data will be written to blockchain 1; assuming that the message is partitioned by business type, blockchain 1 saves customer transaction messages, and blockchain 2 saves credit card messages, then the message will be written to blockchain 1.

[0110] The management smart contract triggering a new message event can be implemented specifically through the monitoring interface A12 and the message event A13, that is, after the monitoring interface A12 determines that a new message is inserted into the data smart contract, the management smart contract generates an event notification according to the event notification template corresponding to the message receiving device related to the data smart contract in advance, and obtains a new message event for notifying the existence of a new message. In different application scenarios, the event notification can be output in the form of a log, can be generated by an event, or can be generated by the SetEvent method.

[0111] A process for managing smart contract reading message data provided by an embodiment of the present application can be shown in the following steps:

[0112] Step 1: The message receiving device constructs a message transaction and sends it to the management smart contract through the transceiver interface A11.

[0113] Step 2: The management smart contract determines the matching data smart contract based on the type of transaction parameters of the acquired message transaction.

[0114] Step 3: The management smart contract takes the first element in the message list of the matching data smart contract from the matching data smart contract as the sending message, and deletes the first element.

[0115] Step 4: The management smart contract returns the sent message to the message receiving device.

[0116] The embodiment of the present application also provides a disaster recovery logic. When an abnormality occurs in the node of the blockchain corresponding to the data smart contract, as long as the number of abnormal nodes does not exceed the minimum number of nodes required for consensus of the blockchain, for example, the number of surviving nodes of the blockchain exceeds 2 / 3 of the nodes of the blockchain or exceeds 1 / 2 of the nodes of the blockchain, the blockchain and the data smart contract on the blockchain can still be used normally, and the corresponding message queue of the blockchain can send and receive messages normally, that is, the writing and reading operations of the messages can be realized.

[0117] When the number of nodes that survive in the blockchain is less than two-thirds of the total number of nodes in the blockchain or less than one-half of the total number of nodes in the blockchain, no message can be written into the data smart contract corresponding to the blockchain because the blockchain cannot achieve consensus. However, it can be set that when there is still one node surviving in the blockchain, the complete historical message can still be read from the blockchain, that is, the partition enters the read-only state.

[0118] When a large number of nodes in the blockchain where the management smart contract is located are abnormal, resulting in abnormal consensus on the blockchain, the blockchain cannot reach consensus and no messages can be written. However, as long as there is still a node alive in the blockchain, the complete historical messages can still be read from the blockchain. Since the management smart contract is unavailable, the entire message queue enters a read-only state. That is, only the message list of the data smart contract managed by the management smart contract can be read, and no write operations can be performed.

[0119] When the blockchain where the management smart contract is located can perform write and read operations, in the blockchain corresponding to the data smart contract managed by the management smart contract, there may be some blockchains that enter a read-only state due to node abnormalities, and these partial blockchains do not affect other blockchains with normal nodes, that is, other blockchains can still perform write and read operations.

[0120] It should be noted that, for the description of the same steps and the same contents in this embodiment as those in other embodiments, reference can be made to the description in other embodiments and will not be repeated here.

[0121] In the embodiment of the present application, after receiving the target transaction sent by the client device through the cross-blockchain distributed message processing platform running the first smart contract, at least one second blockchain for running the second smart contract is determined based on the target transaction, and based on the target transaction, the target operation for at least one second blockchain is performed, that is, the second smart contract is managed through the first smart contract, and the message is stored in the blockchain corresponding to the second smart contract for storing the corresponding type of message or the message is obtained from the blockchain corresponding to the second smart contract storing the corresponding type of message, which solves the problem of low reliability of the distributed message queue, proposes a cross-blockchain distributed message processing solution, realizes decentralization, effectively improves the reliability of distributed messages, and reduces the risk of not being able to provide services under conditions such as computer room failure, downtime and hacker attacks. Moreover, even if a blockchain is attacked and cannot perform storage operations, as long as there is a node in the blockchain that survives, it can still ensure that the messages of the partition corresponding to the blockchain can be read, so that the message queue can continue to work.

[0122] Based on the foregoing embodiments, the embodiments of the present application provide a cross-blockchain distributed message processing platform for running a first smart contract. The cross-blockchain distributed message processing platform is used to maintain the first blockchain, referring to Fig.10 As shown, the cross-blockchain distributed message processing platform 3 may include: a processor 31, a memory 32 and a communication bus 33, wherein:

[0123] A memory 32, for storing executable instructions;

[0124] A communication bus 33, used to realize the communication connection between the processor 31 and the memory 32;

[0125] The processor 31 is used to execute the cross-blockchain distributed message processing program stored in the memory 32 to implement the following steps:

[0126] receiving a target transaction sent by a client device;

[0127] Based on the target transaction, determining at least one second blockchain having a second smart contract; wherein the first smart contract is used to manage the second smart contract, and each second blockchain is used to store at least one type of transaction message;

[0128] Based on the target transaction, a target operation is performed on at least one second blockchain; wherein the target operation is associated with the target transaction, and the target operation includes a storage operation or an acquisition operation.

[0129] In other embodiments of the present application, the first smart contract includes at least the following contents: blockchain identification information of multiple reference blockchains managed by the first smart contract and the address of the reference smart contract running on each reference blockchain, the second blockchain belongs to multiple reference blockchains, and the second smart contract is used for message storage management.

[0130] In other embodiments of the present application, when the processor executes the step of determining at least one second blockchain having a second type of smart contract based on the target transaction, it can be implemented by the following steps:

[0131] If the target transaction is a message storage transaction, obtain the target message from the target transaction;

[0132] determining a first message type of a target message;

[0133] At least one second blockchain is determined based on the first message type.

[0134] In other embodiments of the present application, when the processor executes the step of executing the target operation on at least one second blockchain based on the target transaction, it can be implemented by the following steps:

[0135] If the number of types included in the first message type is 1, store the target message in the second blockchain;

[0136] If the number of types included in the first message type is greater than 1, classify the target message according to the sub-message types included in the first message type to obtain multiple sub-messages;

[0137] Each sub-message is stored in a second blockchain corresponding to the sub-message type; wherein the target operation includes a storage operation.

[0138] In other embodiments of the present application, after the processor executes the step of executing the target operation on at least one second blockchain based on the target transaction, it is further configured to execute the following steps:

[0139] Based on at least one second blockchain, obtaining an event notification template corresponding to a target device; wherein the target device is a device used to call a message stored in at least one second blockchain;

[0140] Generate target event notification based on event notification template;

[0141] Send a target event notification to the target device; wherein the target event notification is used to notify the target device that there is a pending message that needs to be processed.

[0142] In other embodiments of the present application, when the processor executes the step of determining at least one second blockchain having a second type of smart contract based on the target transaction, it can be implemented by the following steps:

[0143] If the target transaction is a message acquisition transaction, determining a second message type of the message to be acquired from the target transaction;

[0144] Based on the second message type, at least one second blockchain is determined.

[0145] In other embodiments of the present application, when the processor executes the step of executing the target operation on at least one second blockchain based on the target transaction, it can be implemented by the following steps:

[0146] Obtain a message to be obtained from at least one second blockchain;

[0147] Send the message to be obtained to the client device.

[0148] In other embodiments of the present application, after the processor executes the step of receiving the target transaction sent by the client device, it is further configured to execute the following steps:

[0149] Detecting a first survival rate of nodes included in the cross-blockchain distributed message processing platform;

[0150] If the first survival rate is less than the first preset threshold, and the target transaction is a message storage transaction, the target transaction is terminated;

[0151] If the first survival rate is less than a first preset threshold, and the target transaction is a message acquisition transaction, a message to be acquired is acquired from at least one second blockchain, and the message to be acquired is sent to the client device.

[0152] In other embodiments of the present application, the processor is further configured to execute the steps:

[0153] If the first survival rate is greater than or equal to the first preset threshold, detecting the second survival rates of the nodes corresponding to n second blockchains; wherein n is the number of blockchains of the at least one second blockchain, and n is an integer greater than or equal to 1;

[0154] If the second survival rate of the i second blockchains is less than the second preset threshold, and the target transaction is a message storage transaction for the i second blockchains, the target transaction for the i second blockchains is terminated; wherein i is an integer greater than or equal to 1 and less than or equal to n;

[0155] If the second survival rate of the i second blockchains is less than the second preset threshold, and the target transaction is a message acquisition transaction for the i second blockchains, the message to be acquired is acquired from the i second blockchains, and the message to be acquired is sent to the client device;

[0156] If the second survival rates of the j second blockchains are greater than or equal to the second preset threshold, based on the target transaction, the target operation for the j second blockchains is performed; wherein j is an integer greater than or equal to 1 and less than or equal to n, and the sum of i and j is n.

[0157] It should be noted that the specific implementation process of information interaction between units in the cross-blockchain distributed message processing platform in this embodiment can be referred to Figures 1 to 2 and Figures 6 to 7 The implementation process of the cross-blockchain distributed message processing method provided by the corresponding embodiment will not be repeated here.

[0158] In the embodiment of the present application, after receiving the target transaction sent by the client device through the cross-blockchain distributed message processing platform running the first smart contract, at least one second blockchain for running the second smart contract is determined based on the target transaction, and based on the target transaction, the target operation for at least one second blockchain is performed, that is, the second smart contract is managed through the first smart contract, and the message is stored in the blockchain corresponding to the second smart contract for storing the corresponding type of message or the message is obtained from the blockchain corresponding to the second smart contract storing the corresponding type of message, which solves the problem of low reliability of the distributed message queue, proposes a cross-blockchain distributed message processing solution, realizes decentralization, effectively improves the reliability of distributed messages, and reduces the risk of not being able to provide services under conditions such as computer room failure, downtime and hacker attacks. Moreover, even if a blockchain is attacked and cannot perform storage operations, as long as there is a node in the blockchain that survives, it can still ensure that the messages of the partition corresponding to the blockchain can be read, so that the message queue can continue to work.

[0159] Based on the foregoing embodiments, the embodiments of the present application provide a computer-readable storage medium, referred to as a storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the following. Figures 1 to 2 and Figures 6 to 7 The implementation process of the cross-blockchain distributed message processing method provided by the corresponding embodiment will not be repeated here.

[0160] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of hardware embodiments, software embodiments, or embodiments in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.

[0161] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0162] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0163] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0164] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application.

Claims

1. A cross-blockchain distributed message processing method, characterized in that: The method is applied to a cross-blockchain distributed message processing platform that runs a first smart contract, and the cross-blockchain distributed message processing platform is used to maintain the first blockchain. The method includes: receiving a target transaction sent by a client device; Based on the target transaction, determining at least one second blockchain having a second smart contract; wherein the first smart contract is used to manage the second smart contract, and each second blockchain is used to store at least one type of transaction message; After receiving the target transaction sent by the client device, the method further includes: detecting a first survival rate of the nodes included in the cross-blockchain distributed message processing platform; if the first survival rate is less than a first preset threshold and the target transaction is a message storage transaction, terminating the target transaction; if the first survival rate is less than a first preset threshold and the target transaction is a message acquisition transaction, acquiring a message to be acquired from at least one of the second blockchains, and sending the message to be acquired to the client device; if the first survival rate is greater than or equal to the first preset threshold, detecting the second survival rates of the nodes corresponding to n second blockchains; wherein n is the number of blockchains of the at least one second blockchain, and n is an integer greater than or equal to 1; if the second survival rates of i second blockchains If the second survival rate of i second blockchains is less than the second preset threshold, and the target transaction is a message storage transaction for i second blockchains, the target transaction for i second blockchains is terminated; wherein i is an integer greater than or equal to 1 and less than or equal to n; if the second survival rate of i second blockchains is less than the second preset threshold, and the target transaction is a message acquisition transaction for i second blockchains, the message to be acquired is acquired from i second blockchains, and the message to be acquired is sent to the client device; if the second survival rate of j second blockchains is greater than or equal to the second preset threshold, based on the target transaction, the target operation for j second blockchains is performed; wherein j is an integer greater than or equal to 1 and less than or equal to n, and the sum of i and j is n; Based on the target transaction, a target operation is performed on at least one of the second blockchains; wherein the target operation is associated with the target transaction, and the target operation includes a storage operation or an acquisition operation.

2. The method according to claim 1, characterized in that The first smart contract includes at least the following contents: blockchain identification information of multiple reference blockchains managed by the first smart contract and the address of the reference smart contract running on each reference blockchain, the second blockchain belongs to multiple reference blockchains, and the second smart contract is used for message storage management.

3. The method according to claim 1 or 2, characterized in that: The determining, based on the target transaction, at least one second blockchain having a second type of smart contract comprises: If the target transaction is a message storage transaction, obtaining a target message from the target transaction; determining a first message type of the target message; At least one second blockchain is determined based on the first message type.

4. The method according to claim 3, characterized in that The performing a target operation on at least one of the second blockchains based on the target transaction includes: If the number of types included in the first message type is 1, storing the target message in the second blockchain; If the number of types included in the first message type is greater than 1, classifying the target message according to the sub-message types included in the first message type to obtain multiple sub-messages; Store each of the sub-messages in the second blockchain of the corresponding sub-message type; wherein the target operation includes a storage operation.

5. The method according to claim 4, characterized in that After executing the target operation on at least one of the second blockchains based on the target transaction, the method further includes: Based on at least one of the second blockchains, obtaining an event notification template corresponding to a target device; wherein the target device is a device used to call a message stored in at least one of the second blockchains; Based on the event notification template, generate a target event notification; The target event notification is sent to the target device; wherein the target event notification is used to notify the target device that there is a pending message that needs to be processed.

6. The method according to any one of claims 1 to 2 and 5, characterized in that: The determining, based on the target transaction, at least one second blockchain having a second type of smart contract comprises: If the target transaction is a message acquisition transaction, determining a second message type of the message to be acquired from the target transaction; Based on the second message type, at least one second blockchain is determined.

7. The method according to claim 6, characterized in that The performing a target operation on at least one of the second blockchains based on the target transaction includes: Obtain a message to be obtained from at least one of the second blockchains; Send the message to be obtained to the client device.

8. A cross-blockchain distributed message processing platform, characterized in that: The cross-blockchain distributed message processing platform for running the first smart contract is used to maintain the first blockchain, and the cross-blockchain distributed message processing platform includes: a memory, a processor, and a communication bus; wherein: The memory is used to store executable instructions; The communication bus is used to realize the communication connection between the processor and the memory; The processor is used to execute the cross-blockchain distributed message processing program stored in the memory to implement the steps of the cross-blockchain distributed message processing method as described in any one of claims 1 to 7.

9. A storage medium, characterized in that: A cross-blockchain distributed message processing program is stored on the storage medium, and when the cross-blockchain distributed message processing program is executed by the processor, the steps of the cross-blockchain distributed message processing method as described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Transaction method based on public chain and block chain system

    CN110866823A