Partition interaction method, device and medium

By using common nodes as anchor nodes in the blockchain system, messages are transmitted within the program using cross-partition modules and components, network delay and message loss problems between multiple partitions are solved, and efficient and secure message delivery is achieved.

CN114217980BActive Publication Date: 2025-08-15HANGZHOU QULIAN TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In the blockchain system, the message interaction between multiple partitions has the risk of network delay and message loss, and the existing cross-chain technology cannot effectively solve it.

Method used

By using common nodes as anchor nodes in the blockchain system, messages are transmitted within the program using cross-partition modules and components, and buffered channels are used to ensure the orderliness and loss of messages.

Benefits of technology

It improves the efficiency of message delivery, reduces the risk of loss and tampering, and realizes fast and error-free delivery of inter-partition messages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114217980B_ABST
    Figure CN114217980B_ABST
Patent Text Reader

Abstract

This application provides a partition interaction method, device, and medium applicable to the field of blockchain technology. The method is applied to a blockchain system comprising at least a first partition and a second partition, wherein a common node between the first and second partitions is a target physical node, and the target physical node comprises a cross-partition module, a first cross-partition component, and a second cross-partition component. The method comprises: the first partition receives a first message input by a user and sends the first message to the cross-partition module via the first cross-partition component; the cross-partition module generates a second message based on the first message and sends the second message to the second partition via the second cross-partition component.
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 partition interaction method, device, and medium. Background Art

[0002] In a blockchain system, there is usually a need for interactive messages between multiple partitions.

[0003] Currently, business chains with similar functions to partitions usually use cross-chain technology to realize message interaction between multiple chains. Specifically, messages are exchanged directly between chains through the network, or cross-chain gateways are deployed between chains as intermediate routes for message interaction.

[0004] However, whether exchanging messages directly over the network or using a cross-chain gateway, multi-chain messaging requires network transmission, which not only introduces network latency but also carries the risk of message loss. Therefore, how to quickly and accurately transmit messages between multiple partitions in a blockchain system has become a pressing technical challenge. Summary of the Invention

[0005] The present application provides a partition interaction method, device, and medium, which solve the problem of how to quickly and accurately transmit messages between multiple partitions of a blockchain system.

[0006] To achieve the above objectives, this application adopts the following technical solutions:

[0007] In a first aspect, embodiments of the present application provide a partition interaction method. This method is applied to a blockchain system, which includes at least a first partition and a second partition. The common node between the first and second partitions is a target physical node, and the target physical node includes a cross-partition module, a first cross-partition component, and a second cross-partition component. The method includes: the first partition receives a first message input by a user, and sends the first message to the cross-partition module via the first cross-partition component; the cross-partition module generates a second message based on the first message, and sends the second message to the second partition via the second cross-partition component.

[0008] In one possible implementation, before the first partition obtains the first message input by the user, the method further includes: the cross-partition module receives the first transaction sent by the first partition through the first cross-partition component, and receives the second transaction sent by the second partition through the second cross-partition component, the first transaction and the second transaction are used to request that the target physical node be registered as an anchor node; the cross-partition module determines, based on the first transaction and the second transaction, that both the first partition and the second partition initiate anchor node registration requests, and generates a third transaction, and sends the third transaction to the second partition through the second cross-partition component, the third transaction is used to indicate that the first partition has requested to register the target physical node as an anchor node; if the second partition successfully verifies the third transaction, the second partition sends verification success information to the cross-partition module through the second cross-partition component; the cross-partition module generates a fourth transaction based on the verification success information, and sends the fourth transaction to the first partition through the first cross-partition component, the fourth transaction is used to indicate that the target physical node has been successfully registered as an anchor node.

[0009] In one possible implementation, after sending the fourth transaction to the first partition through the first cross-partition component, the method further includes: the first partition sends a reply message of the fourth transaction to the cross-partition module through the first cross-partition component, where the reply message of the fourth transaction is used to indicate that the fourth transaction was successfully executed; and the cross-partition module sets the first partition to a registered state.

[0010] In one possible implementation, the method further includes: before the cross-partition module sends the second message to the second partition through the second cross-partition component, the cross-partition module saves the second message; after the second partition receives the second message, the second partition sends a reply message of the second message to the cross-partition module through the second cross-partition component, and the reply message of the second message is used to indicate that the second partition has successfully received the second message; the cross-partition module deletes the saved second message.

[0011] In a possible implementation, a buffered channel is used to transmit messages between the cross-partition module and the first cross-partition component and the second cross-partition component.

[0012] It can be understood that by adopting a buffered channel, message transmission is first-in-first-out, and there is no need to mark the sequence number for the message, which can ensure that the message interaction is naturally orderly and the message will not be lost.

[0013] In a second aspect, embodiments of the present application provide a partition interaction method. This method is applied to a target physical node, which is a common node between a first partition and a second partition in a blockchain system. The target physical node includes a cross-partition module, a first cross-partition component, and a second cross-partition component. The method includes: the cross-partition module receives a first message sent from the first partition via the first cross-partition component; the cross-partition module generates a second message based on the first message; and the cross-partition module sends the second message to the second partition via the second cross-partition component.

[0014] In one possible implementation, before the cross-partition module receives the first message sent by the first partition through the first cross-partition component, the method also includes: the cross-partition module receives the first transaction sent by the first partition through the first cross-partition component, and receives the second transaction sent by the second partition through the second cross-partition component, the first transaction and the second transaction are used to request that the target physical node be registered as an anchor node; the cross-partition module determines, based on the first transaction and the second transaction, that both the first partition and the second partition initiate anchor node registration requests, and generates a third transaction, and sends the third transaction to the second partition through the second cross-partition component, the third transaction is used to indicate that the first partition has requested to register the target physical node as an anchor node; the cross-partition module receives verification success information sent by the second partition through the second cross-partition component, the verification success information is sent when the second partition successfully verifies the third transaction; the cross-partition module generates a fourth transaction based on the verification success information, and sends the fourth transaction to the first partition through the first cross-partition component, the fourth transaction is used to indicate that the target physical node has been successfully registered as an anchor node.

[0015] In a third aspect, embodiments of the present application provide a partition interaction device. This device is a common node for transmitting messages between a first partition and a second partition in a blockchain system. The device includes a cross-partition module, a first cross-partition component, and a second cross-partition component. The cross-partition module is configured to receive a first message sent by the first partition via the first cross-partition component, generate a second message based on the first message, and send the second message to the second partition via the second cross-partition component.

[0016] In one possible implementation, the cross-partition module is further used to: receive a first transaction sent by the first partition through a first cross-partition component, and receive a second transaction sent by the second partition through a second cross-partition component, the first transaction and the second transaction being used to request that the target physical node be registered as an anchor node; determine, based on the first transaction and the second transaction, that both the first partition and the second partition initiate anchor node registration requests, generate a third transaction, and send the third transaction to the second partition through the second cross-partition component, the third transaction being used to indicate that the first partition has requested to register the target physical node as an anchor node; receive verification success information sent by the second partition through the second cross-partition component, the verification success information being sent when the second partition successfully verifies the third transaction; generate a fourth transaction based on the verification success information, and send the fourth transaction to the first partition through the first cross-partition component, the fourth transaction being used to indicate that the target physical node has been successfully registered as an anchor node.

[0017] In a fourth aspect, an embodiment of the present application provides a server comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the partition interaction method provided in the first aspect is implemented.

[0018] In a fifth aspect, an embodiment of the present application provides a storage medium on which a computer program is stored. The computer program is loaded by a processor to execute the partition interaction method provided in the first aspect.

[0019] The partition interaction method, device, and medium provided in this application are for blockchain systems. Since there is a common node between the first and second partitions in the blockchain system, this common node can be used as a channel for inter-partition message transmission. Specifically, after the first partition obtains the first message, the first partition can directly send the first message to the cross-partition module through the first cross-partition component; then, the cross-partition module generates a second message based on the first message, and sends the second message to the second partition through the second cross-partition component, thereby realizing the transmission of messages between partitions. Since the message is transmitted within the program without being transmitted through the network, the transmission efficiency is high, it is not easy to be lost, and the risk of tampering is reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 The overall architecture diagram of the blockchain system provided in the embodiment of this application;

[0021] Figure 2 One of the flow diagrams of a partition interaction method provided in an embodiment of the present application;

[0022] Figure 3 The second flowchart of a partition interaction method provided in an embodiment of the present application;

[0023] Figure 4 A schematic diagram of the architecture of the target physical node provided in an embodiment of the present application;

[0024] Figure 5 The third flowchart of a partition interaction method provided in an embodiment of the present application;

[0025] Figure 6 A fourth flowchart of a partition interaction method provided in an embodiment of the present application;

[0026] Figure 7 A fifth flow chart of a partition interaction method provided in an embodiment of the present application;

[0027] Figure 8 A schematic diagram of the structure of a partition interaction device provided in an embodiment of the present application;

[0028] Figure 9 A schematic diagram of the structure of a server provided in an embodiment of the present application. DETAILED DESCRIPTION

[0029] In the following description, specific details such as specific system structures and techniques are provided for purposes of illustration rather than limitation to facilitate a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obscuring the description of the present application with unnecessary detail.

[0030] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.

[0031] As used in this specification and the appended claims, the term "if" can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0032] In the description of this application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0033] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.

[0034] In blockchain systems, there's often a need for message exchange between multiple partitions, but relevant technologies haven't yet proposed a solution for this. Currently, for business chains with similar functionality, relevant technologies propose using cross-chain technology to enable message exchange between multiple chains. Specifically, this involves directly exchanging messages between chains over the network, or deploying a cross-chain gateway as an intermediate router for message exchange. However, whether this involves direct network exchange or using a cross-chain gateway, message exchange between multiple chains requires network transmission, which not only incurs network latency but also carries the risk of message loss. Using cross-chain technology to achieve message exchange between multiple chains has certain drawbacks and is not suitable for exchanging messages between multiple partitions. Therefore, ensuring fast and accurate message transmission between multiple partitions remains a pressing technical challenge.

[0035] In order to solve the above technical problems, the embodiments of the present application provide a partition interaction method, device and medium. For the blockchain system, since there is a common node between the first partition and the second partition in the blockchain system, the common node can be used as a channel for message transmission between partitions. Specifically, the first partition can directly send the first message to the cross-partition module through the first cross-partition component; then, the cross-partition module generates a second message based on the first message, and sends the second message to the second partition through the second cross-partition component, thereby realizing the transmission of messages between partitions. Since the message is transmitted within the program without being transmitted through the network, the transmission efficiency is high, it is not easy to be lost, and the risk of tampering is reduced.

[0036] In order to illustrate the technical solution of the present application, the following embodiments are described with reference to the accompanying drawings.

[0037] Figure 1 This is a diagram of the overall architecture of a blockchain system provided in an embodiment of the present application. The blockchain system may include at least two partitions, such as a first partition and a second partition. Each of the at least two partitions may include at least two physical nodes.

[0038] For example, in Figure 1 In the blockchain system shown, the first partition ns1 can include physical nodes 1, 5, 6, and 7, and the second partition ns2 can include physical nodes 1, 2, 3, and 4. Since physical node 1 is located in both the first partition ns1 and the second partition ns2, physical node 1 can be used as a medium for message exchange between the first partition ns1 and the second partition ns2. That is, physical node 1 can be used as an anchor node to connect the two partitions.

[0039] It should be noted that the above Figure 1The following example illustrates a blockchain system with two partitions, each of which includes four physical nodes. This does not limit the present embodiments. It is understood that a blockchain system may include more than two partitions, and the number of physical nodes in each partition may be determined based on actual application needs.

[0040] Figure 2 This is a flow chart of a partition interaction method provided in an embodiment of the present application. The method can be applied to a blockchain system, which can include at least a first partition and a second partition. The method can include the following steps S201 to S204.

[0041] S201: A first partition obtains a first message.

[0042] S202: The first partition sends a first message to the anchor node.

[0043] Correspondingly, the anchor node receives the first message.

[0044] The anchor node is a common node in the first partition and the second partition for transmitting messages.

[0045] S203: The anchor node generates a second message according to the first message.

[0046] S204: The anchor node sends the second message to the second partition.

[0047] Correspondingly, the second partition receives the second message.

[0048] For example, a user can send a message, msg1, to the first partition, ns1, which then receives it. After msg1 is executed on ns1, the anchor node in ns1 can monitor the execution result of msg1 and verify msg1. After successfully verifying msg1, the anchor node can construct the next-stage message, msg2, based on msg1 and send it to the second partition, ns2, which then receives it. In this way, the anchor node, acting as the message channel between ns1 and ns2, transfers a message from one partition to another.

[0049] Furthermore, in order to transmit messages between partitions through anchor nodes, common physical nodes can be registered as anchor nodes in advance between partitions. Figure 2 ,like Figure 3 As shown, before S201, the partition interaction method provided in the embodiment of the present application may further include the following S205 to S212.

[0050] S205. The first partition sends the first transaction to the target physical node.

[0051] Accordingly, the target physical node receives the first transaction.

[0052] S206. The second partition sends the second transaction to the target physical node.

[0053] Accordingly, the target physical node receives the second transaction.

[0054] The target physical node is a common node in the first partition and the second partition, and the first transaction and the second transaction are used to request to register the target physical node as an anchor node.

[0055] S207: The target physical node determines, based on the first transaction and the second transaction, that both the first partition and the second partition initiate anchor node registration requests, and generates a third transaction.

[0056] S208. The target physical node sends the third transaction to the second partition.

[0057] Accordingly, the second partition receives the third transaction.

[0058] The third transaction is used to indicate that the first partition has requested to register the target physical node as an anchor node.

[0059] For example, assume that the target physical node node1 is a common node in the first partition ns1 and the second partition ns2. User 1 can initiate a transaction tx1 on ns1 and call the management contract. The content of this transaction is to register node1 as the anchor node for interaction between ns1 and ns2 on the ns1 partition. User 2 can initiate a transaction tx2 on ns2 and call the management contract. The content of this transaction is to register node1 as the anchor node for interaction between ns1 and ns2 on the ns2 partition. After node1 receives transactions tx1 and tx2, it can be found that a two-way registration has occurred, indicating that both ns1 and ns2 have initiated anchor node registration requests. Therefore, node1 can enter the confirmation phase.

[0060] S209: The second partition verifies whether the third transaction is successful.

[0061] S210: When the second partition successfully verifies the third transaction, the second partition sends verification success information to the target physical node.

[0062] Correspondingly, the target physical node receives verification success information.

[0063] S211. The target physical node generates a fourth transaction based on the verification success information.

[0064] S212: The target physical node sends the fourth transaction to the first partition.

[0065] Accordingly, the first partition receives the fourth transaction.

[0066] The fourth transaction is used to indicate that the target physical node has been successfully registered as an anchor node.

[0067] During the confirmation phase, node1 constructs a third transaction, tx3, and sends it to ns2. This tx3 confirms to ns2 that node1 has registered on ns1. The management contract on the ns2 chain compares the transaction content, comparing the registration information in tx3 with the records in the ledger. If the match fails, tx3 fails. If the match is correct, tx3 succeeds, completing the transaction on the ns2 chain and producing a block that cannot be rolled back. A verification success message is then sent to node1. Node1 constructs a tx4, confirming to ns1 that the registration process is complete. Based on tx4, ns1 confirms that node1 has successfully registered as an anchor node for both ns1 and ns2. ns1 can then send messages to ns2 through the anchor node, executing S201-S204.

[0068] In the partition interaction method provided in the embodiment of the present application, the first partition and the second partition can register the common node of the two partitions as an anchor node by sending a registration request to the common node of the two partitions, so that the anchor node can be used as a channel for message transmission between partitions.

[0069] In the above embodiment, steps S201-S212 implement information exchange between the anchor node and different partitions using the target physical node as the execution subject. In actual implementation, the embodiment of the present application designs the target physical node to consist of three parts: a cross-partition module, a first cross-partition component, and a second cross-partition component. These three modules are used to specifically implement information exchange between the anchor node and different partitions.

[0070] For example, Figure 4 This is a schematic diagram of the architecture of the target physical node provided in the embodiment of the present application. The following example takes a node participating in two partitions at the same time. Figure 4 The target physical node node1 shown can be simultaneously in Figure 1 The common node 1 of the two partitions shown is shown as Node 1. Node 1 may include a cross-partition module (crossModule, cm), a first cross-partition component (ns1-crossModuleClient, ns1-cmc), and a second cross-partition component (ns2-crossModuleClient, ns2-cmc).

[0071] The CM module is responsible for unified management of all cross-partition messages, including message verification, processing, and forwarding. The CMC component monitors cross-partition events within its corresponding partition and forwards messages received from the CM module to its own managed partition. The CM module also records registration relationships between partitions. Once the anchor node registration process is complete, any subsequent cross-partition messages received by the CM can be forwarded to the designated module.

[0072] It can be understood that since each partition, cm module, and each cmc component are components running within a program, their message communication uses channels, which has basically no delay and no risk of transmission loss. Compared with transmitting messages through the network, it can improve the efficiency of interaction between partitions.

[0073] Optionally, a buffered channel may be used to transmit messages between the cross-partition module and the first cross-partition component and the second cross-partition component.

[0074] For example, anchor nodes can process messages in the order they are received. For example, messages sent to the first partition will be processed first by the anchor node, and a new message will be generated and sent to the second partition. Message transmission between cross-partition components and modules is implemented using buffered channel technology, which inherently ensures orderly message delivery and loss-free delivery.

[0075] It should be noted that in order to more clearly illustrate the connection relationship between cm, ns1-cmc, ns2-cmc, ns1 and ns2, Figure 4 The following example takes node1 as an example and is independent of ns1 and ns2. Figure 1 As shown, node1 is a node in both ns1 and ns2. Figure 4 It is not shown, but it does not limit the embodiments of the present application.

[0076] Optionally, the partition interaction method provided in the embodiment of the present application may include two processes: the first process is anchor node registration, and the second process is message transmission. Figure 4 The architecture of the target physical node is shown, and the two processes are exemplarily described below.

[0077] The first process: Anchor node registration

[0078] In the case where the target physical node includes a cross-partition module, a first cross-partition component, and a second cross-partition component, Figure 3 ,like Figure 5As shown, S205 is specifically implemented through the following S205a, S206 is specifically implemented through the following S206a, S208 is specifically implemented through the following S208a, and S210-S212 are specifically implemented through the following S210a-S212a.

[0079] S205a. The first partition sends a first transaction to the cross-partition module through the first cross-partition component.

[0080] Correspondingly, the cross-partition module receives the first transaction sent by the first partition through the first cross-partition component.

[0081] S206a. The second partition sends a second transaction to the cross-partition module through the second cross-partition component.

[0082] Correspondingly, the cross-partition module receives the second transaction sent by the second partition through the second cross-partition component.

[0083] It should be noted that the present embodiment does not limit the execution order of S205a and S206a. That is, S205a may be executed first, then S206a; S206a may be executed first, then S205a; or S205a and S206a may be executed simultaneously. This can be determined based on actual usage requirements.

[0084] Optionally, before S205a, the partition interaction method provided in the embodiment of the present application may further include: if the first partition determines that the first transaction initiated by the user meets a first preset condition, the first partition sending the first transaction to the cross-partition module via the first cross-partition component. The first preset condition includes at least one of the following: the target physical node is a node in the first partition, and the anchor node of the first partition is unregistered.

[0085] Optionally, before S206a, the partition interaction method provided in the embodiment of the present application may further include: if the second partition determines that the second transaction initiated by the user meets a second preset condition, the second partition sending the second transaction to the cross-partition module via the second cross-partition component. The second preset condition includes at least one of the following: the target physical node is a node in the second partition, and the anchor node of the second partition is in an unregistered state.

[0086] In this embodiment of the present application, a partition can only have one anchor node set up with other partitions. If a physical node in a partition is already registered as an anchor node, other physical nodes in the same partition cannot be registered as anchor nodes at the same time. Therefore, the first preset condition can be set to the first partition's anchor node being unregistered, and the second preset condition can be set to the second partition's anchor node being unregistered.

[0087] S207: The cross-partition module determines, based on the first transaction and the second transaction, that both the first partition and the second partition initiate anchor node registration requests, and generates a third transaction.

[0088] S208a: The cross-partition module sends the third transaction to the second partition through the second cross-partition component.

[0089] Accordingly, the second partition receives the third transaction through the second cross-partition component.

[0090] S209: The second partition verifies whether the third transaction is successful.

[0091] S210a: When the second partition successfully verifies the third transaction, the second partition sends verification success information to the cross-partition module through the second cross-partition component.

[0092] Correspondingly, the cross-partition module receives verification success information through the second cross-partition component.

[0093] S211a. The cross-partition module generates a fourth transaction based on the verification success information.

[0094] S212a. The cross-partition module sends the fourth transaction to the first partition through the first cross-partition component.

[0095] Accordingly, the first partition receives the fourth transaction through the first cross-partition component.

[0096] In the partition interaction method provided in the embodiment of the present application, anchor node registration needs to be initiated separately by both partitions, and the registration information needs to be confirmed twice, which ensures that the identity of the anchor node is recognized and trusted by both partitions, thereby trusting the cross-partition messages transmitted in the anchor node, and the entire process is more secure and reliable.

[0097] In one implementation, combining Figure 5 ,like Figure 6 As shown, after the cross-partition module receives the first transaction sent by the first partition through the first cross-partition component, the partition interaction method provided in the embodiment of the present application may further include S213 and S214; after S209, the partition interaction method provided in the embodiment of the present application may further include S215 to S218.

[0098] S213. The cross-partition module saves the first transaction and sends a reply message of the first transaction to the first cross-partition component.

[0099] Correspondingly, the first cross-partition component receives a reply message of the first transaction.

[0100] S214. The first cross-partition component confirms, based on the reply message of the first transaction, that the first transaction has been sent to the cross-partition module, and sets the first cross-partition component to a pre-registered state.

[0101] S215: When the second partition fails to verify the third transaction, the second partition sends verification failure information to the cross-partition module through the second cross-partition component.

[0102] Correspondingly, the cross-partition module receives verification failure information through the second cross-partition component.

[0103] S216. The cross-partition module generates a fifth transaction based on the verification failure information.

[0104] S217. The cross-partition module sends the fifth transaction to the first cross-partition component.

[0105] Accordingly, the first cross-partition component receives the fifth transaction.

[0106] The fifth transaction is used to indicate that the target physical node fails to register as an anchor node.

[0107] S218. The first cross-partition component changes from a pre-registered state to a non-registered state.

[0108] It should be noted that, in the embodiment of the present application, S210a-204a and S215-218 are executed one by one.

[0109] For S210a-204a (in Figure 6 In the example shown in the figure, when the second partition successfully verifies the third transaction, the second partition sends a verification success message to the cross-partition module through the second cross-partition component. The cross-partition module can generate a fourth transaction indicating that the target physical node is successfully registered as an anchor node, and send the transaction to the first partition, so that the first partition and the second partition can transmit messages through the anchor node.

[0110] For S215-218 (in Figure 6 In the example shown in FIG5 , when the second partition fails to verify the third transaction, the second partition sends verification failure information to the cross-partition module through the second cross-partition component. The cross-partition module can generate a fifth transaction indicating that the registration of the target physical node as an anchor node has failed, and send the transaction to the first cross-partition component, so that the first cross-partition component can be released from the pre-registration state to facilitate the next anchor node registration.

[0111] In one implementation, after S212a, the partition interaction method provided in the embodiment of the present application may further include S219 and S220.

[0112] S219. The first partition sends a reply message of the fourth transaction to the cross-partition module through the first cross-partition component.

[0113] Correspondingly, the cross-partition module receives a reply message of the fourth transaction through the first cross-partition component.

[0114] The reply message of the fourth transaction may be used to indicate that the fourth transaction is successfully executed.

[0115] S220: The cross-partition module sets the first partition to a registered state.

[0116] If the fourth transaction is successfully executed, the first partition sends a reply message of the fourth transaction to the cross-partition module through the first cross-partition component, so that the cross-partition module can change the status corresponding to ns1 in the "ns that need to be managed" list maintained by itself to "registered", and then the cross-partition module begins to recover and process the transactions related to ns1 accumulated during this period.

[0117] Second process: message passing

[0118] In the case where the anchor node is a target physical node, and the target physical node includes a cross-partition module, a first cross-partition component, and a second cross-partition component, Figure 3 ,like Figure 5 As shown, S201 is specifically implemented through the following S201a, S202 is specifically implemented through the following S202a, S203 is specifically implemented through the following S203a, and S204 is specifically implemented through the following S204a.

[0119] S201a. The first partition obtains a first message input by a user.

[0120] S202a. The first partition sends a first message to the cross-partition module through the first cross-partition component.

[0121] Accordingly, the anchor node receives the first message through the first cross-partition component.

[0122] Optionally, the first message includes the identifier of the first partition. For example, the identifier of the first partition can be the block number of the first partition. It will be appreciated that using the block number as the message sequence number can better ensure the order of cross-partition messages. Furthermore, message transmission within the node ensures that the next message is sent after the previous message has been delivered, regardless of network conditions.

[0123] S203a: The cross-partition module generates a second message according to the first message.

[0124] S204a. The cross-partition module sends the second message to the second partition through the second cross-partition component.

[0125] Accordingly, the second partition receives the second message through the second cross-partition component.

[0126] For example, a user can send a message msg1 on the first partition ns1. After msg1 is executed on ns1, the first cross-partition component ns1-cmc monitors the execution result of the cross-partition message and records the message in key-value mode, where the key is the block number (or block header) where the message msg1 is located, and the value is all cross-partition messages in ns1. Then, ns1-cmc forwards the message together with the block number to the cross-partition module cm. After cm successfully verifies the message, cm can construct the next stage message msg2 based on the message and send msg2 to the second cross-partition component ns2-cmc. ns2-cmc forwards msg2 to the second partition ns2.

[0127] In the partition interaction method provided by the embodiments of the present application, a first partition can directly send a first message to a cross-partition module via a first cross-partition component. The cross-partition module then generates a second message based on the first message and sends the second message to a second partition via a second cross-partition component, thereby enabling inter-partition message transmission. Because messages are transmitted within the program without requiring network transmission, transmission efficiency is high, loss is less likely, and the risk of tampering is reduced.

[0128] Further, combined Figure 5 ,like Figure 7 As shown, before the first cross-partition component sends the first message to the cross-partition module, the partition interaction method provided by the embodiment of the present application may further include S221. After the cross-partition module receives the first message, the partition interaction method provided by the embodiment of the present application may further include S222 and S223.

[0129] S221. The first cross-partition component saves the first message.

[0130] S222. The cross-partition module sends a reply message to the first cross-partition component.

[0131] The reply message to the first message is used to indicate that the cross-partition module has successfully received the first message.

[0132] S223. The first cross-partition component deletes the saved first message.

[0133] Further, as Figure 7 As shown, before the cross-partition module sends the second message to the second partition through the second cross-partition component, the partition interaction method provided by the embodiment of the present application may further include S224. After the second partition receives the second message, the partition interaction method provided by the embodiment of the present application may further include S225 and S226.

[0134] S224. The cross-partition module saves the second message.

[0135] S225. The second partition sends a reply message of the second message to the cross-partition module through the second cross-partition component.

[0136] Correspondingly, the cross-partition module receives a reply message to the second message through the second cross-partition component.

[0137] The reply message to the second message is used to indicate that the second partition has successfully received the second message.

[0138] Optionally, the reply message to the second message includes the identifier of the second partition. For example, the identifier of the second partition can be the block number of the second partition. It will be appreciated that using the block number as the message sequence number can better ensure the order of cross-partition messages. Furthermore, message transmission within the node ensures that the next message is sent after the previous message has been delivered, regardless of network conditions.

[0139] S226. The cross-partition module deletes the saved second message.

[0140] For example, after msg2 completes execution on ns2, the second cross-partition component, ns2-cmc, monitors the execution result of the message and records it in a key-value format, where the key is the block number of msg2 and the value is all cross-partition messages in that partition. ns2-cmc then forwards the msg2 execution result to the cross-partition module, cm. This allows cm to delete the saved msg2.

[0141] Further, as Figure 7 As shown, after the second cross-partition component receives a reply message to the second message sent by the second partition, the partition interaction method provided in the embodiment of the present application may further include S227. After the cross-partition module receives a reply message to the second message through the second cross-partition component, the partition interaction method provided in the embodiment of the present application may further include S228 and S229.

[0142] S227. The second cross-partition component saves the reply message of the second message.

[0143] S228. The cross-partition module sends an indication message to the second cross-partition component.

[0144] Correspondingly, the second cross-partition component receives the indication information.

[0145] The indication information indicates that the cross-partition module has received a reply message to the second message.

[0146] S229. The second cross-partition component deletes the saved reply message of the second message.

[0147] In the partition interaction method provided by the embodiment of the present application, each cross-partition component will record the cross-partition messages transmitted from the partition and record the block number corresponding to the latest message. When the node is restarted after a crash, the cross-partition component will compare the difference between the latest block number recorded by itself and the actual latest block number on the partition, and then try to restore all cross-partition messages based on the lagging block content. The cross-partition module will record all cross-partition messages in progress and will not delete the message until it is received and processed. Since the message transmission has a complete atomicity guarantee mechanism, each component in the node will first store the message on disk after receiving it, and will not delete it until it is ensured that the message has been processed. Therefore, it is guaranteed that all cross-partition messages can be restored when the node crashes at any time.

[0148] like Figure 8 As shown, an embodiment of the present application provides a partition interaction device 800. The device is a common node for transmitting messages between the first and second partitions in a blockchain system. The device includes a cross-partition module 801, a first cross-partition component 802, and a second cross-partition component 803.

[0149] The cross-partition module 801 is configured to receive a first message sent by a first partition through a first cross-partition component 802 , generate a second message according to the first message, and send the second message to a second partition through a second cross-partition component 803 .

[0150] Optionally, the cross-partition module 801 may also be used to:

[0151] A first transaction sent by the first partition is received through the first cross-partition component 802, and a second transaction sent by the second partition is received through the second cross-partition component 803, the first transaction and the second transaction are used to request that the target physical node be registered as an anchor node; based on the first transaction and the second transaction, it is determined that both the first partition and the second partition initiate anchor node registration requests, and a third transaction is generated, and the third transaction is sent to the second partition through the second cross-partition component 803, the third transaction is used to indicate that the first partition has requested to register the target physical node as an anchor node; verification success information sent by the second partition is received through the second cross-partition component 803, the verification success information is sent when the second partition successfully verifies the third transaction; based on the verification success information, a fourth transaction is generated, and the fourth transaction is sent to the first partition through the first cross-partition component 802, the fourth transaction is used to indicate that the target physical node has been successfully registered as an anchor node.

[0152] Optionally, the cross-partition module 801 may be further configured to, after receiving the first transaction sent by the first partition via the first cross-partition component 802, save the first transaction and send a reply message of the first transaction to the first cross-partition component 802. The first cross-partition component 802 may be further configured to confirm, based on the reply message of the first transaction, that the first transaction has been sent to the cross-partition module 801 and set the transaction to a pre-registered state.

[0153] The cross-partition module 801 may also be configured to generate a fifth transaction based on the verification failure information sent by the second partition via the second cross-partition component 803, and send the fifth transaction to the first cross-partition component 802. The fifth transaction indicates that the target physical node has failed to register as an anchor node. The first cross-partition component 802 may also be configured to change the state from pre-registered to unregistered.

[0154] Optionally, the cross-partition module 801 can also be used to receive a reply message of the fourth transaction sent by the first partition through the first cross-partition component 802, where the reply message of the fourth transaction is used to indicate that the fourth transaction is successfully executed; and set the first partition to a registered state.

[0155] Optionally, the first cross-partition component 802 may be further configured to save the first message before sending it to the cross-partition module 801. The cross-partition module 801 may be further configured to, after receiving the first message, send a reply message to the first message to the first cross-partition component 802, where the reply message indicates that the cross-partition module 801 has successfully received the first message. The first cross-partition component 802 may also be configured to delete the saved first message.

[0156] Optionally, the cross-partition module 801 can also be used to save the second message before sending the second message to the second partition through the second cross-partition component 803; and receive a reply message to the second message sent by the second partition through the second cross-partition component 803, the reply message of the second message is used to indicate that the second partition has successfully received the second message; and delete the saved second message.

[0157] Optionally, the second cross-partition component 803 may be further configured to save the reply message to the second message after receiving the reply message to the second message sent by the second partition. The cross-partition module 801 may be further configured to send an indication message to the second cross-partition component 803 after receiving the reply message to the second message via the second cross-partition component 803, indicating that the reply message to the second message has been received. The second cross-partition component 803 may also be configured to delete the saved reply message to the second message.

[0158] The partition interaction device provided in this application utilizes a common node between the first and second partitions of a blockchain system, thereby enabling inter-partition message transmission. Specifically, after the cross-partition module receives a first message from the first partition via a first cross-partition component, it can generate a second message based on the first message and send the second message to the second partition via a second cross-partition component, thereby enabling inter-partition message transmission. Because messages are transmitted within the program without requiring network transmission, they are highly efficient, less likely to be lost, and less susceptible to tampering.

[0159] Optional, such as Figure 9 As shown, an embodiment of the present invention further provides a server 900, including a processor 901, a memory 902, and a computer program 903 stored in the memory 902 and executable on the processor 901. When the computer program is executed by the processor, the various processes of the above-mentioned method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be described here.

[0160] Exemplarily, a computer program may be divided into one or more modules / units, one or more of which are stored in a memory and executed by a processor to complete the present application. One or more modules / units may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program in the server. For example, a computer program may be divided into a request receiving unit, an information acquisition unit, an information search unit, and a data processing unit.

[0161] The server can be a computing device such as a server, desktop computer, tablet computer, cloud server and mobile terminal. The server may include, but is not limited to, a processor and memory. It will be understood by those skilled in the art that Figure 9 This is merely an example of the server 900 and does not constitute a limitation on the server 900 . The server 900 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the server may also include input and output devices, network access devices, buses, etc.

[0162] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0163] The memory can be an internal storage unit of the server, such as the server's hard drive or memory. The memory can also be an external storage device of the server, such as a plug-in hard drive, smart media card (SMC), secure digital (SD) card, flash card, etc.

[0164] Furthermore, the memory may include both an internal storage unit of the server and an external storage device. The memory is used to store computer programs and other programs and data required by the server. The memory may also be used to temporarily store data that has been output or is about to be output.

[0165] The present invention also provides a storage medium having a computer program stored thereon. When the computer program is executed by a processor, the computer program implements the various processes of the above-mentioned method embodiment and can achieve the same technical effect. To avoid repetition, the details are not described here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0166] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.

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

[0168] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are protected by the present invention.

Claims

1. A partition interaction method, characterized in that: Applied to a blockchain system, the blockchain system includes at least a first partition and a second partition, a common node of the first partition and the second partition is a target physical node, the target physical node includes a cross-partition module, a first cross-partition component, and a second cross-partition component, the method includes: The first partition obtains a first message input by a user, and sends the first message to the cross-partition module through the first cross-partition component; The cross-partition module generates a second message according to the first message, and sends the second message to the second partition through the second cross-partition component; Before the first partition obtains the first message input by the user, the method further includes: The cross-partition module receives a first transaction sent by the first partition through the first cross-partition component, and receives a second transaction sent by the second partition through the second cross-partition component, wherein the first transaction and the second transaction are used to request that the target physical node be registered as an anchor node; wherein the anchor node is a common node in the first partition and the second partition for transmitting messages; The cross-partition module determines, based on the first transaction and the second transaction, that both the first partition and the second partition initiate anchor node registration requests, generates a third transaction, and sends the third transaction to the second partition through the second cross-partition component, where the third transaction is used to indicate that the first partition has requested to register the target physical node as an anchor node; When the second partition successfully verifies the third transaction, the second partition sends verification success information to the cross-partition module through the second cross-partition component; The cross-partition module generates a fourth transaction according to the verification success information, and sends the fourth transaction to the first partition through the first cross-partition component, where the fourth transaction is used to indicate that the target physical node has been successfully registered as an anchor node.

2. The method according to claim 1, characterized in that After sending the fourth transaction to the first partition through the first cross-partition component, the method further includes: The first partition sends a reply message of the fourth transaction to the cross-partition module through the first cross-partition component, where the reply message of the fourth transaction is used to indicate that the fourth transaction is successfully executed; The cross-partition module sets the first partition to a registered state.

3. The method according to claim 1, characterized in that The method further comprises: Before the cross-partition module sends the second message to the second partition through the second cross-partition component, the cross-partition module stores the second message; After the second partition receives the second message, the second partition sends a reply message of the second message to the cross-partition module through the second cross-partition component, where the reply message of the second message is used to indicate that the second partition has successfully received the second message; The cross-partition module deletes the stored second message.

4. The method according to any one of claims 1 to 3, characterized in that The cross-partition module and the first cross-partition component and the second cross-partition component use a buffered channel to transmit messages.

5. A partition interaction method, characterized in that: The method is applied to a target physical node, where the target physical node is a common node in a first partition and a second partition in a blockchain system, and includes a cross-partition module, a first cross-partition component, and a second cross-partition component. The method includes: The cross-partition module receives the first message sent by the first partition through the first cross-partition component; The cross-partition module generates a second message according to the first message; The cross-partition module sends the second message to the second partition through the second cross-partition component; Before the cross-partition module receives the first message sent by the first partition through the first cross-partition component, the method further includes: The cross-partition module receives a first transaction sent by the first partition through the first cross-partition component, and receives a second transaction sent by the second partition through the second cross-partition component, wherein the first transaction and the second transaction are used to request that the target physical node be registered as an anchor node; wherein the anchor node is a common node in the first partition and the second partition for transmitting messages; The cross-partition module determines, based on the first transaction and the second transaction, that both the first partition and the second partition initiate anchor node registration requests, generates a third transaction, and sends the third transaction to the second partition through the second cross-partition component, where the third transaction is used to indicate that the first partition has requested to register the target physical node as an anchor node; The cross-partition module receives verification success information sent by the second partition through the second cross-partition component, where the verification success information is sent when the second partition successfully verifies the third transaction; The cross-partition module generates a fourth transaction according to the verification success information, and sends the fourth transaction to the first partition through the first cross-partition component, where the fourth transaction is used to indicate that the target physical node has been successfully registered as an anchor node.

6. A partition interaction device, characterized in that: The device is a common node in a first partition and a second partition in a blockchain system, and includes a cross-partition module, a first cross-partition component, and a second cross-partition component; The cross-partition module is configured to receive a first message sent by the first partition through the first cross-partition component, generate a second message according to the first message, and send the second message to the second partition through the second cross-partition component; It is characterized in that the cross-partition module is further used for: Receiving, through the first cross-partition component, a first transaction sent by the first partition, and receiving, through the second cross-partition component, a second transaction sent by the second partition, wherein the first transaction and the second transaction are used to request that a target physical node be registered as an anchor node; wherein the anchor node is a common node in the first partition and the second partition for transmitting messages; Determining, based on the first transaction and the second transaction, that both the first partition and the second partition initiate anchor node registration requests, generating a third transaction, and sending the third transaction to the second partition through the second cross-partition component, wherein the third transaction is used to indicate that the first partition has requested to register the target physical node as an anchor node; receiving, through the second cross-partition component, verification success information sent by the second partition, where the verification success information is sent when the second partition successfully verifies the third transaction; A fourth transaction is generated according to the verification success information, and the fourth transaction is sent to the first partition through the first cross-partition component, where the fourth transaction is used to indicate that the target physical node has been successfully registered as an anchor node.

7. A server, characterized in that: The server includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the partition interaction method according to any one of claims 1 to 5 is implemented.

8. A storage medium, characterized in that: The storage medium stores a computer program, which is loaded by a processor to execute the partition interaction method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Information transmitting method, device and system

    CN109150943A

  • Cross-chain data collaboration method based on alliance chain

    CN111159755A