Blockchain cross-chain service management method and device

By introducing relay chain client and cross-chain service management contracts into the blockchain, the problem that existing registration centers cannot be used for blockchain cross-chain service management is solved, and the discovery and registration of cross-chain services is realized, which has improved the Management efficiency.

CN115442420BActive Publication Date: 2025-01-07JINGDONG TECH HLDG CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110539297.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-18
Publication Date
2025-01-07
Estimated Expiration
2041-05-18

AI Technical Summary

Technical Problem

The existing registration center is not suitable for blockchain cross-chain service management scenarios in the microservice architecture, and cannot effectively realize the discovery and registration of cross-chain services.

Method used

By introducing a relay chain client into the blockchain, cross-chain services are distributed to the relay chain collection, relay chain identification and cross-chain service identification, unpublished relay chains and deploy cross-chain services, and use The cross-chain service management contract of the relay chain is used for service registration and management.

Benefits of technology

Cross-chain service discovery and weak centralized service registration in blockchain scenarios have been realized, and the efficiency and reliability of cross-chain service management have been improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115442420B_ABST
    Figure CN115442420B_ABST
Patent Text Reader

Abstract

The present application discloses a blockchain cross-chain service management method and device. A specific implementation of the method includes: in response to the existence of an application chain publishing a cross-chain service to a target relay chain, the cross-chain service is distributed to the relay chain clients of the relay chains other than the target relay chain in the relay chain set through the relay chain client of the target relay chain; for each relay chain client corresponding to the relay chain set, the relay chain identifier of the relay chain corresponding to the relay chain client is compared with the relay chain identifier in the cross-chain service to determine the relay chain for which the cross-chain service has not been published by the application chain; it is determined that there is no relay chain for the cross-chain service in the relay chain for which the cross-chain service has not been published by the application chain, and the cross-chain service is deployed in the relay chain for which the cross-chain service does not exist. The present application provides a cross-chain service management method in a blockchain scenario, which realizes cross-chain service discovery and service registration with the relay chain as a weakly centralized service registration center.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and specifically to a blockchain cross-chain service management method and device. Background Art

[0002] In the field of microservice architecture, a monolithic application is split into multiple microservices. Each microservice often needs to register with a centralized registry to notify the service caller. Commonly used registries include ZooKeeper (a distributed application coordination service), Consul (a service discovery and configuration management center service), and Etcd (a highly available key-value storage system). When selecting a registry, it is generally required that the registry itself be highly available and support event mechanisms. It is undeniable that a relatively rich ecosystem has been formed around these registries, and they are highly favored in microservice technology. However, they are not suitable for blockchain cross-chain service management scenarios. Summary of the invention

[0003] The embodiments of the present application provide a blockchain cross-chain service management method and device.

[0004] In a first aspect, an embodiment of the present application provides a blockchain cross-chain service management method, including: in response to an existing application chain publishing a cross-chain service to a target relay chain, distributing the cross-chain service to the relay chain clients of relay chains other than the target relay chain in a relay chain set through the relay chain client of the target relay chain; for each relay chain client corresponding to the relay chain set, comparing the relay chain identifier of the relay chain corresponding to the relay chain client with the relay chain identifier in the cross-chain service, and determining the relay chain for which the cross-chain service has not been published by the application chain; determining that there is no relay chain for the cross-chain service in the relay chain for which the cross-chain service has not been published by the application chain, and deploying the cross-chain service in the relay chain for which the cross-chain service does not exist.

[0005] In some embodiments, the above-mentioned determination that there is no relay chain for the cross-chain service in the relay chain where the cross-chain service has not been released by the application chain, and deploying the cross-chain service in the relay chain where the cross-chain service does not exist, includes: for each relay chain in the relay chain where the cross-chain service has not been released by the application chain, performing the following operations: determining whether there is a cross-chain service in the cross-chain service management contract corresponding to the relay chain according to the metadata of the cross-chain service; in response to determining that there is no cross-chain service in the relay chain, deploying the cross-chain service in the relay chain.

[0006] In some embodiments, in response to determining that the cross-chain service does not exist in the relay chain, deploying the cross-chain service in the relay chain includes: in response to determining that the cross-chain service does not exist in the relay chain, determining the event type of the cross-chain service; and deploying the cross-chain service in the relay chain according to an interface corresponding to the event type provided by the cross-chain service management contract of the relay chain.

[0007] In some embodiments, the above-mentioned determining whether there is a cross-chain service in the cross-chain service management contract corresponding to the relay chain based on the metadata of the cross-chain service includes: determining the offset of the cross-chain service, wherein the offset is used to characterize the block height or event sequence number corresponding to the cross-chain service; determining the maximum offset of the existing cross-chain services in the relay chain; in response to determining that the offset of the cross-chain service is greater than the maximum offset, determining whether there is a cross-chain service in the cross-chain service management contract corresponding to the relay chain based on the metadata of the cross-chain service.

[0008] In some embodiments, the above method also includes: updating the maximum offset of the existing cross-chain service in the relay chain to the offset of the cross-chain service.

[0009] In some embodiments, the above method also includes: in response to determining that there is a newly added relay chain in the relay link set, determining the existing cross-chain services in the relay chains in the relay chain set except the newly added relay chain; and registering the existing cross-chain services corresponding to the relay chain set to the newly added relay chain.

[0010] In some embodiments, the above-mentioned determination of existing cross-chain services in the relay chains in the relay chain set includes: for each relay chain in the relay chain set, determining the metadata of the existing cross-chain service in the relay chain; and determining the existing cross-chain service in the relay chain with the most metadata as the existing cross-chain service corresponding to the relay chain set.

[0011] In some embodiments, the above-mentioned distribution of the cross-chain service to the relay chain client of the relay chain other than the target relay chain in the relay chain set includes: distributing the cross-chain service and the interface document representing the interface information of the cross-chain service to the relay chain client of the relay chain other than the target relay chain in the relay chain set.

[0012] In the second aspect, an embodiment of the present application provides a blockchain cross-chain service management device, including: a distribution unit, configured to publish the cross-chain service to the target relay chain in response to the existence of an application chain, and distribute the cross-chain service to the relay chain clients of the relay chains other than the target relay chain in the relay chain set through the relay chain client of the target relay chain; a determination unit, configured to compare the relay chain identifier of the relay chain corresponding to each relay chain client corresponding to the relay chain set with the relay chain identifier in the cross-chain service, and determine the relay chain for which the cross-chain service has not been published by the application chain; a deployment unit, configured to determine that there is no relay chain for the cross-chain service in the relay chain for which the cross-chain service has not been published by the application chain, and deploy the cross-chain service in the relay chain for which the cross-chain service does not exist.

[0013] In some embodiments, the deployment unit is further configured to: for each relay chain in the relay chain where the cross-chain service has not been released by the application chain, perform the following operations: determine whether there is a cross-chain service in the cross-chain service management contract corresponding to the relay chain based on the metadata of the cross-chain service; in response to determining that there is no cross-chain service in the relay chain, deploy the cross-chain service in the relay chain.

[0014] In some embodiments, the deployment unit is further configured to: in response to determining that there is no cross-chain service in the relay chain, determine the event type of the cross-chain service; and deploy the cross-chain service in the relay chain according to the interface corresponding to the event type provided by the cross-chain service management contract of the relay chain.

[0015] In some embodiments, the deployment unit is further configured to: determine an offset of a cross-chain service, wherein the offset is used to characterize a block height or event sequence number corresponding to the cross-chain service; determine a maximum offset of existing cross-chain services in the relay chain; in response to determining that the offset of the cross-chain service is greater than the maximum offset, determine whether a cross-chain service exists in a cross-chain service management contract corresponding to the relay chain based on the metadata of the cross-chain service.

[0016] In some embodiments, the above-mentioned device also includes: an updating unit, configured to update the maximum offset of the existing cross-chain service in the relay chain to the offset of the cross-chain service.

[0017] In some embodiments, the above-mentioned device also includes: a registration unit, which is configured to determine the existing cross-chain services in the relay chains other than the newly added relay chain in the relay chain set in response to determining that there is a newly added relay chain in the relay link set; and register the existing cross-chain services corresponding to the relay chain set to the newly added relay chain.

[0018] In some embodiments, the registration unit is further configured to: for each relay chain in the relay chain set, determine the metadata of the existing cross-chain service in the relay chain; and determine the existing cross-chain service in the relay chain with the most metadata as the existing cross-chain service corresponding to the relay chain set.

[0019] In some embodiments, the distribution unit is further configured to: distribute the cross-chain service and the interface document representing the interface information of the cross-chain service to the relay chain clients of the relay chains other than the target relay chain in the relay chain set.

[0020] In a third aspect, an embodiment of the present application provides a computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the method described in any implementation manner of the first aspect is implemented.

[0021] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by one or more processors, the one or more processors implement the method described in any implementation manner of the first aspect.

[0022] The blockchain cross-chain service management method and device provided in the embodiment of the present application publishes the cross-chain service to the target relay chain in response to the existence of the application chain, and distributes the cross-chain service to the relay chain clients of the relay chains other than the target relay chain in the relay chain set through the relay chain client of the target relay chain; for each relay chain client corresponding to the relay chain set, compare the relay chain identifier of the relay chain corresponding to the relay chain client with the relay chain identifier in the cross-chain service to determine the relay chain for which the cross-chain service has not been published by the application chain; determine that there is no relay chain for the cross-chain service in the relay chain for which the cross-chain service has not been published by the application chain, and deploy the cross-chain service in the relay chain for which the cross-chain service does not exist, thereby providing a cross-chain service management method in a blockchain scenario, realizing cross-chain service discovery and service registration with the relay chain as a weakly centralized service registration center. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:

[0024] Figure 1 is an exemplary system architecture diagram in which an embodiment of the present application may be applied;

[0025] Figure 2 It is a flowchart of an embodiment of the blockchain cross-chain service management method according to the present application;

[0026] Figure 3It is a schematic diagram of an application scenario of the blockchain cross-chain service management method according to this embodiment;

[0027] Figure 4 It is a flowchart of another embodiment of the blockchain cross-chain service management method according to the present application;

[0028] Figure 5 It is a structural diagram of an embodiment of a blockchain cross-chain service management device according to the present application;

[0029] Figure 6 It is a structural diagram of a computer system suitable for implementing the embodiments of the present application. DETAILED DESCRIPTION

[0030] The present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It should also be noted that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings.

[0031] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0032] Figure 1 An exemplary architecture 100 to which the blockchain cross-chain service management method and device of the present application can be applied is shown.

[0033] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The communication connection between the terminal devices 101, 102, 103 constitutes a topological network, and the network 104 is used to provide a medium for the communication link between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0034] Terminal devices 101, 102, 103 may be hardware devices or software that support network connection for data interaction and data processing. When terminal devices 101, 102, 103 are hardware, they may be various electronic devices that support network connection, information acquisition, interaction, display, processing and other functions, including but not limited to smart phones, tablet computers, e-book readers, laptop computers and desktop computers, etc. When terminal devices 101, 102, 103 are software, they may be installed in the electronic devices listed above. They may be implemented as multiple software or software modules for providing distributed services, or they may be implemented as a single software or software module. No specific limitation is made here.

[0035] Server 105 can be a server that provides various services, such as obtaining request information representing cross-chain services sent by users through terminal devices 101, 102, and 103, and executing background processing servers for request information. The background processing server can actively discover the cross-chain services of the application chain, and register the cross-chain services of the application chain using the relay chain as a weakly centralized cross-chain service registration center. As an example, server 105 can be a cloud server.

[0036] It should be noted that the server can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules (for example, software or software modules used to provide distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.

[0037] It should also be noted that the blockchain cross-chain service management method provided in the embodiment of the present application can be executed by a server, or by a terminal device, or by a server and a terminal device in cooperation with each other. Accordingly, the various parts (such as various units) included in the blockchain cross-chain service management device can be all set in the server, or all set in the terminal device, or can be set in the server and the terminal device respectively.

[0038] It should be understood that Figure 1 The number of terminal devices, networks, and servers in the example is merely illustrative. Depending on the implementation requirements, there may be any number of terminal devices, networks, and servers. When the electronic device on which the blockchain cross-chain service management method is running does not need to transmit data with other electronic devices, the system architecture may only include the electronic device (e.g., server or terminal device) on which the blockchain cross-chain service management method is running.

[0039] Continue to refer Figure 2 , shows a process 200 of an embodiment of a blockchain cross-chain service management method, including the following steps:

[0040] Step 201, in response to the existence of an application chain publishing a cross-chain service to a target relay chain, the cross-chain service is distributed to the relay chain clients of the relay chains other than the target relay chain in the relay chain set through the relay chain client of the target relay chain.

[0041] In this embodiment, the execution subject of the blockchain cross-chain service management method (for example Figure 1 The server in the relay chain can publish the cross-chain service to the target relay chain in response to the existence of the application chain, and distribute the cross-chain service to the relay chain clients of the relay chains other than the target relay chain in the relay chain set through the relay chain client of the target relay chain.

[0042] The application chain is an independent blockchain. Applications for various businesses are deployed on the application chain. Different application chains exchange information and conduct transactions through the relay chain. The relay chain also uses the blockchain structure. The cross-chain between application chains, also known as inter-chain interoperation, usually refers to the interaction of business data between two application chains. The basic form of cross-chain interoperability is the mutual access of smart contracts on two application chains.

[0043] This embodiment is mainly applicable to multi-relay chain scenarios, that is, multiple relay chains in a relay chain set constitute a relay chain network. In a multi-relay chain scenario, the cross-chain client held by the application chain to publish the cross-chain service is registered on a relay chain in the relay chain set, so that the cross-chain service can be published to the relay chain through the cross-chain client. When a relay chain is published a cross-chain service by an application chain, the relay chain can be regarded as the target relay chain of the application chain that publishes the cross-chain service.

[0044] The cross-chain service management contract on the target relay chain publishes cross-chain service events, and the relay chain client of the target relay chain subscribes to the cross-chain service events; after the relay chain client of the target relay chain obtains the subscribed cross-chain service events based on the event mechanism, it distributes the cross-chain service to the relay chain clients of the relay chains other than the target relay chain in the relay chain set.

[0045] The cross-chain service management contract of the relay chain can provide functions such as cross-chain service registration, query, upgrade, offline, event offset acquisition / setting, etc. The offset is used to represent the block height or event sequence number corresponding to the cross-chain service.

[0046] In some optional implementations of this embodiment, the above-mentioned execution entity can perform the above-mentioned step 201 in the following manner: distribute the cross-chain service and the interface document representing the interface information of the cross-chain service to the relay chain clients of the relay chains other than the target relay chain in the relay chain set.

[0047] In this implementation, when cross-chain is carried out, cross-chain stakeholders not only need to discover cross-chain services, but also need to obtain the API (Application Programming Interface) interface document of the cross-chain service. The interface document determines the API included in the cross-chain service, including the input parameter type, the meaning of the input parameter type, the return type and the meaning of the return type of each API. The cross-chain service interface document is published as part of the cross-chain service content.

[0048] When registering and updating cross-chain services, the cross-chain service management contract of the relay chain can check the interface document, and only register and update the cross-chain service when it is determined that the corresponding interface document is included in the cross-chain service. The format of the cross-chain service interface document can be a human-readable information format. For example, JSON (JavaScript Object Notation) and YAML (a highly readable format used to express data serialization).

[0049] Step 202: For each relay chain client corresponding to the relay chain set, compare the relay chain identifier of the relay chain corresponding to the relay chain client with the relay chain identifier in the cross-chain service to determine the relay chain for which the cross-chain service has not been published by the application chain.

[0050] In this embodiment, for each relay chain client corresponding to the relay chain set, the above-mentioned execution entity can compare the relay chain identifier of the relay chain corresponding to the relay chain client with the relay chain identifier in the cross-chain service to determine the relay chain for which the cross-chain service has not been published by the application chain.

[0051] The relay chain client corresponding to the relay chain set refers to the relay chain client of each relay chain in the relay chain set.

[0052] In this embodiment, each relay chain is provided with a relay chain identifier. The relay chain identifier can be any identifier that can uniquely identify the relay chain, including but not limited to characters, images, etc. Each relay chain client can query the relay chain identifier from the cross-chain service management contract on the bound relay chain. After querying the relay chain identifier for the first time, the query result can be maintained in the memory, so that the relay chain identifier can be obtained in the memory when the relay chain identifier is determined later, reducing resource consumption.

[0053] After the cross-chain service is released on the target relay chain, the relay chain identifier of the target relay chain will be set. By comparing the relay chain identifier of the relay chain corresponding to each relay chain client with the relay chain identifier in the cross-chain service, the cross-chain service can be prevented from being chained on the target relay chain again.

[0054] Specifically, for the relay chain client of each relay chain in the relay chain set, in response to determining that the relay chain identifier of the relay chain corresponding to the relay chain client is different from the relay chain identifier in the cross-chain service, the relay chain corresponding to the relay chain client is determined as a relay chain for which the cross-chain service has not been published by the application chain.

[0055] Step 203: Determine that in the relay chain where the cross-chain service has not been released by the application chain, there is no relay chain for the cross-chain service, and deploy the cross-chain service in the relay chain where the cross-chain service does not exist.

[0056] In this embodiment, the above-mentioned execution entity can determine that in the relay chain where the cross-chain service has not been released by the application chain, there is no relay chain for the cross-chain service, and deploy the cross-chain service in the relay chain where the cross-chain service does not exist.

[0057] As an example, for each relay chain that has not had its cross-chain services published by the application chain, the relay chain client of the relay chain can query from the cross-chain service management contract of the relay chain whether there is a cross-chain service published by the application chain on the target relay chain to determine the relay chain where the cross-chain service does not exist, and deploy the cross-chain service in the relay chain where the cross-chain service does not exist.

[0058] In some optional implementations of this embodiment, the execution subject may perform step 203 in the following manner:

[0059] For each relay chain in the relay chain that has not been published by the application chain for cross-chain services, perform the following operations:

[0060] First, based on the metadata of the cross-chain service, determine whether there is a cross-chain service in the cross-chain service management contract corresponding to the relay chain.

[0061] In this implementation, the execution subject can use the name and version number of the cross-chain service as metadata to establish a correspondence between the metadata and the cross-chain service. Thus, the execution subject can determine whether there is a cross-chain service in the cross-chain service management contract corresponding to the relay chain based on the metadata of the cross-chain service.

[0062] Second, in response to determining that the cross-chain service does not exist in the relay chain, the cross-chain service is deployed in the relay chain.

[0063] In this implementation, when the cross-chain service management contract of the relay chain does not include the metadata of the published cross-chain service, it is determined that the cross-chain service does not exist in the relay chain, and the cross-chain service is deployed in the relay chain.

[0064] In some optional implementations of this embodiment, the execution subject may perform the first step in the following manner:

[0065] First, determine the offset of the cross-chain service.

[0066] Among them, the offset is used to represent the block height or event sequence number corresponding to the cross-chain service.

[0067] In this implementation, the cross-chain service management contract of the relay chain needs to expose the offset acquisition interface and setting interface of the cross-chain service event. For example, in the JD Chain blockchain, the offset is the cross-chain service event sequence number. The offset of the cross-chain service is the offset of the cross-chain service in the target relay chain.

[0068] Secondly, determine the maximum offset of the existing cross-chain service in the relay chain.

[0069] In this embodiment, the existing cross-chain service represents the cross-chain service deployed in the relay chain, and the maximum offset represents the offset of the cross-chain service most recently deployed in the relay chain up to the present.

[0070] Finally, in response to determining that the offset of the cross-chain service is greater than the maximum offset, it is determined whether the cross-chain service exists in the cross-chain service management contract corresponding to the relay chain according to the metadata of the cross-chain service.

[0071] In this implementation, in response to determining that the offset of the cross-chain service is not greater than the maximum offset, it indicates that the cross-chain service published by the application chain has been deployed in the relay chain, and the relay chain ignores the above cross-chain service.

[0072] In some optional implementations of this embodiment, the above-mentioned execution entity may also update the maximum offset of the existing cross-chain service in the relay chain to the offset of the cross-chain service to continuously update the maximum offset in the relay chain.

[0073] The current maximum offset can be updated in the following ways: 1. Call the setting interface of the cross-chain service management contract to write the offset of the latest deployed cross-chain service event to the relay chain. The effect of this is that the maximum offset can be updated in real time. 2. Maintain the update of the maximum offset in the memory of the relay chain client until the maximum offset is written to the relay chain when the cross-chain service is stopped. It is worth noting that the maximum offset can be persisted in the database of the cross-chain management end that manages each relay chain client, and is not limited to the relay chain node.

[0074] In some optional implementations of this embodiment, the execution subject may perform the second step in the following manner:

[0075] First, in response to determining that there is no cross-chain service in the relay chain, an event type of the cross-chain service is determined.

[0076] In this implementation, event types include, but are not limited to, registering a cross-chain service, updating a cross-chain service, and deactivating a cross-chain service.

[0077] Then, according to the interface corresponding to the event type provided by the cross-chain service management contract of the relay chain, the cross-chain service is deployed in the relay chain.

[0078] The interfaces provided by the cross-chain service management contract include but are not limited to the cross-chain service registration interface, the cross-chain service update interface, and the cross-chain service offline interface.

[0079] Continue to see Figure 3 , Figure 3300 is a schematic diagram of an application scenario of the blockchain cross-chain service management method according to this embodiment. Figure 3 In the application scenario, the application chain 301 publishes a cross-chain service 302 in the target relay chain 303. The relay chain set including the target relay chain 303 also includes relay chains 304, 305 and 306. In response to determining that the application chain 301 publishes the cross-chain service 302 to the target relay chain 303, the cross-chain service is distributed to the relay chain clients 308, 309 and 310 of the relay chains other than the target relay chain in the relay chain set through the relay chain client 307 of the target relay chain 303; for each relay chain client corresponding to the relay chain set, the relay chain identifier of the relay chain corresponding to the relay chain client is compared with the relay chain identifier in the cross-chain service to determine the relay chain for which the cross-chain service has not been published by the application chain; it is determined that there is no relay chain for the cross-chain service in the relay chain for which the cross-chain service has not been published by the application chain, and the cross-chain service is deployed in the relay chain for which the cross-chain service does not exist.

[0080] The method provided by the above-mentioned embodiment of the present application publishes the cross-chain service to the target relay chain in response to the existence of the application chain, and distributes the cross-chain service to the relay chain clients of the relay chains other than the target relay chain in the relay chain set through the relay chain client of the target relay chain; for each relay chain client corresponding to the relay chain set, compare the relay chain identifier of the relay chain corresponding to the relay chain client with the relay chain identifier in the cross-chain service to determine the relay chain for which the cross-chain service has not been published by the application chain; determine that there is no relay chain for the cross-chain service in the relay chain for which the cross-chain service has not been published by the application chain, and deploy the cross-chain service in the relay chain for which the cross-chain service does not exist, thereby providing a cross-chain service management method in a blockchain scenario, realizing cross-chain service discovery and service registration with the relay chain as a weakly centralized service registration center.

[0081] In some optional implementations of this embodiment, the above-mentioned execution subject can also be applied to the case of creating a new relay chain, and for the newly created relay chain, the existing cross-chain service is actively pulled from the relay chain in the relay chain set for registration. Specifically:

[0082] First, in response to determining that a newly added relay chain exists in the relay link set, an existing cross-chain service in the relay chain other than the newly added relay chain in the relay chain set is determined.

[0083] As an example, the above-mentioned execution entity can determine the existing cross-chain services in each relay chain in the relay chain set, and obtain the existing cross-chain services corresponding to the relay chain set after deduplication.

[0084] Second, register the existing cross-chain services corresponding to the relay chain set to the newly added relay chain.

[0085] In some optional implementations of this embodiment, the execution subject may perform the first step in the following manner:

[0086] First, for each relay chain in the relay chain set, the metadata of the existing cross-chain services in the relay chain is determined.

[0087] Then, the existing cross-chain service in the relay chain with the most metadata is determined as the existing cross-chain service corresponding to the relay chain set.

[0088] As an example, for each relay chain in the relay chain set, a query request is initiated to the cross-chain service management contract of the relay chain through the relay chain client corresponding to the relay chain to obtain the metadata of the cross-chain service deployed in the relay chain; the relay chains are sorted in reverse order according to the number of metadata corresponding to each relay chain, and the cross-chain service corresponding to the metadata corresponding to the relay chain ranked first is determined as the cross-chain service in the existing relay chain.

[0089] Continue to refer Figure 4 , shows a schematic process 400 of an embodiment of a blockchain cross-chain service management method according to the present application, comprising the following steps:

[0090] Step 401, in response to the existence of an application chain publishing a cross-chain service to a target relay chain, the cross-chain service is distributed to the relay chain clients of the relay chains other than the target relay chain in the relay chain set through the relay chain client of the target relay chain.

[0091] Step 402: For each relay chain client corresponding to the relay chain set, compare the relay chain identifier of the relay chain corresponding to the relay chain client with the relay chain identifier in the cross-chain service to determine the relay chain for which the cross-chain service has not been published by the application chain.

[0092] Step 403: For each relay chain in the relay chain that has not been issued a cross-chain service by the application chain, perform the following operations:

[0093] Step 4031, determine the offset of the cross-chain service.

[0094] Among them, the offset is used to represent the block height or event sequence number corresponding to the cross-chain service.

[0095] Step 4032, determine the maximum offset of the existing cross-chain service in the relay chain.

[0096] Step 4033, in response to determining that the offset of the cross-chain service is greater than the maximum offset, determine whether the cross-chain service exists in the cross-chain service management contract corresponding to the relay chain according to the metadata of the cross-chain service.

[0097] Step 4034, in response to determining that there is no cross-chain service in the relay chain, determine the event type of the cross-chain service.

[0098] Step 4035: Deploy the cross-chain service in the relay chain according to the interface corresponding to the event type provided by the cross-chain service management contract of the relay chain.

[0099] It can be seen from this embodiment that Figure 2 Compared with the corresponding embodiments, process 400 of the blockchain cross-chain service management method in this embodiment specifically illustrates the process of determining the relay chain where no cross-chain service exists, as well as the deployment process of the cross-chain service, thereby improving the accuracy of the cross-chain service discovery process.

[0100] Continue to refer Figure 5 As an implementation of the methods shown in the above figures, the present application provides an embodiment of a blockchain cross-chain service management device, which is similar to Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0101] like Figure 5 As shown, the blockchain cross-chain service management device includes: a distribution unit 501, configured to publish the cross-chain service to the target relay chain in response to the existence of the application chain, and distribute the cross-chain service to the relay chain clients of the relay chains other than the target relay chain in the relay chain set through the relay chain client of the target relay chain; a determination unit 502, configured to compare the relay chain identifier of the relay chain corresponding to each relay chain client corresponding to the relay chain set with the relay chain identifier in the cross-chain service, and determine the relay chain for which the cross-chain service has not been published by the application chain; a deployment unit 503, configured to determine that there is no relay chain for the cross-chain service in the relay chain for which the cross-chain service has not been published by the application chain, and deploy the cross-chain service in the relay chain for which the cross-chain service does not exist.

[0102] In some embodiments, the deployment unit 503 is further configured to: for each relay chain in the relay chain where the cross-chain service has not been released by the application chain, perform the following operations: determine whether there is a cross-chain service in the cross-chain service management contract corresponding to the relay chain based on the metadata of the cross-chain service; in response to determining that there is no cross-chain service in the relay chain, deploy the cross-chain service in the relay chain.

[0103] In some embodiments, the deployment unit 503 is further configured to: in response to determining that there is no cross-chain service in the relay chain, determine the event type of the cross-chain service; and deploy the cross-chain service in the relay chain according to the interface corresponding to the event type provided by the cross-chain service management contract of the relay chain.

[0104] In some embodiments, the deployment unit 503 is further configured to: determine an offset of a cross-chain service, wherein the offset is used to characterize a block height or event sequence number corresponding to the cross-chain service; determine a maximum offset of existing cross-chain services in the relay chain; in response to determining that the offset of the cross-chain service is greater than the maximum offset, determine whether a cross-chain service exists in the cross-chain service management contract corresponding to the relay chain based on the metadata of the cross-chain service.

[0105] In some embodiments, the above-mentioned device also includes: an updating unit (not shown in the figure), which is configured to update the maximum offset of the existing cross-chain service in the relay chain to the offset of the cross-chain service.

[0106] In some embodiments, the above-mentioned device also includes: a registration unit (not shown in the figure), which is configured to determine the existing cross-chain services in the relay chains other than the newly added relay chain in the relay chain set in response to determining that there is a newly added relay chain in the relay link set; and register the existing cross-chain services corresponding to the relay chain set to the newly added relay chain.

[0107] In some embodiments, the registration unit (not shown in the figure) is further configured to: for each relay chain in the relay chain set, determine the metadata of the existing cross-chain service in the relay chain; and determine the existing cross-chain service in the relay chain with the most metadata as the existing cross-chain service corresponding to the relay chain set.

[0108] In some embodiments, the distribution unit 501 is further configured to: distribute the cross-chain service and the interface document representing the interface information of the cross-chain service to the relay chain clients of the relay chains other than the target relay chain in the relay chain set.

[0109] In this embodiment, the distribution unit in the blockchain cross-chain service management device publishes the cross-chain service to the target relay chain in response to the existence of the application chain, and distributes the cross-chain service to the relay chain clients of the relay chains other than the target relay chain in the relay chain set through the relay chain client of the target relay chain; the determination unit compares the relay chain identifier of the relay chain corresponding to each relay chain client in the relay chain set with the relay chain identifier in the cross-chain service, and determines the relay chain for which the cross-chain service has not been published by the application chain; the deployment unit determines that there is no relay chain for the cross-chain service in the relay chain for which the cross-chain service has not been published by the application chain, and deploys the cross-chain service in the relay chain for which the cross-chain service does not exist, thereby providing a cross-chain service management device in a blockchain scenario, realizing cross-chain service discovery and service registration with the relay chain as a weakly centralized service registration center.

[0110] Reference below Figure 6 , which shows a device suitable for implementing the embodiments of the present application (eg Figure 1Schematic diagram of the structure of a computer system 600 of the devices 101, 102, 103, 105 shown. Figure 6 The device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0111] like Figure 6 As shown, the computer system 600 includes a processor (e.g., CPU, central processing unit) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. Various programs and data required for the operation of the system 600 are also stored in the RAM 603. The processor 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0112] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.

[0113] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part 609, and / or installed from a removable medium 611. When the computer program is executed by the processor 601, the above-mentioned functions defined in the method of the present application are executed.

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

[0115] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the client computer, partially on the client computer, as a separate software package, partially on the client computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the client computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0116] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the device, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0117] The units involved in the embodiments described in the present application may be implemented by software or by hardware. The described units may also be set in a processor, for example, may be described as: a processor comprising a distribution unit, a determination unit, and a deployment unit. Among them, the names of these units do not constitute a limitation on the unit itself under certain circumstances. For example, the deployment unit may also be described as "a unit that determines that a relay chain in which a cross-chain service has not been published by an application chain does not exist in a relay chain for a cross-chain service, and deploys the cross-chain service in a relay chain in which a cross-chain service does not exist".

[0118] As another aspect, the present application also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by the device, the computer device: in response to the existence of an application chain publishing a cross-chain service to the target relay chain, distribute the cross-chain service to the relay chain clients of the relay chains other than the target relay chain in the relay chain set through the relay chain client of the target relay chain; for each relay chain client corresponding to the relay chain set, compare the relay chain identifier of the relay chain corresponding to the relay chain client with the relay chain identifier in the cross-chain service, and determine the relay chain that has not been published by the application chain for the cross-chain service; determine that there is no relay chain for the cross-chain service in the relay chain that has not been published by the application chain, and deploy the cross-chain service in the relay chain that does not exist.

[0119] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above invention concept. For example, the above features are replaced with the technical features with similar functions disclosed in this application (but not limited to) by each other to form a technical solution.

Claims

1. A blockchain cross-chain service management method, comprising: In response to the existence of an application chain publishing a cross-chain service to a target relay chain, the relay chain client of the target relay chain obtains the subscribed cross-chain service event based on an event mechanism, and distributes the cross-chain service and an interface document representing the interface information of the cross-chain service to the relay chain clients of the relay chains other than the target relay chain in the relay chain set; For each relay chain client corresponding to the relay chain set, compare the relay chain identifier of the relay chain corresponding to the relay chain client with the relay chain identifier in the cross-chain service to determine the relay chain for which the cross-chain service has not been published by the application chain; Determine that in the relay chain where the cross-chain service is not published by the application chain, there is no relay chain for the cross-chain service, and deploy the cross-chain service in the relay chain where the cross-chain service does not exist.

2. The method according to claim 1, wherein: The determining that the relay chain of the cross-chain service does not exist in the relay chain where the cross-chain service is not published by the application chain, and deploying the cross-chain service in the relay chain where the cross-chain service does not exist, includes: For each relay chain in the relay chain that has not published the cross-chain service by the application chain, perform the following operations: According to the metadata of the cross-chain service, determine whether the cross-chain service exists in the cross-chain service management contract corresponding to the relay chain; In response to determining that the cross-chain service does not exist in the relay chain, deploying the cross-chain service in the relay chain.

3. The method according to claim 2, wherein: In response to determining that the cross-chain service does not exist in the relay chain, deploying the cross-chain service in the relay chain includes: In response to determining that the cross-chain service does not exist in the relay chain, determining an event type of the cross-chain service; According to the interface corresponding to the event type provided by the cross-chain service management contract of the relay chain, the cross-chain service is deployed in the relay chain.

4. The method according to claim 2, wherein: The step of determining, according to the metadata of the cross-chain service, whether the cross-chain service exists in the cross-chain service management contract corresponding to the relay chain includes: Determine an offset of the cross-chain service, wherein the offset is used to represent a block height or an event sequence number corresponding to the cross-chain service; Determine the maximum offset of the existing cross-chain service in the relay chain; In response to determining that the offset of the cross-chain service is greater than the maximum offset, determining whether the cross-chain service exists in the cross-chain service management contract corresponding to the relay chain according to the metadata of the cross-chain service.

5. The method according to claim 4, wherein: Also includes: Update the maximum offset of the existing cross-chain service in the relay chain to the offset of the cross-chain service.

6. The method according to claim 1, wherein: Also includes: In response to determining that a newly added relay chain exists in the relay link set, determining an existing cross-chain service in a relay chain other than the newly added relay chain in the relay chain set; Register the existing cross-chain service corresponding to the relay chain set to the newly added relay chain.

7. The method according to claim 6, wherein: The determining an existing cross-chain service in a relay chain in the relay chain set includes: For each relay chain in the set of relay chains, determining metadata of existing cross-chain services in the relay chain; The existing cross-chain service in the relay chain with the most metadata is determined as the existing cross-chain service corresponding to the relay chain set.

8. A blockchain cross-chain service management device, comprising: A distribution unit is configured to publish a cross-chain service to a target relay chain in response to the existence of an application chain, obtain a subscribed cross-chain service event through a relay chain client of the target relay chain based on an event mechanism, and distribute the cross-chain service and an interface document representing interface information of the cross-chain service to relay chain clients of relay chains other than the target relay chain in the relay chain set; A determination unit is configured to compare, for each relay chain client corresponding to the relay chain set, the relay chain identifier of the relay chain corresponding to the relay chain client with the relay chain identifier in the cross-chain service, and determine the relay chain for which the cross-chain service has not been published by the application chain; The deployment unit is configured to determine that the relay chain of the cross-chain service does not exist in the relay chain where the cross-chain service is not published by the application chain, and deploy the cross-chain service in the relay chain where the cross-chain service does not exist.

9. The device according to claim 8, wherein: The deployment unit is further configured to: For each relay chain in the relay chain that has not published the cross-chain service by the application chain, perform the following operations: According to the metadata of the cross-chain service, determine whether the cross-chain service exists in the cross-chain service management contract corresponding to the relay chain; in response to determining that the cross-chain service does not exist in the relay chain, deploy the cross-chain service in the relay chain.

10. The device according to claim 9, wherein: The deployment unit is further configured to: In response to determining that the cross-chain service does not exist in the relay chain, determine the event type of the cross-chain service; and deploy the cross-chain service in the relay chain according to an interface corresponding to the event type provided by the cross-chain service management contract of the relay chain.

11. The device according to claim 9, wherein: The deployment unit is further configured to: Determine an offset of the cross-chain service, wherein the offset is used to characterize a block height or an event sequence number corresponding to the cross-chain service; determine a maximum offset of an existing cross-chain service in the relay chain; in response to determining that the offset of the cross-chain service is greater than the maximum offset, determine whether the cross-chain service exists in a cross-chain service management contract corresponding to the relay chain according to the metadata of the cross-chain service.

12. The device according to claim 11, wherein Also includes: An updating unit is configured to update the maximum offset of an existing cross-chain service in the relay chain to the offset of the cross-chain service.

13. The device according to claim 8, wherein: Also includes: A registration unit is configured to, in response to determining that a newly added relay chain exists in the relay chain set, determine the existing cross-chain services in the relay chains in the relay chain set except the newly added relay chain; and register the existing cross-chain services corresponding to the relay chain set to the newly added relay chain.

14. The device according to claim 13, wherein: The registration unit is further configured to: For each relay chain in the relay chain set, determine the metadata of the existing cross-chain service in the relay chain; and determine the existing cross-chain service in the relay chain with the most metadata as the existing cross-chain service corresponding to the relay chain set.

15. A computer readable medium having a computer program stored thereon, wherein: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

16. An electronic device comprising: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Heterogeneous license chain value exchange method with existence proof

    CN112581128A

  • Transaction processing method, relay network, cross-chain gateway, system, medium and equipment

    CN112714158A