Relay chain extension method and device for cross-chain interoperation, medium and program product
By monitoring cross-chain transaction data and calculating fission index, the new relay chain is dynamically expanded, and the delay and blocking problems of cross-chain systems when facing a large number of transaction requests is solved, and more efficient cross-chain transaction processing is achieved.
Patent Information
- Application Number
- CN202510443712.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-10
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2045-04-10
AI Technical Summary
When existing cross-chain systems face a large number of transaction requests, they may lead to increased transaction delays, transmission blockage, and even some transaction requests cannot be issued within the specified time.
By receiving monitoring requests from the relay domain, the cross-chain transaction data of the cross-chain gateway corresponding to the blockchain is monitored, and the fission index is calculated. When the fission index is greater than or equal to the preset expansion threshold, the new relay chain is expanded to undertake the transmission of some cross-chain transactions.
Dynamically expand the relay chain, disperse the cross-chain transaction load, reduce the transmission pressure of the original relay chain, improve cross-chain transaction efficiency, and avoid transaction delays and transmission blockage.
Smart Images

Figure CN119996493A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of blockchain technology, and in particular to a relay chain expansion method, device, medium and program product for cross-chain interoperability. Background Art
[0002] With the development of finance, medical and other industries, a heterogeneous blockchain ecosystem has been formed. The blockchain ecosystem can include multiple blockchains. Although each blockchain is independent, the demand for collaboration between blockchains is increasing, thus realizing cross-chain business.
[0003] In the related technology, the initiator of a blockchain needs to send a transaction request to the corresponding cross-chain gateway, which will send the transaction request to the designated relay chain, and then the relay chain will serve as a transfer station for the transaction request and send the transaction request to the destination blockchain, so that the destination blockchain executes the transaction content in the transaction request. However, in the existing cross-chain system, when a large number of transaction requests suddenly increase, the cross-chain system may not be able to process each transaction request, resulting in transaction congestion and increased transaction delay; some transaction requests may even fail to be sent within the specified time, causing the transaction request to be suspended. Summary of the invention
[0004] The present application provides a cross-chain interoperable relay chain extension method, device, medium and program product to at least solve the problem of increased transaction delay in related technologies.
[0005] In the first aspect, the present application provides a cross-chain interoperable relay chain extension method, including:
[0006] Receive a monitoring request corresponding to any relay domain, and monitor the cross-chain transaction data of the blockchain corresponding to at least one cross-chain gateway in the relay domain based on the monitoring request; the monitoring request is initiated by any cross-chain gateway in the relay domain when it detects that its first average cross-chain load index is greater than or equal to the monitoring threshold; the cross-chain transaction initiated when the first average cross-chain load index is greater than or equal to the monitoring threshold may cause transmission congestion;
[0007] Calculate a second average cross-chain load index of at least one blockchain group based on the cross-chain transaction data corresponding to each blockchain; the blockchain group includes any two blockchains generating transactions in the relay domain;
[0008] Calculating a fission index based on a second average cross-chain load index;
[0009] In response to the fission index being greater than or equal to a preset extension threshold, determining an initial node of a newly extended relay chain in the relay domain;
[0010] Control the initial node startup to expand the new relay chain in the relay domain; the new relay chain is used to undertake the transmission of some cross-chain transactions.
[0011] In a second aspect, the present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any of the above-mentioned cross-chain interoperability relay chain extension methods when executing the computer program.
[0012] In a third aspect, the present application also provides a computer-readable storage medium, in which a computer program is stored, wherein when the computer program is executed by a processor, the steps of any of the above-mentioned cross-chain interoperability relay chain extension methods are implemented.
[0013] In a fourth aspect, the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of any of the above-mentioned cross-chain interoperability relay chain extension methods.
[0014] Through a cross-chain interoperable relay chain extension method, device, medium and program product provided by the present application, a monitoring request corresponding to any relay domain is received, thereby monitoring the cross-chain transaction data of the blockchain corresponding to at least one cross-chain gateway in the relay domain, and calculating the fission index based on the cross-chain transaction data. If the fission index is greater than or equal to the preset extension threshold, the relay chain extension device (hereinafter referred to as the extension device) will determine the initial node of the newly extended relay chain, thereby extending a new relay chain. In this application, the monitoring request is initiated by any cross-chain gateway in the relay domain when it detects that its first average cross-chain load index is greater than or equal to the monitoring threshold. At this time, in the entire cross-chain system, the cross-chain transaction generated by the first average cross-chain load index corresponding to the cross-chain gateway can cause congestion in the cross-chain system transmission. The cross-chain system includes a relay chain, and the relay domain is used as a transit station, so When blocking occurs, it is likely to cause cross-chain transaction delays, and even make some cross-chain transactions unable to be processed. Therefore, in this solution, after receiving the monitoring request, the expansion device can monitor the cross-chain transaction data of at least one cross-chain gateway corresponding to the blockchain, and calculate the fission index, so as to determine whether it is necessary to expand a new relay chain in the relay domain based on the size of the fission index; in this application, when a new relay chain is expanded, the relay domain includes a new relay chain and a previous relay chain, and each relay chain can undertake part of its own cross-chain transactions, that is, it can undertake transactions between the blockchain groups connected to each other. Therefore, in this application, the new relay chain can undertake part of the cross-chain transaction transmission, thereby dispersing the cross-chain transactions, and each relay chain only undertakes a part of the number of cross-chain transactions, thereby reducing the transmission pressure of the previous relay chain, so that the delay of the blockchain group in the cross-chain transaction process is reduced, and the efficiency of cross-chain transactions is improved. It can be seen that the dynamic expansion of the relay chain can be realized in this application, so that in different application scenarios, according to the sudden increase in the number of cross-chain transactions, a new relay chain is dynamically expanded, and the new relay chain undertakes part of the cross-chain transaction transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0016] Figure 1 An application scenario diagram of a cross-chain interoperable relay chain extension method provided for this application;
[0017] Figure 2 A schematic diagram of a flow chart of a relay chain extension method for cross-chain interoperability provided in Example 1;
[0018] Figure 3 A schematic diagram of a cross-chain system provided in Example 1;
[0019] Figure 4 A schematic diagram of a relay chain extension provided in Example 1;
[0020] Figure 5 A schematic diagram of the structure of a smart network card provided in Example 3;
[0021] Figure 6 A schematic diagram of the structure of a relay chain extension device provided in Example 13;
[0022] Figure 7 A schematic diagram of the structure of the electronic device provided in this application. DETAILED DESCRIPTION
[0023] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0024] It should be noted that, in the description of this application, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in this application are used to distinguish similar objects, and are not used to describe a specific order or sequence.
[0025] In the related technology, the initiator of a blockchain needs to send a transaction request to the corresponding cross-chain gateway, which will send the transaction request to the designated relay chain, and then the relay chain will serve as a transfer station for the transaction request and send the transaction request to the destination blockchain, so that the destination blockchain executes the transaction content in the transaction request. However, in the existing cross-chain system, when a large number of transaction requests suddenly increase, the cross-chain system cannot process each transaction request in time. Each transaction request is arranged and waited according to the order of arrival at the relay chain, resulting in transaction congestion and increased transaction delay; even some transaction requests that are arranged later cannot be sent to the corresponding destination blockchain within the specified time, causing the transaction request to be suspended, or the cross-chain gateway in the cross-chain system may not be able to transmit the transaction request in time, which also causes transmission congestion. The above final results all lead to transmission congestion in the cross-chain system.
[0026] In order to solve the problem of increased transaction delay in the related technology, the inventor of the present scheme has proposed a cross-chain interoperable relay chain extension method after a series of improvements, specifically: when a monitoring request is received, the fission index is calculated, and whether to extend the new relay chain is determined according to the size of the fission index, wherein when the fission index is greater than or equal to the preset extension threshold, a new relay chain is extended. It can be seen that this scheme can realize the dynamic extension of a new relay chain; in addition, the monitoring request in this scheme is initiated when any cross-chain gateway detects that its first average cross-chain load index is greater than or equal to the monitoring threshold, wherein the cross-chain transaction generated by the first average cross-chain load index may cause the relay chain corresponding to the cross-chain gateway to be blocked when realizing transaction transmission, or the cross-chain gateway is blocked, which eventually leads to the blocking of the cross-chain system, and then the new relay chain needs to be extended in this scheme, and the new relay chain is used to undertake part of the cross-chain transactions, thereby alleviating the transmission pressure of the remaining relay chains in the relay domain. Among them, the partial cross-chain transaction can be the partial cross-chain transaction generated when the first average cross-chain load index is greater than or equal to the monitoring threshold, or it can be the cross-chain transaction generated in a subsequent transaction task.
[0027] It should be noted that in the entire relay domain, a new diversion strategy is established for some cross-chain gateways, and each cross-chain gateway is connected to the new relay chain based on the new diversion strategy. The new relay chain is connected to the corresponding cross-chain gateway, and each cross-chain gateway is connected to the corresponding blockchain, so that the new relay chain realizes the transaction between some blockchain groups. Among them, some cross-chain gateways represent some blockchain groups. Among them, the diversion strategy refers to the strategy for the corresponding cross-chain gateway to connect with the new relay chain. The cross-chain gateway that receives the diversion strategy can disconnect the current connection line with the relay chain based on the diversion strategy and connect the line with the new relay chain.
[0028] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0029] In conjunction with the specific application environment architecture or specific hardware architecture on which the execution of the relay chain extension method for cross-chain interoperability depends, the specific application environment architecture or specific hardware architecture is described here. Figure 1 , Figure 1 This is an application scenario diagram of a cross-chain interoperable relay chain extension method provided by this application. Figure 1 As shown, it includes an electronic device 101, a relay domain 102, a relay chain 103, a cross-chain gateway 104 and a blockchain 105.
[0030] The electronic device 101 may be a management device, and the management device may be a computer, a server or other device, which is not limited here.
[0031] The electronic device 101 is connected to the relay domain 102 for communication, and the communication connection mode may be a wired mode or a wireless mode.
[0032] The relay domain 102 includes a relay chain 103 , and the relay chain 103 has four cross-chain gateways 104 downward, and each of the four cross-chain gateways 104 corresponds to a blockchain 105 downward.
[0033] Among them, the four cross-chain gateways 104 are all connected to the relay chain 103, that is, the transactions of the corresponding four blockchains 105 are all transmitted through the relay chain 103, that is, transited.
[0034] Specifically, in this scenario, any cross-chain gateway in the relay domain 102 sends a monitoring request to the electronic device 101, the electronic device 101 receives the monitoring request, and monitors the cross-chain transaction data of the blockchain 105 corresponding to each cross-chain gateway 104 based on the monitoring request.
[0035] Furthermore, the electronic device 101 calculates a fission index based on the cross-chain transaction data. If the fission index is greater than or equal to a preset extension threshold, a new relay chain is extended from the relay domain 102.
[0036] Embodiment 1
[0037] The execution subject of Embodiments 1 to 12 of the present application is a relay chain extension device (hereinafter referred to as the extension device), which is located in the electronic device.
[0038] Figure 2 A schematic diagram of a cross-chain interoperable relay chain expansion method provided in Example 1. Figure 2 As shown, the following steps are included:
[0039] S201, receiving a monitoring request corresponding to any relay domain, and monitoring the cross-chain transaction data of the blockchain corresponding to at least one cross-chain gateway in the relay domain based on the monitoring request; the monitoring request is initiated by any cross-chain gateway in the relay domain when it detects that its first average cross-chain load index is greater than or equal to the monitoring threshold; the cross-chain transaction initiated when the first average cross-chain load index is greater than or equal to the monitoring threshold may cause transmission congestion.
[0040] Among them, the monitoring request is initiated by any cross-chain gateway in any relay domain, and is used to instruct the electronic device to monitor the cross-chain transaction data of the blockchain corresponding to a cross-chain gateway.
[0041] Among them, the cross-chain gateway is an important part of the relay chain technology.
[0042] Among them, the first average cross-chain load index refers to the cross-chain load used to initiate the monitoring request in the corresponding cross-chain gateway, wherein the first average cross-chain load index can be the data on transactions received or sent by the cross-chain gateway in any monitoring period (i.e., the cross-chain transaction data in the monitoring period), wherein the data on transactions include the average monitoring delay data and the average number of monitored transactions corresponding to the blockchain in any monitoring period. Among them, the monitoring period can be every 1 minute or 2 minutes, the monitoring period can be multiple, the monitoring period can be started after receiving the monitoring request, and the number of monitoring periods is not limited, until the first average cross-chain load index of any monitoring period of any of the above cross-chain gateways is greater than or equal to the monitoring threshold, then any of the above cross-chain gateways generates a monitoring request and sends it to the electronic device to instruct the electronic device to continue monitoring the cross-chain transaction data corresponding to all cross-chain gateways.
[0043] The monitoring threshold refers to a preset threshold for determining whether a monitoring request needs to be initiated.
[0044] Among them, the relay chain is the transit station for blockchain groups to conduct transactions.
[0045] Among them, the relay domain includes the corresponding organization, specifically including: the corresponding blockchain, the cross-chain gateway and the relay chain. Among them, the blockchain is connected to the corresponding cross-chain gateway, and the cross-chain gateway is connected to the relay chain. It should be noted that the entire cross-chain system can also include multiple relay domains, and the blockchains in each relay domain can be traded. At this time, the relay domain can also include another cross-chain gateway, which is connected to the global relay chain. The global relay chain can realize the transmission of transactions of blockchains in different relay domains.
[0046] Figure 3 A schematic diagram of a cross-chain system provided in Example 1.
[0047] like Figure 3In the embodiment, the cross-chain system includes an electronic device 101, a first relay domain 302 and a second relay domain 303.
[0048] Among them, the first relay domain 302 includes a first blockchain 3021 and a second blockchain 3022, wherein the first blockchain 3021 is connected to the first cross-chain gateway 3023, and the second blockchain 3022 is connected to the second cross-chain gateway 3024, wherein the first cross-chain gateway 3023 and the second cross-chain gateway 3024 are both connected to the first relay chain 3025, wherein the first relay chain 3025 is connected to the fifth cross-chain gateway 3026.
[0049] Among them, the second relay domain 303 includes a third blockchain 3031 and a fourth blockchain 3032, wherein the third blockchain 3031 is connected to the third cross-chain gateway 3033, and the fourth blockchain 3032 is connected to the fourth cross-chain gateway 3034, wherein the third cross-chain gateway 3033 and the fourth cross-chain gateway 3034 are both connected to the second relay chain 3035, wherein the second relay chain 3035 is connected to the sixth cross-chain gateway 3036.
[0050] Among them, the fifth cross-chain gateway 3026 and the sixth cross-chain gateway 3036 are both connected to the third relay chain 304.
[0051] Among them, the third relay chain 304 is a secondary relay chain, the first relay chain 3025 and the second relay chain 3035 are primary relay chains, and each blockchain is a business blockchain.
[0052] Among them, the third relay chain 304 is a global relay chain.
[0053] exist Figure 3 In the figure, each relay domain is shown with only two blockchains as an example. In actual applications, the number of blockchains in each relay domain can be greater than 2. The pictures or illustrative examples in this application are only for simple explanation and do not represent actual scenario applications.
[0054] Among them, cross-chain transaction data refers to the relevant transaction data received or sent by the corresponding blockchain. It should be noted that the transaction in this application is a cross-chain transaction, that is, a transaction between blockchains. Among them, transaction data includes delay data, transaction serial number, transaction time and other transaction-related data.
[0055] It is understandable that when the first average cross-chain load index is greater than or equal to the monitoring threshold, the corresponding number of transactions generated may be relatively large, which may cause the corresponding relay chain to be unable to ensure fast transmission when implementing transaction transmission, so it may cause congestion.
[0056] S202, calculating a second average cross-chain load index of at least one blockchain group based on the cross-chain transaction data corresponding to each blockchain; the blockchain group includes any two blockchains that generate transactions in the relay domain.
[0057] Among them, a blockchain group refers to two blockchains that generate transactions. For example, Figure 3 In the example, assuming that a transaction occurs between the first blockchain 3021 and the second blockchain 3022, the two blockchains form a blockchain group. It should be noted that the blockchain group is in the same relay domain. In actual situations, blockchains in different relay domains can also form a blockchain group, which will not be described in detail here.
[0058] Among them, the second average cross-chain load index refers to the cross-chain load of the corresponding blockchain group.
[0059] For example, assume that there are three blockchains in a relay domain, namely blockchain 1, blockchain 2, and blockchain 3. Transactions occur between each blockchain, thereby forming three blockchain groups, namely blockchain group (1,2), blockchain group (1,3), and blockchain group (2,3).
[0060] Furthermore, the expansion device calculates a second average cross-chain load index corresponding to the above three blockchain groups based on the cross-chain transaction data.
[0061] S203, calculating a fission index based on the second average cross-chain load index.
[0062] Among them, the fission index is used to evaluate whether a new relay chain needs to be expanded in the relay domain.
[0063] S204: In response to the fission index being greater than or equal to a preset extension threshold, determining an initial node of a newly extended relay chain in the relay domain.
[0064] Among them, the preset extension threshold is the extension standard. As long as the fission index is greater than or equal to the preset extension threshold, it is determined that a new relay chain needs to be extended, that is, the first step is to determine the initial node of the extended relay chain.
[0065] Among them, the initial node is the computing node in the relay chain, etc.
[0066] It is understandable that the relay chain is actually composed of nodes.
[0067] It is understandable that the number of nodes included in different relay chains may be inconsistent, and there is no limitation here.
[0068] S205, control the initial node to start, so as to expand a new relay chain in the relay domain; the new relay chain is used to undertake the transmission of part of the cross-chain transactions.
[0069] It should be noted that when the control initial node is started and the initial node comes online, a new relay chain is formed.
[0070] Figure 4 A schematic diagram of relay chain expansion provided in Example 1. Figure 4 As shown, both before and after expansion. Figure 4 It is an extension of relay domain 400 of A.
[0071] in, Figure 4 Before expansion, it includes an initial relay chain 401, four cross-chain gateways 402, and four blockchains 403.
[0072] Among them, the four cross-chain gateways 402 include A cross-chain gateway 4021, B cross-chain gateway 4022, C cross-chain gateway 4023 and D cross-chain gateway 4024.
[0073] Among them, the four blockchains 403 include A blockchain 4031, B blockchain 4032, C blockchain 4033 and D blockchain 4034.
[0074] Figure 4 , after expansion, includes new relay chain 404.
[0075] Figure 4 In the example, before the expansion, each blockchain 403 is connected to its own cross-chain gateway 402, and each cross-chain gateway 402 is connected to the initial relay chain 401.
[0076] Figure 4 In the figure, after expansion, each blockchain 403 is connected to its own cross-chain gateway 402, among which A cross-chain gateway 4021 and B cross-chain gateway 4022 are both connected to the initial relay chain 401, and C cross-chain gateway 4023 and D cross-chain gateway 4024 are both connected to the new relay chain 404.
[0077] exist Figure 4 It should be noted that before the expansion, each cross-chain gateway 402 is connected to the initial relay chain 401, and then the blockchain group formed by the four blockchains 403 transmits transactions through the initial relay chain 401.
[0078] In this application, if any cross-chain gateway 402 in the A relay domain 400 issues a monitoring request, the electronic device monitors all cross-chain gateways 402 in the A relay domain 400, and then calculates the fission index, and determines the need to extend the relay chain based on the fission index, thereby obtaining a new relay chain 404. It can be seen that in this embodiment, as long as the monitoring request sent by any cross-chain gateway 402 is responded to, the electronic device needs to monitor all cross-chain gateways, and then complete the extension of the new relay chain. Therefore, in this embodiment, it is not necessary for all cross-chain gateways or two or more cross-chain gateways to send monitoring requests to instruct the electronic device to monitor all cross-chain gateways, so the threshold for monitoring can be lowered.
[0079] The present embodiment provides a relay chain extension method for cross-chain interoperability. In the present embodiment, a monitoring request corresponding to any relay domain is received, thereby monitoring the cross-chain transaction data of the blockchain corresponding to at least one cross-chain gateway in the relay domain, thereby calculating the fission index based on the cross-chain transaction data. If the fission index is greater than or equal to the preset extension threshold, then the relay chain extension device (hereinafter referred to as the extension device) will determine the initial node of the newly extended relay chain, thereby extending a new relay chain. In the present embodiment, the monitoring request is initiated by any cross-chain gateway in the relay domain when it detects that its first average cross-chain load index is greater than or equal to the monitoring threshold. At this time, in the entire cross-chain system, the transaction generated by the first average cross-chain load index corresponding to the cross-chain gateway can cause the relay chain connected to the cross-chain gateway to be blocked during transmission. Since the relay chain is used as a transit station in the relay domain, when When blocking occurs, it is likely to cause transaction delays, and even make some transactions unable to be processed. Therefore, in this solution, after receiving the monitoring request, the expansion device can monitor the cross-chain transaction data of at least one cross-chain gateway corresponding to the blockchain, and calculate the fission index, so as to determine whether it is necessary to expand a new relay chain in the relay domain based on the size of the fission index; in this embodiment, when a new relay chain is expanded, the relay domain includes a new relay chain and a previous relay chain, and each relay chain can undertake part of its own cross-chain transactions, that is, undertake cross-chain transactions between the blockchain groups connected to each other. Therefore, in this embodiment, the new relay chain can undertake part of the cross-chain transaction transmission, thereby dispersing the cross-chain transactions, and each relay chain only undertakes a part of the cross-chain transactions, thereby reducing the transmission pressure of the previous relay chain, so that the delay of the blockchain group in the transaction process is reduced, and the efficiency of cross-chain transactions is improved. It can be seen that in this embodiment, the dynamic expansion of the relay chain can be realized, so that in different application scenarios, according to the sudden increase in the number of transactions, a new relay chain is dynamically expanded, and the new relay chain undertakes part of the cross-chain transaction transmission.
[0080] Embodiment 2
[0081] This embodiment is a further refinement of any of the above embodiments. This embodiment is an optional method for monitoring cross-chain transaction data of a blockchain corresponding to at least one cross-chain gateway in a relay domain based on a monitoring request, including:
[0082] Based on the monitoring request, monitor and obtain cross-chain transaction data of the corresponding blockchain within a preset time period from at least one cross-chain gateway.
[0083] The preset time period refers to a pre-set time period. For example, the preset time period may be a period of time closest to the current time, or a period of time after the period of time closest to the current time, and there is no limitation here.
[0084] It should be noted that, assuming there are three cross-chain gateways, namely cross-chain gateway 1, cross-chain gateway 2 and cross-chain gateway 3, the electronic device needs to obtain the cross-chain transaction data 1 of the corresponding blockchain 1 from the cross-chain gateway 1. The cross-chain transaction data 1 includes the transaction data of at least one blockchain group to which the blockchain 1 belongs, wherein the at least one blockchain group to which the blockchain 1 belongs may include blockchain group (1,2) and blockchain group (1,3), wherein blockchain group (1,2) refers to the blockchain group composed of blockchain 1 and blockchain 2.
[0085] Similarly, the electronic device can also obtain the cross-chain transaction data 2 corresponding to the blockchain 2 from the cross-chain gateway 2, wherein the cross-chain transaction data 2 includes the transaction data of at least one blockchain group to which the blockchain 2 belongs. The at least one blockchain group to which the blockchain 2 belongs can be the blockchain group (1, 2) and the blockchain group (2, 3).
[0086] This embodiment also includes an optional method for calculating the second average cross-chain load index of at least one blockchain group based on the monitoring request, specifically:
[0087] Step 1: Calculate the cross-chain load index of each blockchain group within a preset time period based on each cross-chain transaction data.
[0088] Among them, the cross-chain load index refers to the comprehensive index of the cross-chain load of the blockchain group to which the corresponding blockchain belongs obtained in the cross-chain gateway.
[0089] It should be noted that, in each cross-chain gateway, the cross-chain transaction data corresponding to at least one blockchain group to which the corresponding blockchain belongs can be obtained, and the cross-chain load corresponding to at least one blockchain group to which the corresponding blockchain belongs can be calculated based on the cross-chain transaction data. Among them, the cross-chain load can be the delay data and the total number of completed transactions, specifically the first total delay data and the first total number of completed transactions in this application.
[0090] Step 2: Calculate a second average cross-chain load index based on the cross-chain load index.
[0091] Furthermore, the above cross-chain load indexes are averaged to obtain a second average cross-chain load index.
[0092] This embodiment provides a cross-chain interoperable relay chain extension method. In this embodiment, cross-chain transaction data of the corresponding blockchain within a preset time is obtained from at least one cross-chain gateway, and then a second average cross-chain load index can be calculated.
[0093] Embodiment 3
[0094] This embodiment is a further refinement of any of the above embodiments. This embodiment is an optional method for monitoring and obtaining cross-chain transaction data of a corresponding blockchain within a preset time period from at least one cross-chain gateway based on a monitoring request, including:
[0095] Based on the monitoring request, cross-chain transaction data of the corresponding blockchain within a preset time period is obtained from the smart network card in at least one cross-chain gateway; the smart network card includes a monitoring management unit, which is used to monitor the transmission data of the corresponding blockchain; the transmission data includes cross-chain transaction data.
[0096] It should be noted that another innovation in this application is that the cross-chain gateway in this application adds a smart network card compared to the cross-chain gateway in the related art. The smart network card is located in the hardware device of the cross-chain gateway. The cross-chain gateway in this application can also include a performance detection module, which is not available in the related art. The performance detection module can read the cross-chain transaction data within the monitoring period, and then calculate the first average cross-chain load index based on the cross-chain transaction data within the monitoring period, and compare the first average cross-chain load index with the monitoring threshold. If the first average cross-chain load index is greater than or equal to the monitoring threshold, the performance detection module generates a monitoring request, which is used to instruct the electronic device to monitor the cross-chain transaction data of all cross-chain gateways in the relay domain. In this application, when the first average cross-chain load index is greater than or equal to the monitoring threshold, it is considered that the transmission performance of the corresponding relay chain has reached a bottleneck. It should be noted that the performance detection module can read the cross-chain transaction data within the monitoring period in the smart network card.
[0097] In the present application, the smart network card includes a monitoring management unit, which can monitor the transmission data of the corresponding blockchain, and the transmission data includes cross-chain transaction data.
[0098] It should be noted that since the cross-chain gateway in this application has newly deployed a performance detection module, it can read the cross-chain transaction data in the smart network card, and then detect its own first average cross-chain load index, and then generate a monitoring request, thereby triggering the electronic device to monitor at least one cross-chain gateway in the relay domain.
[0099] Figure 5 A schematic diagram of the structure of an intelligent network card provided in Example 3. Figure 5 As shown, the smart network card includes: a bus interface 501, a sending memory 502, a receiving memory 503, a sending direct memory access channel 504, a receiving direct memory access channel 505, a direct memory access channel control and status register 506, a medium transmission layer sending first-in-first-out controller 507, a medium transmission layer receiving first-in-first-out controller 508, a medium transmission layer control and status register 509, a media access control sending module 510, a media access control receiving module 511, a media access control and status register 512, and a physical layer 513.
[0100] The sending direct memory access channel 504 and the receiving direct memory access channel 505 include a monitoring management unit 514 .
[0101] It should be noted that the monitoring management unit included in the smart network card in the present application can read the sent and received data, so that the sent and received data can be included in the corresponding memory, and then the performance detection module can obtain the cross-chain transaction data from the corresponding memory.
[0102] This embodiment provides a cross-chain interoperable relay chain extension method. In this embodiment, the smart network card includes a monitoring management unit, which monitors the transmission data of the corresponding blockchain, so that the electronic device can obtain cross-chain transaction data within a preset time period in the smart network card, thereby realizing the intelligence of the cross-chain gateway.
[0103] Embodiment 4
[0104] This embodiment is a further refinement of any of the above embodiments. In this embodiment, the cross-chain transaction data includes each completed transaction sub-delay data and the completed transaction serial number of at least one blockchain group to which the corresponding blockchain belongs.
[0105] This embodiment is an optional method for calculating the cross-chain load index of each blockchain group within a preset time period based on each cross-chain transaction data, including the following steps:
[0106] Step 1: For each blockchain, calculate the first total delay data corresponding to each blockchain group to which the blockchain belongs within a preset time period; the first total delay data is the sum of the sub-delay data of each completed transaction in the blockchain group to which the blockchain belongs.
[0107] It should be noted that, for each blockchain, the first total delay data of at least one blockchain group corresponding to each blockchain is calculated respectively.
[0108] According to the exemplary embodiment 1 above, for blockchain 1, corresponding to two blockchain groups (1, 2) and blockchain group (1, 3), for the blockchain group (1, 2) corresponding to blockchain 1, at least one completed transaction sub-delay data corresponding to the blockchain group (1, 2) is added and calculated to obtain the first total delay data A corresponding to the blockchain group (1, 2) within the preset time period; similarly, for the blockchain group (1, 3) corresponding to blockchain 1, at least one completed transaction sub-delay data corresponding to the blockchain group (1, 3) is added and calculated to obtain the first total delay data B corresponding to the blockchain group (1, 3) within the preset time period.
[0109] Exemplarily, for blockchain 2, corresponding to two blockchain groups (1, 2) and blockchain group (2, 3), for the blockchain group (1, 2) corresponding to blockchain 2, at least one completed transaction sub-delay data corresponding to the blockchain group (1, 2) is added and calculated to obtain the first total delay data C corresponding to the blockchain group (1, 2) within the preset time period.
[0110] It can be understood that, according to the above steps, the first total delay data of the corresponding blockchain group can be obtained for the cross-chain transaction data of different blockchains, and since there are two blockchains in the blockchain group, the first total delay data of the corresponding blockchain group can be calculated for the above two blockchains respectively. It can be seen that the blockchain group corresponds to two first total delay data. From the above, it can be seen that the first total delay data A and the first total delay data C are both the first total delay data of the blockchain group (1,2), which is two.
[0111] Step 2: For each blockchain, calculate the total number of first completed transactions corresponding to each blockchain group to which the blockchain belongs within a preset time period; the total number of first completed transactions is the number of completed transaction serial numbers in the blockchain group to which the blockchain belongs.
[0112] Using the same method as in step 1 above, calculate the total number of first completed transactions corresponding to each blockchain group.
[0113] It should be noted that when a transaction is completed, the cross-chain gateway can record its corresponding transaction serial number, and then the electronic device can calculate the number of completed transaction serial numbers, which can represent the total number of the first completed transactions.
[0114] Among them, the total number of transactions completed first is a cross-chain load.
[0115] Step three: For each blockchain group, the cross-chain load index of the blockchain group within a preset time period is calculated based on the first total delay data and the first total number of completed transactions of the blockchain group.
[0116] According to the above, taking the blockchain group as a benchmark, the corresponding cross-chain load index can be calculated based on the corresponding first total delay data.
[0117] It should be noted that after calculating the first total delay data and the first total number of completed transactions, a cross-chain two-dimensional table can be generated to represent the first total delay data and the first total number of completed transactions of the blockchain group to which each blockchain belongs in the above cross-chain two-dimensional table.
[0118] Table 1 uses three blockchains as examples, including blockchain group (1, 2), blockchain group (1, 3) and blockchain group (2, 3).
[0119] Table 1: An illustrative cross-chain two-dimensional table.
[0120] Blockchain Blockchain 1 Blockchain 2 Blockchain 3 Blockchain 1 NULL D(1,2);T(1,2) D(1,3);T(1,3) Blockchain 2 D(2,1);T(2,1) NULL D(2,3);T(2,3) Blockchain 3 D(3,1);T(3,1) D(3,2);T(3,2) NULL
[0121] In Table 1, D(1,2) refers to the first total delay data corresponding to the blockchain group (1,2) to which it belongs, based on blockchain 1 (i.e., for blockchain 1). D(2,1) refers to the first total delay data corresponding to the blockchain group (1,2) to which it belongs, based on blockchain 2 (i.e., for blockchain 2). T(1,2) refers to the first total number of completed transactions corresponding to the blockchain group (1,2) to which it belongs, based on blockchain 1 (i.e., for blockchain 1). The rest will not be repeated.
[0122] Table 2 takes n blockchains as an example. When there are n blockchains, and cross-chain transactions occur between blockchains, and blockchain groups are formed between them, then according to Table 2, blockchain 1 is taken as the benchmark, including the first total delay data and the first total number of completed transactions corresponding to the blockchain group (1,2) to which it belongs and the blockchain group (1,n). No further details will be given here.
[0123] Table 2: Two-dimensional cross-chain table of n blockchains.
[0124] Blockchain Blockchain 1 Blockchain 2 …… Blockchain Blockchain 1 NULL D(1,2);T(1,2) …… D(1,n);T(1,n) Blockchain 2 D(2,1);T(2,1) NULL …… D(2,n);T(2,n) …… …… …… NULL …… Blockchain D(n,1);T(n,1) D(n,2);T(n,2) …… NULL
[0125] This embodiment provides a relay chain extension method for cross-chain interoperability. In this embodiment, the first total delay data and the first total number of completed transactions of the blockchain group to which each blockchain belongs are calculated based on the blockchain, and then the cross-chain load index within the preset time period can be calculated. It should be noted that for a blockchain group, although transactions are conducted between two blockchains, due to the delay of information, one of the blockchains may determine that the transaction has been completed, but the other blockchain may determine that the transaction has not been completed. Therefore, it is necessary to use the blockchain as a benchmark to calculate the first total delay data and the first total number of completed transactions of the blockchain group to which each blockchain belongs, so that the cross-chain load index will be more accurate.
[0126] Embodiment 5
[0127] This embodiment is a further refinement of any of the above embodiments. In this embodiment, the cross-chain load index includes the second total delay data and the second total number of completed transactions corresponding to the blockchain group.
[0128] This embodiment is an optional method for calculating the cross-chain load index of each blockchain group within a preset time period based on the first total delay data and the first total number of completed transactions of the blockchain group, including:
[0129] Step 1: For each blockchain group, the second total delay data within a preset time period is calculated based on the first total delay data corresponding to the blockchain group; there are two first total delay data corresponding to the blockchain group; the second total delay data is the sum of the two first total delay data of the corresponding blockchain.
[0130] According to the example in Table 1, the first total delay data corresponding to the blockchain group (1, 2) is D(1, 2) and D(2, 1), and the second total delay data of the blockchain group (1, 2) within the preset time period is calculated, that is, D(1, 2) + D(2, 1).
[0131] Step 2: For each blockchain group, calculate the total number of second completed transactions within the preset time period based on the total number of first completed transactions corresponding to the blockchain group; the total number of first completed transactions corresponding to the blockchain group is two; the total number of second completed transactions is the sum of the two total numbers of first completed transactions of the corresponding blockchain.
[0132] According to the example in Table 1, the total number of first completed transactions corresponding to blockchain group (1, 2) is T(1, 2) and T(2, 1), and the total number of second completed transactions of blockchain group (1, 2) within the preset time period is calculated, that is, T(1, 2) + T(2, 1).
[0133] The present embodiment provides a relay chain extension method for cross-chain interoperability. In the present embodiment, the overall situation is given priority, and the respective sums of the first total delay data and the first total number of completed transactions corresponding to each blockchain group are calculated respectively, that is, the second total delay data and the second total number of completed transactions are obtained.
[0134] Embodiment 6
[0135] This embodiment is a further refinement of any of the above embodiments. In this embodiment, the cross-chain load index includes the second total delay data and the second total number of completed transactions.
[0136] This embodiment is an optional method for calculating the second average cross-chain load index based on the cross-chain load index, including:
[0137] Step 1: For each blockchain group, calculate the average delay data based on the second total delay data of the blockchain group.
[0138] According to the exemplary embodiment 5 above, the second total delay data corresponding to the blockchain group (1, 2) within the preset time period needs to be averaged to represent the delay data of the blockchain group (1, 2), that is, the second total delay data D(1, 2) + D(2, 1) is averaged, that is, D'(1, 2) = (D(1, 2) + D(2, 1)) / 2.
[0139] Among them, D'(1,2) refers to the average delay data corresponding to the blockchain group (1,2) in the preset time period.
[0140] Step 2: For each blockchain group, the average number of transactions is calculated based on the second total number of completed transactions of the blockchain group; the second average cross-chain load index includes the average delay data and the average number of transactions.
[0141] Among them, the average transaction number refers to the average number of completed transactions.
[0142] Similarly, the total number of completed transactions for the second time is T'(1,2) = (T(1,2) + T(2,1)) / 2. T'(1,2) refers to the average number of transactions corresponding to the blockchain group (1,2) within the preset time period.
[0143] The present embodiment provides a relay chain extension method for cross-chain interoperability. In the present embodiment, for each blockchain group, average delay data and average transaction number are calculated based on the second total delay data and the second total number of completed transactions. In the present embodiment, the second total delay data and the second completed transactions are averaged to accurately obtain the second average cross-chain load index of the blockchain group.
[0144] Embodiment 7
[0145] This embodiment is a further refinement of any of the above embodiments. This embodiment is an optional method for calculating the fission index based on the second average cross-chain load index, including the following steps:
[0146] Step 1: In response to any average delay data being greater than a preset delay threshold, an average value of the number of overload delay connections is calculated based on the average delay data.
[0147] The preset delay threshold is a preset delay threshold.
[0148] Among them, the average value of overload delay connection number refers to the average value of overload delay corresponding to the blockchain group corresponding to the preset delay threshold whose average delay data is greater than that of the blockchain group corresponding to the preset delay threshold. Specifically, the average value of overload delay refers to the average value of the blockchain group whose average delay data is greater than or equal to the preset delay threshold that exceeds the preset delay threshold.
[0149] Step 2: In response to any average transaction quantity being greater than a preset transaction quantity threshold, an average value of the number of overloaded transaction connections is calculated based on the average transaction quantity.
[0150] The average value of overloaded transaction connections refers to the average value of overloaded transaction connections corresponding to the blockchain group whose average transaction number is greater than the preset transaction number threshold. Specifically, the average value of overloaded transaction connections refers to the average value of all blockchain groups whose average transaction number is greater than or equal to the preset transaction number exceeding the preset transaction number threshold.
[0151] Step three, calculate the fission index based on the average number of overloaded delayed connections and the average number of overloaded transaction connections. The fission index is used to characterize the degree of fission caused by the average number of overloaded delayed connections and the average number of overloaded transaction connections.
[0152] It should be noted that the larger the average number of overloaded delay connections and the number of overloaded transaction connections, the larger the fission index, and thus the greater the degree of fission. The greater the degree of fission, the greater the need to expand the relay domain.
[0153] This embodiment provides a cross-chain interoperable relay chain expansion method. In this embodiment, the average value of the overload delay connection number and the average value of the overload transaction connection number are calculated to characterize the overload amount, and then the fission index can be calculated based on the overload amount. The fission index can characterize the impact of the overload amount on the expansion demand. If the overload amount is too large, the fission index may be larger, and the expansion demand will be greater.
[0154] Embodiment 8
[0155] This embodiment is a further refinement of any of the above embodiments. This embodiment provides an optional method before calculating the average value of the number of overload delay connections based on the average delay data, including:
[0156] Obtain the first overload delay connection number corresponding to at least one first preset period before the preset time period; the first overload delay connection number is the number of delay blockchain groups corresponding to each first preset period; there is at least one delay blockchain group; each delay blockchain group is a blockchain group whose average delay data in the corresponding first preset period is greater than a preset delay threshold; the delay period includes the period corresponding to the preset time period and the first preset period.
[0157] Among them, the first overload delay connection number refers to the number of blockchain groups whose average delay data is greater than the preset delay threshold within the corresponding first preset period.
[0158] It should be noted that, in this embodiment, the method for obtaining / calculating the average delay data within the first preset period is consistent with the method for obtaining / calculating the average delay data within the preset time period, which will not be described in detail here.
[0159] The first preset period refers to the number of preset periods for calculating the first overload delay connection number, and the period is the delay period.
[0160] According to the exemplary embodiment above, assuming that the first preset period is 2, taking the first first preset period as an example, assuming that the delayed blockchain group in the first preset period is two of the three blockchain groups, namely blockchain group (1,2) and blockchain group (1,3), the electronic device obtains the first overload delay connection number corresponding to the first first preset period before the preset time period, recorded as the first overload delay connection number A, wherein the first overload delay connection number A includes blockchain group (1,2) and blockchain group (1,3), so the first overload delay connection number A is 2. At the same time, for the second first preset period, assuming that the corresponding delay blockchain groups are blockchain group (1,2), blockchain group (1,3) and blockchain group (2,3), the first overload delay connection number B corresponding to the second first preset period is 3. Among them, the period corresponding to the first preset period is one of the delay periods.
[0161] Among them, the first overload delay connection number A is the number of delay blockchain groups corresponding to the first first preset period.
[0162] Among them, the first overload delay connection number B is the number of delay blockchain groups corresponding to the second first preset period.
[0163] According to the above, in this embodiment, the first overload delay connection number corresponding to the first preset period is obtained, namely, the first overload delay connection number A (2) and the first overload delay connection number B (3).
[0164] It should be noted that the interval corresponding to the first preset period may be consistent with the interval of the preset time period, or may not be consistent with it, and there is no limitation here.
[0165] In this embodiment, cross-chain transaction data corresponding to the first preset period can be obtained from the smart network card, and the first overload delay connection number is calculated based on the cross-chain transaction data corresponding to the first preset period to obtain the first overload delay connection number.
[0166] Embodiment 9
[0167] This embodiment is a further refinement of any of the above embodiments. This embodiment is an optional method for calculating the average value of the number of overload delay connections based on the average delay data, and includes the following steps:
[0168] Step 1: Within a preset time period, calculate the number of delays of blockchain groups whose average delay data is greater than a preset delay threshold, and determine the number of delays as the corresponding second overload delay connection number.
[0169] Among them, the second overload delay connection number refers to the number of blockchain groups whose average delay data is greater than the preset delay threshold within a preset time period.
[0170] The number of delays refers to the number of delayed blockchain groups. In this embodiment, the blockchain group whose average delay data is greater than the preset delay threshold is also a delayed blockchain group.
[0171] Among them, the preset delay threshold is the maximum number of delayed blockchain groups that can be carried within a preset time period (or delay period). It should be noted that exceeding the preset delay threshold means that a larger number of blockchain groups in the cross-chain system are delayed blockchain groups, and the resulting transactions may cause the relay chain to be blocked.
[0172] Among them, the period corresponding to the preset time period is also a type of delay period.
[0173] Exemplarily, it is assumed that the number of delays within the preset time period is 2, that is, the number of second overload delay connections is 2.
[0174] Step 2, calculate the third overload delay connection number; the third overload delay connection number is the sum of the first overload delay connection number and the second overload delay connection number corresponding to each delay period; the delay period includes the period corresponding to the preset time period and the first preset period.
[0175] The third overload delay connection number is the sum of the corresponding overload delay connection numbers in each delay period, that is, the sum of the first overload delay connection number corresponding to the first preset period and the second overload delay connection number of the period corresponding to the preset time period. It can be seen that in this embodiment, the delay period includes the period corresponding to the preset time period and the first preset period.
[0176] According to the above example, the first overload delay connection number corresponding to the first preset period includes the first overload delay connection number A (2) and the first overload delay connection number B (3), and the second overload delay connection number of the period corresponding to the preset time period is 2, so the third overload delay connection number is calculated to be 2+3+2=7.
[0177] Step three, calculating a first average value based on the third number of overload delay connections and the number of delay periods; the first average value is the average value of the number of overload delay connections within the delay period.
[0178] According to the above example, the delay period includes 2 first preset periods and a period corresponding to the preset time period, that is, the delay period is 3, thereby determining that the number of delay periods is 3, and then calculating the ratio of the number of third overload delay connections to the number of delay periods, that is, achieving averaging to obtain the first average value.
[0179] The first average value is the average value of all overload delay connections within the delay period.
[0180] It should be noted that the number of overloaded delayed connections refers to the number of blockchain groups whose average delay data is greater than the preset delay threshold.
[0181] A connection refers to the connection between any two blockchains due to a transaction. If the number of connections is 1, it refers to a blockchain group.
[0182] The present embodiment provides a relay chain extension method for cross-chain interoperability. In this embodiment, in order to improve generalization, the third overload delay connection number is first calculated. The third overload delay connection number is the sum of the corresponding overload delay connection numbers in each delay period. In this embodiment, when the average delay data is greater than the preset delay threshold within the preset time period, not only the overload delay connection number of the preset time period is considered, but in order to be more accurate and reduce the situation where the third overload delay connection number is generated due to accidents, the first overload delay data of the first preset period before the preset time period is also taken into account, and the data is averaged based on the number of delay periods to obtain a first average value, thereby improving the accuracy and being more in line with the actual situation.
[0183] Embodiment 10
[0184] This embodiment is a further refinement of any of the above embodiments. In this embodiment, the blockchain group whose average transaction number is greater than the preset transaction number threshold is the target blockchain group; there is at least one target blockchain group.
[0185] This embodiment provides an optional method for calculating the average number of overloaded transaction connections based on the average transaction number, including:
[0186] Obtain a first overload transaction connection number corresponding to at least one second preset period before a preset time period; the first overload transaction connection number is the number of transaction blockchain groups corresponding to each second preset period; there is at least one transaction blockchain group; each transaction blockchain group is a blockchain group whose average transaction number in the corresponding second preset period is greater than a preset transaction threshold.
[0187] Among them, the first overload transaction connection number refers to the number of blockchain groups whose average transaction number is greater than the preset transaction threshold in the corresponding second preset period.
[0188] It should be noted that, in this embodiment, the method for obtaining / calculating the average number of transactions in the second preset period is consistent with the method for obtaining / calculating the average number of transactions in the preset time period, and will not be elaborated here.
[0189] The second preset period refers to the number of preset periods for calculating the first number of overloaded transaction connections, and the period is a transaction period.
[0190] According to the exemplary embodiment above, assuming that the second preset period is 2, taking the first second preset period as an example, assuming that the transaction blockchain groups in the first preset period are two of the three blockchain groups, namely blockchain group (1,2) and blockchain group (1,3), the electronic device obtains the first overload transaction connection number corresponding to the first second preset period before the preset time period, recorded as the first overload transaction connection number A, wherein the first overload transaction connection number A includes blockchain group (1,2) and blockchain group (1,3), so the first overload transaction connection number A is 2. At the same time, for the second second preset period, assuming that the corresponding transaction blockchain groups are blockchain group (1,2), blockchain group (1,3) and blockchain group (2,3), the first overload transaction connection number B corresponding to the second second preset period is 3. Among them, the period corresponding to the second preset period is one of the transaction periods.
[0191] Among them, the first overload transaction connection number A is the number of transaction blockchain groups corresponding to the first second preset period.
[0192] Among them, the first overload transaction connection number B is the number of transaction blockchain groups corresponding to the second second preset period.
[0193] According to the above, in this embodiment, the first overload transaction connection number corresponding to the second preset period is obtained, namely, the first overload transaction connection number A (2) and the first overload transaction connection number B (3).
[0194] It should be noted that the interval corresponding to the second preset period may be consistent with the interval of the preset time period, or may not be consistent with it, and there is no limitation here.
[0195] In this embodiment, the cross-chain transaction data corresponding to the second preset period can be obtained from the smart network card, and the first overload transaction connection number is calculated based on the cross-chain transaction data corresponding to the second preset period to obtain the first overload transaction connection number.
[0196] Embodiment 11
[0197] This embodiment is a further refinement of any of the above embodiments. This embodiment provides an optional method for calculating the average number of overloaded transaction connections based on the average number of transactions, including:
[0198] Step 1: Within a preset time period, calculate the number of transactions of the blockchain group whose average transaction number is greater than a preset transaction threshold, and determine the number of transactions as the corresponding second overload transaction connection number.
[0199] The second overloaded transaction connection number refers to the number of blockchain groups whose average transaction number within a preset time period is greater than a preset transaction threshold.
[0200] The number of transactions refers to the number of transaction blockchain groups. In this embodiment, a blockchain group whose average transaction data is greater than a preset transaction threshold is also a transaction blockchain group.
[0201] Among them, the preset transaction threshold is the maximum number of transaction blockchain groups that can be carried within a preset time period (or transaction cycle). It should be noted that exceeding the preset transaction threshold means that a larger part of the blockchain groups in the cross-chain system are transaction blockchain groups, and the resulting transactions may cause the relay chain to be blocked.
[0202] Exemplarily, it is assumed that the number of transactions within the preset time period is 2, that is, the number of second overload transaction connections is 2.
[0203] Step 2: Calculate the third overload transaction connection number; the third overload transaction connection number is the sum of the first overload transaction connection number and the second overload transaction connection number corresponding to each transaction cycle; the transaction cycle includes the cycle corresponding to the preset time period and the second preset cycle.
[0204] The third number of overloaded transaction connections is the sum of the corresponding overloaded transaction connections in each transaction cycle, that is, the sum of the first number of overloaded transaction connections corresponding to the second preset cycle and the second number of overloaded transaction connections in the cycle corresponding to the preset time period. It can be seen that in this embodiment, the transaction cycle includes the cycle corresponding to the preset time period and the second preset cycle.
[0205] According to the above example, the first overload transaction connection number corresponding to the second preset period includes the first overload transaction connection number A (2) and the first overload transaction connection number B (3), and the second overload transaction connection number of the period corresponding to the preset time period is 2, so the third overload transaction connection number is calculated to be 2+3+2=7.
[0206] Step three, calculating a second average value based on the third number of overloaded transaction connections and the number of transaction cycles; the second average value is the average value of the number of overloaded transaction connections within the transaction cycle.
[0207] According to the above example, the above transaction cycle includes 2 second preset cycles and a cycle corresponding to the preset time period, that is, the transaction cycle is 3, thereby determining that the number of transaction cycles is 3, and then calculating the ratio of the number of third overload transaction connections to the number of transaction cycles, that is, achieving averaging to obtain the second average value.
[0208] The second average value is the average value of all overloaded transaction connections in the transaction cycle.
[0209] It should be noted that the number of overloaded transaction connections refers to the number of blockchain groups whose average transaction number is greater than the preset transaction threshold.
[0210] The present embodiment provides a relay chain extension method for cross-chain interoperability. In the present embodiment, in order to improve generalization, the third overload transaction connection number is first calculated, and the third overload transaction connection number is the sum of the corresponding overload transaction connection numbers in each transaction cycle. In the present embodiment, when the average transaction data in the preset time period is greater than the preset transaction threshold, not only the overload transaction connection number in the preset time period is considered, but in order to be more accurate and reduce the situation where the third overload transaction connection number is generated due to accidents, the first overload transaction data of the second preset cycle before the preset time period is also taken into account, and averaged based on the number of transaction cycles to obtain the second average value, thereby improving the accuracy and being more in line with the actual situation.
[0211] Embodiment 12
[0212] This embodiment is a further refinement of any of the above embodiments. This embodiment is an optional method for calculating the fission index based on the average value of the number of overloaded delay connections and the average value of the number of overloaded transaction connections, including:
[0213] The average number of overloaded delay connections, the average number of overloaded transaction connections, and the total number of connections are input into the preset fission index algorithm to calculate the fission index; the total number of connections is the number of blockchain groups.
[0214] The preset fission index algorithm is a preset fission index calculation algorithm. As shown in (1):
[0215] (1)
[0216] in, represents the fission index, Indicates the average number of overloaded transaction connections. Indicates the average number of overload delay connections. Indicates the number of all blockchain groups, that is, the total number of connections, Indicates the preset transaction weight index, Indicates the preset delay weight index.
[0217] Among them, the total number of connections is the number of all blockchains.
[0218] In practical applications, the preset and Regulate the fission index.
[0219] According to the above (1), the fission index can be calculated.
[0220] Further, the electronic device determines the size of the fission index and a preset extension threshold. If it is determined that the fission index is greater than or equal to the preset extension threshold, the electronic device determines an initial node of a new relay chain in the relay domain.
[0221] It should be noted that when the relay domain is configured in the early stage, it may include at least one node, so that when the cross-chain system needs to be expanded, the electronic device determines the initial node of the new relay chain from at least one node.
[0222] In one embodiment, the electronic device may randomly determine an initial node from at least one node; the initial node may be at least one.
[0223] In one embodiment, the electronic device determines an initial node that meets the above degree from at least one node based on the degree to which the fission index exceeds a preset expansion threshold; the initial node meets the transmission requirements for some cross-chain transactions.
[0224] Furthermore, after the electronic device determines the initial node, it generates a relay chain genesis block, and then sends the relay chain genesis block to the corresponding initial node to indicate that the initial node will use itself to expand the new relay chain. The relay chain genesis block includes the identifiers of each initial node.
[0225] Furthermore, the initial node receives the relay chain genesis block and knows that it will be used to expand into a new relay chain.
[0226] Furthermore, the electronic device controls the initial node to start up, so that each initial node starts up and forms a new relay chain.
[0227] Furthermore, the electronic device generates a diversion strategy, wherein the diversion strategy includes a cross-chain gateway connected to the new relay chain, and the cross-chain gateway is determined as a diversion gateway. Each diversion gateway can form a blockchain group.
[0228] The electronic device sends the diversion strategy to the corresponding diversion gateway to instruct the diversion gateway to disconnect the currently connected relay chain based on the diversion strategy and form a new connection. The new connection is connected to the new relay chain, thereby forming a new network connection and realizing diversion, so that the new relay chain undertakes the transmission of part of the cross-chain transactions.
[0229] In one approach, the electronic device generates a diversion strategy to achieve average diversion of the blockchain group, or it can determine the cross-chain gateway that needs to be diverted based on the distance of the connection relationship. There is no limitation here.
[0230] Among them, averaging and diversion means that if the relay domain includes 4 blockchains, then after averaging, blockchain 1 and blockchain 2 correspond to one relay chain, blockchain 3 and blockchain 4 correspond to one relay chain, and the relay chain corresponding to blockchain 3 and blockchain 4 can be randomly determined as the new relay chain.
[0231] Among them, the cross-chain gateway that needs to be diverted is determined based on the distance of the connection relationship. If blockchain 3 and blockchain 4 are connected to the new relay chain, the connection route they generate is closer than blockchain 1 and blockchain 2, then the relay chain corresponding to blockchain 3 and blockchain 4 is determined to be the new relay chain.
[0232] It should be noted in this embodiment that after the new relay chain is running, taking the above description as an example, assuming that blockchain 3 and blockchain 4 correspond to the new relay chain, a transaction is initiated by blockchain 3 and blockchain 4 is the destination chain, then the transaction request is sent from blockchain 3 through the corresponding cross-chain gateway to the new relay chain, and then from the new relay chain to the cross-chain gateway corresponding to blockchain 4, and then from the cross-chain gateway to blockchain 4.
[0233] Specifically, when the transaction request is transmitted in the path, the blockchain 3 needs to package the transaction request based on the cross-chain protocol contract, and after the packaging is completed, a data packet is formed, and the data packet is sent to the corresponding cross-chain gateway 3, so that the cross-chain gateway 3 determines the evidence that the data packet has reached a consensus on the blockchain 3, and then the cross-chain gateway 3 will divert the data packet and the evidence to the new relay chain according to the diversion strategy. The relay chain verifies that the data packet has reached a consensus on the blockchain 3 based on the evidence through the cross-chain protocol contract, obtains the verification result, and writes the verification result into the new relay chain to achieve endorsement. Further, the cross-chain gateway 4 corresponding to the blockchain 4 monitors the new relay chain, obtains the data packet and the endorsement, and then sends the data packet to the blockchain 4 in the form of a transaction, so that the blockchain 4 parses the data packet through the cross-chain protocol contract and verifies the endorsement of the transaction request by the new relay chain, thereby indirectly verifying that the transaction request has reached a consensus on the blockchain 3, and then the blockchain 4 calls the corresponding application contract to execute the transaction, generates a transaction response, and sends the transaction response to the blockchain 3 in the same way. In this embodiment, the transaction request is transmitted by hop-by-hop transmission and cross-chain protocol contract verification.
[0234] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method.
[0235] Embodiment 13
[0236] Figure 6 This is a schematic diagram of the structure of a relay chain extension device provided in Example 13. Figure 6 As shown, the relay chain extension device 600 includes the following modules:
[0237] The receiving module 601 is used to receive a monitoring request corresponding to any relay domain, and the monitoring module 602 is used to monitor the cross-chain transaction data of the blockchain corresponding to at least one cross-chain gateway in the relay domain based on the monitoring request; the monitoring request is initiated by any cross-chain gateway in the relay domain when it detects that its first average cross-chain load index is greater than or equal to the monitoring threshold; the cross-chain transaction initiated when the first average cross-chain load index is greater than or equal to the monitoring threshold may cause transmission congestion;
[0238] A calculation module 603 is used to calculate a second average cross-chain load index of at least one blockchain group based on the cross-chain transaction data corresponding to each blockchain; the blockchain group includes any two blockchains that generate transactions in the relay domain;
[0239] A calculation module 603, configured to calculate a fission index based on a second average cross-chain load index;
[0240] A determination module 604, configured to determine an initial node of a newly extended relay chain in the relay domain in response to the fission index being greater than or equal to a preset extension threshold;
[0241] The control module 605 is used to control the initial node startup to expand a new relay chain in the relay domain; the new relay chain is used to undertake the transmission of some cross-chain transactions.
[0242] For the description of the features in the embodiment corresponding to the relay chain extension device, please refer to the relevant description of the embodiment corresponding to the cross-chain interoperability relay chain extension method, which will not be repeated here.
[0243] Figure 7 This is a schematic diagram of the structure of the electronic device provided in this application. Figure 7 As shown, the electronic device 101 provided in this embodiment includes: at least one processor 701 and a memory 702. Optionally, the electronic device 101 also includes a communication component 703. The processor 701, the memory 702 and the communication component 703 are connected via a bus 704.
[0244] During the specific implementation process, at least one processor 701 executes the computer execution instructions stored in the memory 702, so that at least one processor 701 executes the above-mentioned cross-chain interoperable relay chain extension method embodiment.
[0245] The specific implementation process of the processor 701 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0246] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the application may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0247] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (NVM), such as at least one disk storage.
[0248] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.
[0249] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program, wherein the computer program is configured to execute the steps of any of the above-mentioned cross-chain interoperability relay chain extension method embodiments when running.
[0250] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0251] An embodiment of the present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the steps in any of the above-mentioned cross-chain interoperability relay chain extension method embodiments.
[0252] An embodiment of the present application also provides another computer program product, including a non-volatile computer-readable storage medium, the non-volatile computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, implementing the steps in any of the above-mentioned cross-chain interoperable relay chain extension method embodiments.
[0253] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0254] The above is a detailed introduction to a cross-chain interoperable relay chain extension method provided by the present application. This article uses specific examples to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core ideas of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
Claims
1. A cross-chain interoperable relay chain extension method, characterized in that: include: Receive a monitoring request corresponding to any relay domain, and monitor the cross-chain transaction data of the blockchain corresponding to at least one cross-chain gateway in the relay domain based on the monitoring request; The monitoring request is initiated by any cross-chain gateway in the relay domain when it detects that its first average cross-chain load index is greater than or equal to the monitoring threshold; the cross-chain transaction initiated when the first average cross-chain load index is greater than or equal to the monitoring threshold may cause transmission congestion; Calculate a second average cross-chain load index of at least one blockchain group based on the cross-chain transaction data corresponding to each blockchain; the blockchain group includes any two blockchains generating transactions in the relay domain; Calculating a fission index based on the second average cross-chain load index; In response to the fission index being greater than or equal to a preset expansion threshold, determining an initial node of a newly expanded relay chain in the relay domain; Control the initial node to start up to expand a new relay chain in the relay domain; the new relay chain is used to undertake the transmission of part of the cross-chain transactions.
2. The method according to claim 1, characterized in that Monitoring the cross-chain transaction data of the blockchain corresponding to at least one cross-chain gateway in the relay domain based on the monitoring request includes: Based on the monitoring request, monitor and obtain cross-chain transaction data of the corresponding blockchain within a preset time period from at least one cross-chain gateway; The calculating the fission index based on the second average cross-chain load index comprises: Calculate the cross-chain load index of each blockchain group within the preset time period based on each cross-chain transaction data; The second average cross-chain load index is calculated based on the cross-chain load index.
3. The method according to claim 2, characterized in that The monitoring and obtaining the cross-chain transaction data of the corresponding blockchain within a preset time period from at least one cross-chain gateway based on the monitoring request includes: Based on the monitoring request, cross-chain transaction data of the corresponding blockchain within a preset time period is obtained from the smart network card in at least one cross-chain gateway; the smart network card includes a monitoring management unit, and the monitoring management unit is used to monitor the transmission data of the corresponding blockchain; the transmission data includes cross-chain transaction data.
4. The method according to claim 2, characterized in that: The cross-chain transaction data includes each completed transaction sub-delay data and the completed transaction serial number of at least one blockchain group to which the corresponding blockchain belongs; The calculating the cross-chain load index of each blockchain group within the preset time period based on each cross-chain transaction data includes: For each blockchain, respectively calculate the first total delay data corresponding to each blockchain group to which the blockchain belongs within the preset time period; the first total delay data is the sum of the sub-delay data of each completed transaction in the blockchain group to which the blockchain belongs; For each blockchain, respectively calculate the total number of first completed transactions corresponding to each blockchain group to which the blockchain belongs within the preset time period; the first total number of completed transactions is the number of completed transaction serial numbers in the blockchain group to which the blockchain belongs; For each blockchain group, a cross-chain load index of the blockchain group within the preset time period is calculated based on the first total delay data and the first total number of completed transactions of the blockchain group.
5. The method according to claim 4, characterized in that The cross-chain load index includes the second total delay data and the second total number of completed transactions corresponding to the blockchain group; The step of calculating, for each blockchain group, the cross-chain load index of the blockchain group within the preset time period based on the first total delay data and the first total number of completed transactions of the blockchain group, includes: For each blockchain group, the second total delay data within the preset time period is calculated based on the first total delay data corresponding to the blockchain group; there are two first total delay data corresponding to the blockchain group; the second total delay data is the sum of the two first total delay data of the corresponding blockchain; For each blockchain group, the second total number of completed transactions within the preset time period is calculated based on the first total number of completed transactions corresponding to the blockchain group; the first total number of completed transactions corresponding to the blockchain group is two; the second total number of completed transactions is the sum of the two first total numbers of completed transactions of the corresponding blockchain.
6. The method according to claim 2, characterized in that The cross-chain load index includes the second total delay data and the second total number of completed transactions; The calculating the second average cross-chain load index based on the cross-chain load index comprises: For each blockchain group, calculating average delay data based on the second total delay data of the blockchain group; For each blockchain group, the average number of transactions is calculated based on the second total number of completed transactions of the blockchain group; the second average cross-chain load index includes average delay data and the average number of transactions.
7. The method according to claim 6, characterized in that The calculating the fission index based on the second average cross-chain load index comprises: In response to any of the average delay data being greater than a preset delay threshold, calculating an average value of the number of overload delay connections based on the average delay data; In response to any of the average transaction quantities being greater than a preset transaction quantity threshold, calculating an average value of the number of overloaded transaction connections based on the average transaction quantity; The fission index is calculated based on the average value of the overload delay connection number and the average value of the overload transaction connection number; the fission index is used to characterize the degree of fission caused by the average value of the overload delay connection number and the overload transaction connection number.
8. The method according to claim 7, characterized in that Before calculating the average value of the number of overload delay connections based on the average delay data, the method includes: Obtain the first overload delay connection number corresponding to at least one first preset period before the preset time period; the first overload delay connection number is the number of delay blockchain groups corresponding to each of the first preset periods; there is at least one delay blockchain group; each delay blockchain group is a blockchain group whose average delay data in the corresponding first preset period is greater than a preset delay threshold.
9. The method according to claim 8, wherein the calculating the average value of the number of overload delay connections based on the average delay data comprises: Within a preset time period, the number of delays of blockchain groups whose average delay data is greater than a preset delay threshold is calculated, and the number of delays is determined as the corresponding second overload delay connection number; Calculate the third overload delay connection number; the third overload delay connection number is the sum of the first overload delay connection number and the second overload delay connection number corresponding to each delay period; the delay period includes the period corresponding to the preset time period and the first preset period; A first average value is calculated based on the third number of overload delay connections and the number of delay periods; the first average value is the average value of the number of overload delay connections within the delay period.
10. The method according to claim 7, characterized in that Before calculating the average number of overloaded transaction connections based on the average number of transactions, the method includes: Obtain a first overload transaction connection number corresponding to at least one second preset period before the preset time period; the first overload transaction connection number is the number of transaction blockchain groups corresponding to each of the second preset periods; there is at least one transaction blockchain group; each of the transaction blockchain groups is a blockchain group whose average transaction number in the corresponding second preset period is greater than a preset transaction threshold.
11. The method according to claim 10, characterized in that The calculating the average number of overloaded transaction connections based on the average number of transactions includes: Within a preset time period, calculating the number of transactions of a blockchain group whose average number of transactions is greater than a preset transaction threshold, and determining the number of transactions as the corresponding second overload transaction connection number; Calculating a third number of overloaded transaction connections; the third number of overloaded transaction connections is the sum of the first number of overloaded transaction connections and the second number of overloaded transaction connections corresponding to each transaction cycle; the transaction cycle includes the cycle corresponding to the preset time period and the second preset cycle; A second average value is calculated based on the third number of overloaded transaction connections and the number of transaction cycles; the second average value is an average value of the number of overloaded transaction connections within the transaction cycle.
12. The method according to claim 7, characterized in that The calculating the fission index based on the average number of overloaded delay connections and the average number of overloaded transaction connections includes: The average value of the overload delay connection number, the average value of the overload transaction connection number and the total number of connections are input into a preset fission index algorithm to calculate the fission index; the total number of connections is the number of blockchain groups; The preset fission index algorithm is as follows: in, represents the fission index, Indicates the average number of overloaded transaction connections. Indicates the average number of overload delay connections. Indicates the total number of connections. Indicates the preset transaction weight index, Indicates the preset delay weight index.
13. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the relay chain extension method for cross-chain interoperability as described in any one of claims 1 to 12 when executing the computer program.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the cross-chain interoperable relay chain extension method as described in any one of claims 1 to 12.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the relay chain extension method for cross-chain interoperability as described in any one of claims 1 to 12 are implemented.
Citation Information
Patent Citations
Cross-chain transaction process tracking method and device
CN115996175A
Relay chain-based cross-chain method and system, storage medium and electronic equipment
CN118400110A
Relay chain-based cross-chain gateway redundancy switching method and system
CN118827336A
Relay chain cross-chain asynchronous consensus method, readable storage medium and equipment
CN119602928A
Block chain cross-chain transaction method and computer readable storage medium
CN119718623A