CN112788108A - Cross-block-chain distributed message processing method, platform and storage medium - Google Patents

Cross-block-chain distributed message processing method, platform and storage medium Download PDF

Info

Publication number
CN112788108A
CN112788108A CN202011594607.9A CN202011594607A CN112788108A CN 112788108 A CN112788108 A CN 112788108A CN 202011594607 A CN202011594607 A CN 202011594607A CN 112788108 A CN112788108 A CN 112788108A
Authority
CN
China
Prior art keywords
message
target
blockchain
transaction
intelligent contract
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011594607.9A
Other languages
Chinese (zh)
Inventor
莫楠
石翔
王�章
贺双洪
郭锐
李辉忠
范瑞彬
张开翔
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
WeBank Co Ltd
Original Assignee
WeBank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by WeBank Co Ltd filed Critical WeBank Co Ltd
Priority to CN202011594607.9A priority Critical patent/CN112788108A/en
Publication of CN112788108A publication Critical patent/CN112788108A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Abstract

The embodiment of the application discloses a cross-block chain distributed message processing method, which comprises the following steps: receiving a target transaction sent by a client device; determining at least one second blockchain having a second intelligent contract based on the target transaction; wherein the first intelligent contract is used for managing the second intelligent contracts, and each second blockchain is used for storing at least one type of transaction message; performing a target operation for at least one of the second blockchains based on the target transaction; wherein the target operation has an association relation with the target transaction, and the target operation comprises a storage operation or an acquisition operation. The embodiment of the application also discloses a trans-block chain distributed message processing platform and a storage medium.

Description

Cross-block-chain distributed message processing method, platform and storage medium
Technical Field
The present application relates to the field of blockchain technologies, and in particular, to a method, a platform, and a storage medium for processing a distributed message across blockchains.
Background
With the rapid development of computer technology, more and more technologies are applied in the financial field, and the traditional financial industry is gradually changing to financial technology (Fintech), but higher requirements are also put forward on the technologies due to the requirements of the financial industry on safety and real-time performance. The distributed message queue can be operated in an independent service mode, and can help the distributed system to realize the characteristics of high performance, high availability, scalability, final consistency and the like. The distributed message queue is widely applied to a distributed system and becomes an important component, and the problems of application coupling, asynchronous messages, traffic peak clipping and the like are effectively solved.
However, the distributed message queues in the existing distributed system are deployed in a centralized manner in a certain mechanism and controlled by a single mechanism, and under the conditions of machine room failure, downtime, hacking and the like, the distributed message queues cannot provide services, so that the reliability of the distributed message queues is low.
Content of application
In order to solve the above technical problems, embodiments of the present application are expected to provide a method, a platform, and a storage medium for processing a distributed message across a blockchain, so as to solve the problem of low reliability of a distributed message queue, provide a scheme for processing a distributed message across a blockchain, achieve decentralization, effectively improve reliability of a distributed message, and reduce a risk that a service cannot be provided under the conditions of a machine room fault, downtime, hacking, and the like.
The technical scheme of the application is realized as follows:
in a first aspect, a method for processing a distributed message across block chains is applied to a distributed message processing platform running a first intelligent contract, where the distributed message processing platform is used to maintain a first block chain, and the method includes:
receiving a target transaction sent by a client device;
determining at least one second blockchain having a second intelligent contract based on the target transaction; wherein the first intelligent contract is used for managing the second intelligent contracts, and each second blockchain is used for storing at least one type of transaction message;
performing a target operation for at least one of the second blockchains based on the target transaction; wherein the target operation has an association relation with the target transaction, and the target operation comprises a storage operation or an acquisition operation.
In a second aspect, a cross blockchain distributed message processing platform for running a first intelligent contract is configured to maintain a first blockchain, and includes: a memory, a processor, and a communication bus; wherein:
the memory to store executable instructions;
the communication bus is used for realizing communication connection between the processor and the memory;
the processor is configured to execute the inter-blockchain distributed message processing program stored in the memory, so as to implement the steps of the inter-blockchain distributed message processing method according to any one of the above descriptions.
In a third aspect, a storage medium has stored thereon a cross blockchain distributed message processing program which, when executed by a processor, implements the steps of the cross blockchain distributed message processing method as set forth in any one of the above.
In the embodiment of the application, after receiving a target transaction sent by a client device, a cross-block-chain distributed message processing platform running a first intelligent contract determines at least one second block chain with a second intelligent contract based on the target transaction, and executes a target operation for the at least one second block chain based on the target transaction, that is, the second intelligent contract is managed through the first intelligent contract, and the message is stored into a block chain corresponding to the second intelligent contract for storing a message of a corresponding type or is acquired from the block chain corresponding to the second intelligent contract for storing a message of a corresponding type, so that the problem of low reliability of a distributed message queue is solved, a scheme of cross-block-chain distributed message processing is provided, decentralized is realized, the reliability of distributed messages is effectively improved, and machine room fault are reduced, The risk of failing to provide service under conditions such as downtime and hacking.
Drawings
Fig. 1 is a schematic flowchart of a cross-block-chain distributed message processing method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of another cross-blockchain distributed message processing method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a message according to an embodiment of the present application;
FIG. 4 is a schematic structural diagram of a first intelligent contract provided in an embodiment of the present application;
FIG. 5 is a schematic structural diagram of a second intelligent contract provided in an embodiment of the present application;
fig. 6 is a schematic flowchart of another cross-blockchain distributed message processing method according to an embodiment of the present application;
fig. 7 is a schematic flowchart of a method for processing a distributed message across block chains according to another embodiment of the present application;
fig. 8 is a schematic diagram of a cross-block chain message queue architecture according to an embodiment of the present application;
fig. 9 is a schematic diagram of an intelligent contract structure of a distributed message queue across block chains according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a cross-blockchain distributed message processing platform according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
An embodiment of the present application provides a cross-blockchain distributed message processing method, which is applied to a cross-blockchain distributed message processing platform running a first intelligent contract, and the cross-blockchain distributed message processing platform is used for maintaining a first blockchain, and includes the following steps:
step 101, receiving a target transaction sent by a client device.
In the embodiment of the application, the inter-blockchain distributed message processing platform is composed of a plurality of inter-blockchain distributed message processing devices which have computational analysis capability and can be used as blockchain operation nodes, and the inter-blockchain distributed message processing platform comprises a plurality of blockchain operation nodes. The cross-blockchain distributed message processing equipment can operate at least one blockchain node, and the corresponding entity equipment can be equipment such as servers, desktop computers, notebook computers, tablet computers, smart phones in various forms, even vehicle-mounted computers and the like; or may be a virtual device, corresponding to a virtual Machine (EVM) executing an intelligent contract in the etherhouse block chain.
The client device may be a device running a client node in a blockchain. The first intelligent contract is a management intelligent contract which is set in a certain blockchain in the current blockchain system, for example, the first blockchain and has a management function of managing other blockchains, and when a client node needs to communicate with other blockchains, the first intelligent contract needs to be executed through a node running the first intelligent contract. The target transaction may be a transaction in which the first client node needs to store data to the blockchain or to retrieve data from the blockchain.
At least one second blockchain having a second intelligent contract is determined based on the target transaction, step 102.
Wherein the first intelligent contract is used for managing second intelligent contracts, and each second blockchain is used for storing at least one type of transaction message.
In an embodiment of the present application, the second intelligent contract is used for managing data in the second blockchain, and the transaction message may be data information transmitted between the client node and the blockchain. Since the type of data that the corresponding second blockchain can store is defined in the second intelligent contract, the corresponding at least one second blockchain with the second intelligent contract can be determined according to the type of the data to be processed included in the target transaction.
Step 103, executing target operation aiming at least one second block chain based on the target transaction.
The target operation and the target transaction have an association relationship, and the target operation comprises a storage operation or an acquisition operation.
In the embodiment of the present application, the target operation is determined by the target transaction, that is, according to the transaction requirement of the target transaction, the corresponding target operation performed on the at least one second blockchain may 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 onto the corresponding second blockchain; and when the transaction requirement of the target transaction is to acquire data, the corresponding target operation aiming at the at least one second block chain is to acquire the corresponding data from the corresponding second block chain.
In the embodiment of the application, after receiving a target transaction sent by a client device, a cross-block-chain distributed message processing platform running a first intelligent contract determines at least one second block chain with a second intelligent contract based on the target transaction, and executes a target operation for the at least one second block chain based on the target transaction, that is, the second intelligent contract is managed through the first intelligent contract, and the message is stored into a block chain corresponding to the second intelligent contract for storing a message of a corresponding type or is acquired from the block chain corresponding to the second intelligent contract for storing a message of a corresponding type, so that the problem of low reliability of a distributed message queue is solved, a scheme of cross-block-chain distributed message processing is provided, decentralized is realized, the reliability of distributed messages is effectively improved, and machine room fault are reduced, The risk of failing to provide service under conditions such as downtime and hacking.
Based on the foregoing embodiments, an embodiment of the present application provides a method for processing a distributed message across block chains, which is shown in fig. 2 and includes the following steps:
step 201, a cross-block chain distributed message processing platform receives a target transaction sent by a client device.
Wherein the first intelligent contract comprises at least the following: the method comprises the following steps that block chain identification information of a plurality of reference block chains managed by a first intelligent contract and the address of a reference intelligent contract operated by each reference block chain, a second block chain belongs to the plurality of reference block chains, and the second intelligent contract is used for message storage management.
In the embodiment of the application, all the client devices determine the cross-block chain distributed message processing platform running the first intelligent contract in advance, so that when all the client devices communicate with the block chain system, a communication link is directly established with the cross-block chain distributed message processing platform running the first intelligent contract. In some application scenarios, the client device may not determine the inter-blockchain distributed message processing platform running the first intelligent contract, so that when the client device communicates with the blockchain system, the blockchain system may notify the client device of running the inter-blockchain distributed message processing platform of the first intelligent contract, and then the client device establishes a communication link with the inter-blockchain distributed message processing platform, thereby implementing the distributed message storage and acquisition process.
After the communication link is established between the trans-block chain distributed message processing platform and the client device, the client device sends the target transaction to the trans-block chain distributed message processing platform.
After the step 201 is executed by the inter-blockchain distributed message processing platform, the steps 202 to 207 can be selectively executed, or the steps 208 to 211 can be selectively executed. If the target transaction is a message storage transaction, selectively executing steps 202-207 to realize message writing operation, and if the target transaction is a message acquisition transaction, selectively executing steps 208-211 to realize message reading operation:
step 202, if the target transaction is a message storage transaction, the cross-block chain distributed message processing platform acquires the target message from the target transaction.
In the embodiment of the application, the cross-block-chain distributed message processing platform determines the transaction requirements corresponding to the received target transaction, and if the target transaction is determined to be a message storage transaction, the cross-block-chain distributed message processing platform acquires the target message to be stored from the target transaction.
For example, the structure of the target message can be shown in fig. 3, and includes a message body and a message content, wherein the message subject is used for identifying the type of the message, and the message content is used for identifying the data content contained in the target message. The targeted message belongs to a transaction message.
Step 203, determining a first message type of the target message by the cross-blockchain distributed message processing platform.
In this embodiment of the present application, the span blockchain distributed message processing platform analyzes the target message, and determines a first message type of the target message, where the first message type may be, for example, a data type of data included in the target message, or an object from which the target message comes, and the first message type is set in the target message instead of being obtained by analyzing the target message, that is, the first message type of the target message may be directly obtained from the target message.
Step 204, the cross-blockchain distributed message processing platform determines at least one second blockchain based on the first message type.
In the embodiment of the application, the across-block-chain distributed message processing platform determines to obtain at least one second block chain for storing the target message according to the stored chain identification information of the plurality of third block chains for storing different types of data contents and the first message type. The at least one second blockchain belongs to a plurality of third blockchains.
Illustratively, when the structure of the target message is as shown in fig. 3, the message topic of the target message may be directly obtained from the structure of the target message, and the message type of the target message is obtained and recorded as the first message type. Since different second blockchains are used for storing different types of data content, the cross-blockchain distributed message processing platform can determine at least one second blockchain used for storing the target information according to the first message type.
Correspondingly, as shown in fig. 4, in a first intelligent contract running across the block chain distributed message processing platform, a list of second intelligent contracts managed by the first intelligent contract is stored, where the list at least indicates chain identification information of a block chain in which each corresponding second intelligent contract is located and a contract address of each second intelligent contract, and the list includes, for example, chain identification information 1, contract address 1, chain identification information 2, contract address 2, chain identification information 3, contract address 3, and … …. The chain identification information of the blockchain where the second intelligent contract is located may further have a function of indicating a data type of data stored in the blockchain, or the data type stored in the blockchain where the second intelligent contract is located may be directly identified in the list. In this way, the cross blockchain distributed message processing platform may determine a corresponding second intelligent contract from the list stored in the first intelligent contract and determine a corresponding second blockchain from the determined second intelligent contract.
After the step 204 is executed by the inter-block chain distributed message processing platform, the step 205 or the steps 206 to 207 may be selectively executed, if the number of types included in the first message type is 1, the step 205 may be selectively executed, and if the number of types included in the first message type is greater than 1, the steps 206 to 207 may be selectively executed.
Step 205, if the number of types included in the first message type is 1, storing the target message to the second blockchain by the cross-blockchain distributed message processing platform.
In this embodiment of the application, when it is determined that the number of types included in the obtained first message type is 1, the across-block-chain distributed message processing platform directly stores the target message into a second block chain used for storing the message of the first message type, so as to implement a write operation on the second block chain.
And step 206, if the number of types included in the first message type is greater than 1, classifying the target message by the trans-block chain distributed message processing platform according to the sub-message type included in the first message type to obtain a plurality of sub-messages.
In the embodiment of the present application, in some application scenarios, the target message may also be a plurality of sub-messages classified according to sub-message types.
And step 207, storing each sub-message to a second block chain of the corresponding sub-message type by the cross-block chain distributed message processing platform.
Wherein the target operation comprises a send operation.
In the embodiment of the application, different sub-messages need to be stored in the second block chains corresponding to the sub-message types because the different second block chains store the data information of different message types, so that the different sub-messages are stored in the different second block chains, distributed storage of the different messages in the different block chains is realized, and the safety and reliability of the messages can be effectively guaranteed based on the characteristics of the block chains.
For example, taking the target message as an example of sending the account flow information for the bank, it is assumed that the account flow contains the following fields: account time: day 1 of 9 month to day 30 of 11 month, account amount: a unit cell. And each second block chain in the corresponding second block chains is used for storing data of one month. Thus, it can be determined that the first message type includes 3 sub-message types: months 9, 10 and 11, so 3 sub-messages are available: an account amount of 9 months, an account amount of 10 months, and an account amount of 11 months; and then, the account amount of 9 months is stored in a second block chain for storing the data of 9 months, the account amount of 10 months is stored in the second block chain for storing the data of 10 months, and the account amount of 11 months is sent to the second block chain for storing the data of 11 months.
For example, after the second blockchain for storing 9-month data receives the account amount of 9 months sent by the first blockchain, the account amount of 9 months is stored in the message list corresponding to the second intelligent contract operated by the second blockchain management, where the message list corresponding to the second intelligent contract operated by the second blockchain management may be as shown in fig. 5, where the account amount of 9 months may be stored at the end of the list of the current message list.
And step 208, if the target transaction is a message acquisition transaction, determining a second message type of the message to be acquired from the target transaction by the trans-block chain distributed message processing platform.
In the embodiment of the present application, when the target transaction is to acquire data information of 7 months, for example, in this way, the data information of 7 months of the message to be acquired can be determined from the target transaction, and the corresponding second message type is 7 months.
Step 209, the cross blockchain distributed message processing platform determines at least one second blockchain based on the second message type.
In the embodiment of the present application, based on the second message type being 7 months, a second block chain for storing data for 7 months may be determined.
Step 210, the trans-blockchain distributed message processing platform obtains the message to be obtained from at least one second blockchain.
In this embodiment of the application, since the inter-block chain distributed message processing platform may determine to obtain the chain identification information of the second block chain, the inter-block chain distributed message processing platform may determine the second block chain according to the chain identification information of the second block chain, and obtain the message to be obtained, which is matched with the target transaction, from the second block chain.
Illustratively, when the inter-block-chain distributed message processing platform acquires data information of 7 months from a message list of a second block chain storing data of 7 months, and it is assumed that when the current message list includes messages 1, 2 and 3 according to the sequence from top to bottom of the list from beginning to end of the list, it may be determined that the message 1 is a stored message farthest from the current time, and is next the message 2, and the message 3 is a stored message closest to the current time, so that the inter-block-chain distributed message processing platform acquires a message with the longest history from the message list of the second block chain storing data of 7 months and feeds back the message to the client device, that is, the first message, i.e., the message 1, is acquired as a message to be acquired, that is, the message list in the second block chain may store data in a first-in-first-out manner. In some application scenarios, after the second blockchain sends the table head message in the information list to the across-blockchain distributed message processing platform, the table head message can also be deleted, and the next message after the original table head is moved forward, so that the next message is called a new table head message.
And step 211, sending the message to be acquired to the client device by the trans-blockchain distributed message processing platform.
In the embodiment of the application, the acquired message to be acquired is sent to the client device by the trans-blockchain distributed message processing platform, so that the response to the target transaction sent by the client device is realized.
Based on the foregoing embodiments, in other embodiments of the present application, referring to fig. 6, after performing step 205 or 207, the distributed message processing platform across block chains is further configured to perform steps 212 to 214:
step 212, the inter-blockchain distributed message processing platform obtains an event notification template corresponding to the target device based on the at least one second blockchain.
Wherein the target device is a device for invoking messages stored in the at least one second blockchain.
In this embodiment of the present application, a preset target device that can call a message in each third block chain is in a first intelligent contract running across a block chain distributed message processing platform, and when a new message is stored in each third block chain, an event notification template that notifies the target device that calls the message in each third block chain is stored, where the event notification template may be written into a first intelligent contract corresponding to a first block chain by each target device in advance according to its own requirements. The target device may be a client device in the blockchain system, or may be a node device such as another server device.
Step 213, the cross-blockchain distributed message processing platform generates a target event notification based on the event notification template.
And step 214, sending the target event notification to the target device by the cross-block chain distributed message processing platform.
The target event notification is used for notifying the target device that the message to be processed needs to be processed.
In the embodiment of the application, once the cross-blockchain distributed message processing platform stores the message into the corresponding second blockchain, the target event notification is immediately generated to notify the corresponding device using the message, so that the corresponding device using the message obtains the latest message, and the use efficiency of the distributed message is effectively improved.
Thus, 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 trans-blockchain distributed message processing platform; receiving a target transaction sent by target equipment by a trans-block chain distributed message processing platform; determining a second message type of the message to be acquired from the target transaction by the trans-block chain distributed message processing platform; then, the trans-blockchain distributed message processing platform determines at least one second blockchain based on a second message type, and obtains a message to be obtained from the at least one second blockchain; and the trans-block chain distributed message processing platform sends the message to be acquired to the target equipment.
Based on the foregoing embodiments, in other embodiments of the present application, as shown in fig. 7, after the step 201 is executed by the inter-blockchain distributed message processing platform, the steps 215 to 220 may also be executed by:
step 215, the inter-blockchain distributed message processing platform detects a first survival rate of nodes comprised by the inter-blockchain distributed message processing platform.
In this embodiment of the present application, the survival rate of the nodes included in the inter-blockchain distributed message processing platform may be determined according to various consensus mechanisms, that is, all nodes having an abnormality in the nodes included in the inter-blockchain distributed message processing platform are excluded.
And step 216, if the first survival rate is smaller than a first preset threshold value and the target transaction is a message storage transaction, ending the target transaction by the cross-block chain distributed message processing platform.
In this embodiment, the first preset threshold is an empirical value obtained through a large number of experiments, and may be, for example, one third of the number of nodes included in the inter-blockchain distributed message processing platform or one half of the number of nodes. In this way, when a first survival rate of a node included in the inter-blockchain distributed message processing platform is smaller than a first preset threshold, a write operation, that is, a storage operation, for a plurality of third blockchains managed by the inter-blockchain distributed message processing platform is prohibited.
And step 217, if the first survival rate is smaller than a first preset threshold value and the target transaction is a message acquisition transaction, acquiring a message to be acquired from at least one second blockchain by the cross-blockchain distributed message processing platform, and sending the message to be acquired to the client device.
In the embodiment of the present application, when the first survival rate is less than the first preset threshold, the reading operation may be performed.
Step 218, if the first survival rate is greater than or equal to the first preset threshold, the inter-blockchain distributed message processing platform detects a second survival rate of the node corresponding to the n second blockchains.
Wherein n is the number of block chains of the at least one second block chain, and n is an integer greater than or equal to 1.
Step 219, if the second survival rate of the i second blockchains is less than a second preset threshold and the target transaction is a message storage transaction for the i second blockchains, the inter-blockchain distributed message processing platform ends the target transaction for the i second blockchains.
Wherein i is an integer greater than or equal to 1 and less than or equal to n.
Step 220, if the second survival rate of the i second blockchains is smaller than a second preset threshold value and the target transaction is a message acquisition transaction for the i second blockchains, the cross-blockchain distributed message processing platform acquires a message to be acquired from the i second blockchains and sends the message to be acquired to the client device.
Step 221, if the second survival rate of the j second block chains is greater than or equal to a second preset threshold, the inter-block chain distributed message processing platform executes target operation for the j second block chains based on the target transaction.
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.
In this embodiment of the application, the implementation process of executing the target operation for the j second blockchains by the inter-blockchain distributed message processing platform based on the target transaction may specifically refer to the implementation processes of the multiple embodiments formed in steps 202 to 214, and details are not described here. Therefore, when the second survival rate of part of the second block chains is low, the part of the second block chains can be read, and when the second survival rate of other parts of the normal second block chains is high, the writing operation and the reading operation can be realized, the use of the distributed messages is effectively improved, and the use experience effect of a user is ensured.
It should be noted that steps 202-214 are performed when the first survival rate is greater than a first predetermined threshold and each second survival rate is greater than a second predetermined threshold.
Based on the foregoing embodiments, an embodiment of the present application provides a cross-block chain type message queue architecture, which, as shown in fig. 8, includes a block chain a and a block chain B. The block chain a is deployed with a management intelligent contract and a data intelligent contract 1, the block chain 2 is deployed with a data intelligent contract 2, the client device C is in direct communication with the block chain a deployed with the management intelligent contract, and circles shown in the block chain a and the block chain B in fig. 8 represent nodes constituting the block chain. It should be noted that the management intelligent contract corresponds to the first intelligent contract, and the data intelligent contract 1 and the data intelligent contract 2 correspond to the second intelligent contract. The intelligent management contract is responsible for managing the intelligent contracts of the queue data, externally exposes a message interface, does not directly store message data, and internally comprises a list of the intelligent data contracts and stores the link identification information and contract addresses of all the intelligent contracts of the queue data. The data intelligent contract is responsible for storing message data, and comprises a message list for storing a plurality of messages. And a plurality of data intelligent contracts are deployed on different block chains according to partitions, so that parallel expansion of a message queue is realized.
The management intelligent contract stores the addresses of a plurality of data intelligent contracts, data are stored in the data intelligent contracts on different block chains according to partition rules, and the partition rules can be set to be partitioned according to time and business according to actual requirements, wherein different partition rules influence the message receiving and sending processes.
Illustratively, different blockchains are used for storing message data of different dates according to time division, assuming that the message data of 9 months, 10 months and 11 months can be stored according to months, the message data of 9 months, 10 months and 11 months are respectively stored in blockchain 1, blockchain 2 and blockchain 3, and the contract addresses of the three blockchains are written into the management intelligent contracts.
The data intelligent contract is established according to the service partition, the data intelligent contract is divided into client transaction data, credit card transaction data and peer transaction data when the cross-link message queue is used for banking service, the data of the 3 service types are respectively stored in a block chain 1, a block chain 2 and a block chain 3, and three contract addresses are written into the management intelligent contract.
An intelligent contract structure of a cross blockchain distributed message queue corresponding to the cross blockchain distributed message queue architecture shown in fig. 8 can be seen with reference to fig. 9. As shown in FIG. 9, the management intelligent contracts A1 include a list of data intelligent contracts, the data intelligent contracts 1A2 include a list of messages 1, and the data intelligent contracts 2B1 include a list of messages 2. The exposed-to-outside message interfaces included in the management intelligence contract a1 have at least three interfaces, such as a transceiving interface a11, a listening interface a12, and a message event a 13. Thus, the distributed queue across the block chain is composed of two types of contracts, namely a management intelligent contract and a data intelligent contract. Wherein:
the process for managing the intelligent contract receiving message data provided by the embodiment of the application can comprise the following steps:
step 1, after receiving an operation instruction of a user, the client device constructs a message transaction and sends the message transaction to a management intelligent contract of the block chain 1 through a transceiving interface A11.
And 2, managing parameters in the message sending transaction by analyzing the intelligent contract, and determining the types of transaction parameters included in the message sending transaction.
And 3, selecting the corresponding data intelligent contract according to the type of the transaction parameters by the management intelligent contract.
And 4, the management intelligent contract inserts the message data in the message sending transaction into the tail end of a message list of the corresponding data intelligent contract.
And 5, after the management intelligent contract inserts the message data into the tail of the message list of the corresponding data intelligent contract, triggering a new message event.
For example, taking a bank sending account flow information as an example, the account flow contains the following fields: account time: for example, 9/1/2020, account type: e.g., customer transaction, credit card, account amount: a unit cell that, when writing message data to a cross-blockchain message queue: assuming that the message queue is partitioned according to time, the block chain 1 stores messages of 9 months, and the block chain 2 stores messages of 10 months, then the message data can be written into the block chain 1; assuming that the messages are partitioned by service type, blockchain 1 holds messages for customer transactions and blockchain 2 holds messages for credit cards, the messages will be written to blockchain 1.
The management intelligent contract triggering new message event may be specifically realized by monitoring interface a12 and message event a13, that is, after monitoring interface a12 determines that a new message is inserted into a data intelligent contract, the management intelligent contract generates an event notification according to an event notification template corresponding to a message receiving device that is agreed in advance and is related to the data intelligent contract, and obtains a new message event for notifying the existence of the new message. Under different application scenarios, the event notification may be output in a log manner, may be generated by an event (event), or may be generated by a SetEvent manner.
The process for managing the intelligent contract reading message data provided by the embodiment of the application can comprise the following steps:
step 1, the message receiving equipment constructs and obtains the message transaction and sends the message transaction to the management intelligent contract through the transceiving interface A11.
And 2, determining the matched data intelligent contract according to the type of the transaction parameters of the acquired message transaction by the management intelligent contract.
And 3, taking out the first element in the message list of the matched data intelligent contract from the matched data intelligent contract by the management intelligent contract as a sending message, and deleting the first element.
And 4, the management intelligent contract returns the sending message to the message receiving equipment.
The embodiment of the present application further provides a disaster recovery logic, when a node of a blockchain corresponding to a data intelligent contract is abnormal, as long as the number of abnormal nodes does not exceed the minimum number of nodes that the blockchain needs to be identified, for example, the number of nodes that survive in the blockchain exceeds 2/3 nodes of the blockchain or 1/2 nodes of the blockchain, the blockchain and the data intelligent contract on the blockchain can still be used normally, and a message queue of the corresponding blockchain can receive and send messages normally, that is, a write operation and a read operation of a message can be implemented.
When the number of the surviving nodes of the blockchain is less than two-thirds of the total node number of the blockchain or less than two-halves of the total node number of the blockchain, because the blockchain cannot realize consensus, no message can be written into the data intelligence contract corresponding to the blockchain. However, it can be set that when one node of the blockchain is still alive, the complete history message can still be read out from the blockchain, i.e. the partition enters a read-only state.
When a large number of nodes are abnormal in the block chain where the intelligent contract is managed, and the block chain consensus is abnormal, the block chain cannot be identified in common and any message cannot be written in. But as long as one node of the blockchain still survives, the complete history message can still be read from the blockchain, and the whole message queue enters a read-only state due to the unavailability of the management intelligence contract. That is, only the message list of the data intelligent contract managed by the management intelligent contract can be read, and the write operation cannot be performed.
When the block chain where the management intelligent contract is located can perform write-in and read-out operations, in the block chain corresponding to the data intelligent contract managed by the management intelligent contract, there may exist a part of the block chain, which enters a read-only state due to node abnormality, and these part of the block chain do not affect other normal block chains of other nodes, that is, other block chains can still perform write-in operations and read-out operations.
It should be noted that, for the descriptions of the same steps and the same contents in this embodiment as those in other embodiments, reference may be made to the descriptions in other embodiments, which are not described herein again.
In the embodiment of the application, after receiving a target transaction sent by a client device, a cross-block-chain distributed message processing platform running a first intelligent contract determines at least one second block chain for running a second intelligent contract based on the target transaction, and executes a target operation for the at least one second block chain based on the target transaction, that is, the second intelligent contract is managed through the first intelligent contract, and the message is stored into a block chain corresponding to the second intelligent contract for storing a message of a corresponding type or is acquired from the block chain corresponding to the second intelligent contract for storing a message of a corresponding type, so that the problem of low reliability of a distributed message queue is solved, a scheme of cross-block-chain distributed message processing is provided, decentralized is realized, the reliability of distributed messages is effectively improved, and the problem of low on-premise fault at a machine room is reduced, The risk of failing to provide service under conditions such as downtime and hacking. Moreover, even if a certain block chain is attacked to cause that the storage operation cannot be carried out, as long as one node in the block chain survives, the message of the partition corresponding to the block chain can still be read, so that the message queue can continue to work.
Based on the foregoing embodiments, an embodiment of the present application provides a across-blockchain distributed message processing platform, where the across-blockchain distributed message processing platform for running a first intelligent contract is configured to maintain a first blockchain, and referring to fig. 10, the across-blockchain distributed message processing platform 3 may include: a processor 31, a memory 32, and a communication bus 33, wherein:
a memory 32 for storing executable instructions;
a communication bus 33 for implementing a communication connection between the processor 31 and the memory 32;
a processor 31 for executing a cross blockchain distributed message processing program stored in the memory 32 to implement the following steps:
receiving a target transaction sent by a client device;
determining at least one second blockchain having a second intelligent contract based on the target transaction; wherein the first intelligent contract is used for managing second intelligent contracts, and each second blockchain is used for storing at least one type of transaction message;
performing a target operation for at least one second blockchain based on the target transaction; the target operation and the target transaction have an association relationship, and the target operation comprises a storage operation or an acquisition operation.
In other embodiments of the present application, the first smart contract comprises at least the following: the method comprises the following steps that block chain identification information of a plurality of reference block chains managed by a first intelligent contract and the address of a reference intelligent contract operated by each reference block chain, a second block chain belongs to the plurality of reference block chains, and the second intelligent contract is used for message storage management.
In other embodiments of the present application, the processor performing step, when determining at least one second blockchain having a second type of smart contract based on the target transaction, may be accomplished by:
if the target transaction is a message storage transaction, acquiring a target message from the target transaction;
determining a first message type of a target message;
at least one second blockchain is determined based on the first message type.
In other embodiments of the present application, the processor executing step, when executing the target operation for the at least one second blockchain based on the target transaction, may be implemented by:
if the type number included in the first message type is 1, storing the target message to a second block chain;
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 a plurality of sub-messages;
storing each sub-message to a second block chain of the corresponding sub-message type; wherein the target operation comprises a store operation.
In other embodiments of the present application, the processor, after performing the target operation for the at least one second blockchain based on the target transaction, is further configured to perform the following steps:
acquiring an event notification template corresponding to the target device based on at least one second blockchain; the target device is a device for calling the message stored in the at least one second blockchain;
generating a target event notification based on the event notification template;
sending a target event notification to the target device; the target event notification is used for notifying the target device that the message to be processed needs to be processed.
In other embodiments of the present application, the processor performing step, when determining at least one second blockchain having a second type of smart contract based on the target transaction, may be accomplished by:
if the target transaction is a message acquisition transaction, determining a second message type of the message to be acquired from the target transaction;
at least one second blockchain is determined based on the second message type.
In other embodiments of the present application, the processor executing step, when executing the target operation for the at least one second blockchain based on the target transaction, may be implemented by:
acquiring a message to be acquired from at least one second block chain;
and sending the message to be acquired to the client equipment.
In other embodiments of the present application, after the processor executes the step of receiving the target transaction sent by the client device, the processor is further configured to execute the following steps:
detecting a first survival rate of nodes included in a cross-blockchain distributed message processing platform;
if the first survival rate is smaller than a first preset threshold value and the target transaction is a message storage transaction, ending the target transaction;
and if the first survival rate is smaller than a first preset threshold value and the target transaction is a message acquisition transaction, acquiring a message to be acquired from at least one second block chain, and sending the message to be acquired to the client device.
In other embodiments of the present application, the processor is further configured to perform the steps of:
if the first survival rate is greater than or equal to a first preset threshold value, detecting second survival rates of nodes corresponding to the n second block chains; wherein n is the number of block chains of the at least one second block chain, and n is an integer greater than or equal to 1;
if the second survival rate of the i second blockchains is smaller than a second preset threshold value and the target transaction is the message storage transaction aiming at the i second blockchains, ending the target transaction aiming at the i second blockchains; wherein i is an integer greater than or equal to 1 and less than or equal to n;
if the second survival rate of the i second block chains is smaller than a second preset threshold value and the target transaction is a message acquisition transaction aiming at the i second block chains, acquiring a message to be acquired from the i second block chains and sending the message to be acquired to the client equipment;
if the second survival rate of the j second blockchains is greater than or equal to a second preset threshold value, executing target operation aiming at the j second blockchains based on the target transaction; 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.
It should be noted that, in this embodiment, a specific implementation process of information interaction between units in the span-block chain distributed message processing platform may refer to an implementation process in the span-block chain distributed message processing method provided in the embodiments corresponding to fig. 1 to 2 and fig. 6 to 7, and details are not described here.
In the embodiment of the application, after receiving a target transaction sent by a client device, a cross-block-chain distributed message processing platform running a first intelligent contract determines at least one second block chain for running a second intelligent contract based on the target transaction, and executes a target operation for the at least one second block chain based on the target transaction, that is, the second intelligent contract is managed through the first intelligent contract, and the message is stored into a block chain corresponding to the second intelligent contract for storing a message of a corresponding type or is acquired from the block chain corresponding to the second intelligent contract for storing a message of a corresponding type, so that the problem of low reliability of a distributed message queue is solved, a scheme of cross-block-chain distributed message processing is provided, decentralized is realized, the reliability of distributed messages is effectively improved, and the problem of low on-premise fault at a machine room is reduced, The risk of failing to provide service under conditions such as downtime and hacking. Moreover, even if a certain block chain is attacked to cause that the storage operation cannot be carried out, as long as one node in the block chain survives, the message of the partition corresponding to the block chain can still be read, so that the message queue can continue to work.
Based on the foregoing embodiments, embodiments of the present application provide a computer-readable storage medium, referred to as a storage medium for short, where one or more programs are stored in the computer-readable storage medium, and the one or more programs can be executed by one or more processors to implement a cross-blockchain distributed message processing method implementation process provided in the embodiments corresponding to fig. 1 to 2 and fig. 6 to 7, which is not described herein again.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above description is only a preferred embodiment of the present application, and is not intended to limit the scope of the present application.

Claims (11)

1. A method for processing a distributed message across block chains is applied to a distributed message processing platform running a first intelligent contract, wherein the distributed message processing platform is used for maintaining the first block chain, and the method comprises the following steps:
receiving a target transaction sent by a client device;
determining at least one second blockchain having a second intelligent contract based on the target transaction; wherein the first intelligent contract is used for managing the second intelligent contracts, and each second blockchain is used for storing at least one type of transaction message;
performing a target operation for at least one of the second blockchains based on the target transaction; wherein the target operation has an association relation with the target transaction, and the target operation comprises a storage operation or an acquisition operation.
2. The method of claim 1, wherein the first smart contract comprises at least the following: the first intelligent contract is used for managing the information storage of the information, and the second intelligent contract is used for managing the information storage of the information.
3. The method of claim 1 or 2, wherein determining at least one second blockchain having a second type of smart contract based on the target transaction comprises:
if the target transaction is a message storage transaction, acquiring a target message from the target transaction;
determining a first message type of the target message;
determining at least one of the second blockchains based on the first message type.
4. The method of claim 3, wherein performing the target operation for at least one of the second blockchains based on the target transaction comprises:
if the number of types included in the first message type is 1, storing the target message to the second block chain;
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 a plurality of sub-messages;
storing each said sub-message to said second blockchain for the corresponding sub-message type; wherein the target operation comprises a store operation.
5. The method of claim 4, wherein after performing the target operation for at least one of the second blockchains based on the target transaction, the method further comprises:
acquiring an event notification template corresponding to the target equipment based on at least one second block chain; wherein the target device is a device for invoking a message stored in at least one of the second blockchains;
generating a target event notification based on the event notification template;
sending the target event notification to the target device; wherein the target event notification is used for notifying the target device that the message to be processed needs to be processed.
6. The method of any of claims 1-2 and 5, wherein determining at least one second blockchain having a second type of smart contract based on the target transaction 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;
determining at least one of the second blockchains based on the second message type.
7. The method of claim 6, wherein performing the target operation for at least one of the second blockchains based on the target transaction comprises:
acquiring a message to be acquired from at least one second block chain;
and sending the message to be acquired to the client equipment.
8. The method of claim 1, wherein after receiving the target transaction sent by the client device, the method further comprises:
detecting a first survival rate of a node included in the inter-blockchain distributed message processing platform;
if the first survival rate is smaller than a first preset threshold value and the target transaction is a message storage transaction, ending the target transaction;
and if the first survival rate is smaller than a first preset threshold value and the target transaction is a message acquisition transaction, acquiring a message to be acquired from at least one second block chain, and sending the message to be acquired to the client device.
9. The method of claim 8, further comprising:
if the first survival rate is greater than or equal to a first preset threshold value, detecting second survival rates of the nodes corresponding to the n second block chains; wherein n is the number of block chains of the at least one second block chain, and n is an integer greater than or equal to 1;
if the second survival rates of the i second blockchains are smaller than a second preset threshold and the target transaction is a message storage transaction for the i second blockchains, ending the target transaction for the i second blockchains; wherein i is an integer greater than or equal to 1 and less than or equal to n;
if the second survival rates of the i second blockchains are smaller than a second preset threshold value and the target transaction is a message acquisition transaction for the i second blockchains, acquiring a message to be acquired from the i second blockchains and sending the message to be acquired to the client device;
if the second survival rate of the j second blockchains is greater than or equal to a second preset threshold value, executing target operation aiming at the j second blockchains based on the target transaction; 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.
10. A cross blockchain distributed message processing platform for running a first intelligent contract, the cross blockchain distributed message processing platform for maintaining a first blockchain, the cross blockchain distributed message processing platform comprising: a memory, a processor, and a communication bus; wherein:
the memory to store executable instructions;
the communication bus is used for realizing communication connection between the processor and the memory;
the processor is configured to execute the inter-blockchain distributed message processing program stored in the memory, and implement the steps of the inter-blockchain distributed message processing method according to any one of claims 1 to 9.
11. A storage medium having stored thereon a cross blockchain distributed message processing program which, when executed by a processor, implements the steps of the cross blockchain distributed message processing method of any one of claims 1 to 9.
CN202011594607.9A 2020-12-29 2020-12-29 Cross-block-chain distributed message processing method, platform and storage medium Pending CN112788108A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011594607.9A CN112788108A (en) 2020-12-29 2020-12-29 Cross-block-chain distributed message processing method, platform and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011594607.9A CN112788108A (en) 2020-12-29 2020-12-29 Cross-block-chain distributed message processing method, platform and storage medium

Publications (1)

Publication Number Publication Date
CN112788108A true CN112788108A (en) 2021-05-11

Family

ID=75751371

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011594607.9A Pending CN112788108A (en) 2020-12-29 2020-12-29 Cross-block-chain distributed message processing method, platform and storage medium

Country Status (1)

Country Link
CN (1) CN112788108A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113259478A (en) * 2021-06-17 2021-08-13 支付宝(杭州)信息技术有限公司 Method and device for executing transaction in blockchain system and blockchain system
CN115150413A (en) * 2022-05-20 2022-10-04 网易(杭州)网络有限公司 Block chain data storage method and device, electronic equipment and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113259478A (en) * 2021-06-17 2021-08-13 支付宝(杭州)信息技术有限公司 Method and device for executing transaction in blockchain system and blockchain system
CN115150413A (en) * 2022-05-20 2022-10-04 网易(杭州)网络有限公司 Block chain data storage method and device, electronic equipment and storage medium
CN115150413B (en) * 2022-05-20 2023-11-03 网易(杭州)网络有限公司 Block chain data storage method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US10528405B2 (en) Methods, apparatus and computer programs for managing persistence
US10649953B2 (en) Blockchain-based data migration method and apparatus
US10261853B1 (en) Dynamic replication error retry and recovery
US20180121909A1 (en) System and method to dynamically setup a private sub-blockchain based on agility of transaction processing
CN111371892A (en) High-concurrency distributed message pushing system and method
CN104063293B (en) A kind of data back up method and stream calculation system
CN111144883B (en) Processing performance analysis method and device for blockchain network
CN112788108A (en) Cross-block-chain distributed message processing method, platform and storage medium
CN112306655A (en) Task auditing method and device, computer equipment and storage medium
CN112468361A (en) Network connection state monitoring method and device, electronic equipment and storage medium
CN106603279A (en) Disaster tolerance method and disaster tolerance system
CN112437001B (en) Method and device for guaranteeing reliable delivery and consumption of messages
US7454478B1 (en) Business message tracking system using message queues and tracking queue for tracking transaction messages communicated between computers
CN111475501A (en) Data cleaning method and device for block chain network
CN110704438A (en) Method and device for generating bloom filter in block chain
CN113347238A (en) Message partitioning method, system, device and storage medium based on block chain
CN108241616B (en) Message pushing method and device
CN111628903A (en) Monitoring method and monitoring system for transaction system running state
CN112948501B (en) Data analysis method, device and system
CN111541747B (en) Data check point setting method and device
CN108632321A (en) Treating method and apparatus based on scheduling of resource under big data platform
CN113191901A (en) Transaction service processing method, device, equipment and storage medium
CN106789272A (en) A kind of server set group managing means and system
WO2019205023A1 (en) Blockchain-based data management method and related system
CN109561120A (en) Small documents backup method, systems and management server

Legal Events

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