Path determination method and device, server and computer program product
By obtaining and evaluating intermediate node information in cross-chain transaction paths in real time, the problem that the existing technology cannot adapt to the complex blockchain environment is solved, and the accuracy of the transaction path determination is improved.
Patent Information
- Application Number
- CN202411535227.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-02-25
AI Technical Summary
The existing technology cannot be applied to complex and changeable blockchain environments, resulting in a decrease in the accuracy of determining cross-chain transaction paths.
By obtaining multiple initial transaction paths of cross-chain transactions, and obtaining the fee information, liquidity information and delay information of each intermediate node in real time, the transaction path is evaluated based on this information to determine the optimal transaction path.
Real-time and accurate evaluation of cross-chain transaction paths is realized, suitable for complex and changeable blockchain environments, and improves the accuracy of transaction path determination.
Smart Images

Figure CN119515376A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of blockchain technology, and in particular, relates to a path determination method, device, server and computer program product. Background Art
[0002] Cross-chain transactions refer to the exchange of assets or data between different blockchain networks. In simple terms, users can transfer assets from one blockchain to another blockchain, or trade between assets on different blockchains. In cross-chain transactions, how to choose the best transaction path among multiple blockchain networks to minimize transaction costs and time delays is one of the keys to cross-chain transactions.
[0003] The existing technology usually determines the final transaction path among various transaction paths determined in advance based on the shortest path algorithm (such as Dijkstra algorithm). However, due to the complex and changeable blockchain environment, the existing technology is not comprehensive enough and cannot be applied to the complex and changeable blockchain environment, which reduces the accuracy of determining the transaction path. Summary of the invention
[0004] The embodiments of the present application provide a path determination method, device, server and computer program product to solve the problem that the prior art is not comprehensive enough, cannot be applied to the complex and changeable blockchain environment, and reduces the accuracy of determining the transaction path.
[0005] In a first aspect, an embodiment of the present application provides a path determination method, including:
[0006] In response to a cross-chain transaction instruction, obtaining a plurality of initial transaction paths from a starting chain to a target chain of the cross-chain transaction;
[0007] Obtaining current fee information, current liquidity information, and current delay information of each intermediate node included in each of the multiple initial transaction paths at the current transaction moment;
[0008] Based on the current fee information, current liquidity information and current delay information of each intermediate node, each transaction path is evaluated respectively to obtain a current evaluation result of each initial transaction path;
[0009] Based on each of the current evaluation results, a target transaction path is determined from the plurality of initial transaction paths.
[0010] Optionally, the evaluating each of the transaction paths based on the current fee information, current liquidity information, and current delay information of each of the intermediate nodes to obtain a current evaluation result of each of the initial transaction paths includes:
[0011] The current fee information, current liquidity information and current delay information of each intermediate node are sequentially input into the path evaluation model for processing to obtain evaluation sub-results of each initial transaction path in different dimensions;
[0012] Based on the evaluation sub-results of each of the initial transaction paths in different dimensions, the current evaluation results of each of the initial transaction paths are obtained.
[0013] Optionally, the evaluating each of the transaction paths based on the current fee information, current liquidity information, and current delay information of each of the intermediate nodes to obtain a current evaluation result of each of the initial transaction paths includes:
[0014] Based on the current fee information of each intermediate node, the total transaction fee of each initial transaction path is calculated;
[0015] Based on the current delay information of each intermediate node, the total transaction time of each initial transaction path is calculated;
[0016] Based on the current liquidity information of each of the intermediate nodes, the liquidity of each of the initial transaction paths is calculated;
[0017] Each of the initial transaction paths is evaluated based on the total transaction cost, total transaction time and liquidity of each of the initial transaction paths to obtain a current evaluation result of each of the initial transaction paths.
[0018] Optionally, the current evaluation result includes total transaction time, total transaction fee, and liquidity; and determining a target transaction path from the plurality of initial transaction paths based on each of the current evaluation results includes:
[0019] Determining the selection priority of each of the initial transaction paths based on the total transaction time, total transaction cost and liquidity of each of the initial transaction paths;
[0020] The initial transaction path with the highest selection priority is determined as the target transaction path.
[0021] Optionally, after determining a target transaction path from the plurality of initial transaction paths based on each of the current evaluation results, the method further includes:
[0022] When executing a cross-chain transaction along the target transaction path, determining a next node corresponding to the cross-chain transaction; the next node is used to represent the node that the cross-chain transaction is about to enter;
[0023] If the target transaction fee of the next node is greater than the historical transaction fee, and / or the target transaction time is greater than the historical transaction time, a first transaction path is determined from the remaining transaction paths, and cross-chain transactions are continued along the first transaction path; the remaining transaction paths refer to multiple initial transaction paths other than the target transaction path; the historical transaction fee specifically refers to the transaction fee of the next node when determining the target transaction path; the historical transaction time specifically refers to the transaction time of the next node when determining the target transaction path.
[0024] Optionally, the multiple initial transaction paths are determined according to the following method:
[0025] Determine the starting chain and target chain of the cross-chain transaction;
[0026] The path from the starting chain to the target chain is searched based on a breadth-first search algorithm to obtain a plurality of initial transaction paths.
[0027] Optionally, after searching the path from the starting chain to the target chain based on the breadth-first search algorithm to obtain a plurality of initial transaction paths, the method further includes:
[0028] Based on the breadth-first search algorithm, determining the initial priority of each of the initial transaction paths;
[0029] Accordingly, determining a target transaction path from a plurality of initial transaction paths based on each of the current evaluation results includes:
[0030] Based on each of the current evaluation results, adjusting the initial priority of each of the initial transaction paths to obtain a target priority of each of the initial transaction paths;
[0031] The initial transaction path with the highest target priority is determined as the target transaction path.
[0032] In a second aspect, an embodiment of the present application provides a path determination device, including:
[0033] A first acquisition unit, configured to acquire, in response to a cross-chain transaction instruction, a plurality of initial transaction paths from a starting chain to a target chain of the cross-chain transaction;
[0034] A second acquisition unit is used to acquire current fee information, current liquidity information and current delay information of each intermediate node included in each of the multiple initial transaction paths at the current transaction moment;
[0035] A first evaluation unit, configured to evaluate each of the transaction paths based on current fee information, current liquidity information, and current delay information of each of the intermediate nodes, to obtain a current evaluation result of each of the initial transaction paths;
[0036] The first determining unit is configured to determine a target transaction path from the plurality of initial transaction paths based on each of the current evaluation results.
[0037] In a third aspect, an embodiment of the present application provides a server, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the path determination method as described in any one of the first aspects above is implemented.
[0038] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the path determination method as described in any one of the above-mentioned first aspects is implemented.
[0039] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program. When the computer program runs on a server, the server can execute any path determination method described in the first aspect.
[0040] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0041] A path determination method provided by an embodiment of the present application obtains multiple initial transaction paths from the starting chain to the target chain of the cross-chain transaction in response to a cross-chain transaction instruction; obtains the current fee information, current liquidity information and current delay information of each intermediate node contained in each of the multiple initial transaction paths at the current transaction moment; evaluates each transaction path based on the current fee information, current liquidity information and current delay information of each intermediate node, and obtains the current evaluation result of each initial transaction path; determines the target transaction path from the multiple initial transaction paths based on each current evaluation result. Compared with the prior art, this method, when performing cross-chain transactions, considers the fee information and delay information of each intermediate node in each transaction path at the transaction moment in real time, and also considers the influence of the liquidity information of each intermediate node on the selection of the final transaction path in real time. Therefore, this method can realize real-time and accurate evaluation of each transaction path, so that it can be applied to complex and changeable blockchain environments, and also improves the accuracy of determining the final transaction path. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. 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.
[0043] Figure 1 is a flowchart of an implementation of a path determination method provided in an embodiment of the present application;
[0044] Figure 2 is a flow chart of an implementation of a path determination method provided by another embodiment of the present application;
[0045] Figure 3 It is a flowchart of searching all possible transaction paths based on a breadth-first search algorithm provided by an embodiment of the present application;
[0046] Figure 4 is a flow chart of an implementation of a path determination method provided in yet another embodiment of the present application;
[0047] Figure 5 is a flow chart of an implementation of a path determination method provided by another embodiment of the present application;
[0048] Figure 6 is a structural diagram of a path determination device provided in an embodiment of the present application;
[0049] Figure 7 It is a schematic diagram of the structure of a server provided in one embodiment of the present application. DETAILED DESCRIPTION
[0050] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0051] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0052] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0053] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0054] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0055] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0056] Currently, in cross-chain transactions, due to the diversity and heterogeneity of blockchain technology, traders need to complete asset transfers and exchanges between different blockchains. This cross-chain transaction faces the following technical problems: First, how to select the optimal transaction path among multiple blockchain networks to minimize transaction costs and time delays. Second, due to differences in asset liquidity and transaction fees between chains, how to dynamically adjust the transaction path to adapt to market changes.
[0057] However, on the one hand, the existing technology is based on the shortest path algorithm (such as Dijkstra algorithm) to determine the final transaction path among various pre-determined transaction paths. This algorithm is usually pre-calculated for a specific transaction network and cannot adapt to market changes in real time. On the other hand, the existing technology is to split the transaction into multiple parts and execute them on different chains, which can theoretically reduce the transaction fees on a single chain. However, this method often leads to the superposition of transaction costs and complex cross-chain operations.
[0058] Therefore, in order to solve the above problems, this method provides a path determination method, which not only does not need to split the transaction into multiple parts, but also can evaluate and optimize multiple transaction paths corresponding to the transaction in real time through real-time market data obtained, so as to obtain the optimal transaction path that conforms to market changes.
[0059] The specific process of the path determination method will be described in detail below.
[0060] See also Figure 1 , Figure 1 This is a flowchart of a path determination method provided in an embodiment of the present application. In the embodiment of the present application, the execution subject of the path determination method is a server. The server includes but is not limited to: desktop computers and computers and other devices.
[0061] like Figure 1 As shown, the path determination method provided in an embodiment of the present application may include S101 to S104, which are described in detail as follows:
[0062] In S101, in response to a cross-chain transaction instruction, a plurality of initial transaction paths from a starting chain to a target chain of the cross-chain transaction are obtained.
[0063] It should be noted that the cross-chain transaction instruction carries the starting chain and target chain of the cross-chain transaction. Therefore, in the embodiment of the present application, when the server detects the cross-chain transaction instruction, it can extract the starting chain and target chain of the cross-chain transaction conducted by the trader from the cross-chain transaction instruction.
[0064] In the embodiment of the present application, each initial transaction path may include at least one intermediate node, wherein any intermediate node is a blockchain.
[0065] In one embodiment of the present application, the server pre-stores all possible transaction paths from different starting chains to different target chains. Therefore, when the server detects the above-mentioned cross-chain transaction instruction, it can obtain multiple initial transaction paths from the starting chain of this cross-chain transaction to the target chain from all possible transaction paths stored in itself based on the starting chain and target chain of this cross-chain transaction.
[0066] In another embodiment of the present application, in order to accurately obtain the possible initial transaction path of this cross-chain transaction, the server can specifically execute the following Figure 2 Steps S201 to S202 are described in detail as follows:
[0067] In S201, the starting chain and the target chain of the cross-chain transaction are determined.
[0068] In S202, a search process is performed on the path from the starting chain to the target chain based on a breadth-first search algorithm to obtain a plurality of initial transaction paths.
[0069] In this embodiment, after determining the starting chain and the target chain of the cross-chain transaction, the server can search and process the path from the starting chain to the target chain based on the breadth-first search algorithm, thereby obtaining all possible transaction paths, that is, multiple initial transaction paths.
[0070] In practical applications, the breadth-first search algorithm (BFS) is a graph algorithm used to traverse a graph or tree data structure. The BFS algorithm starts from the starting node and traverses all nodes in each layer of the graph hierarchically, using a queue to store the nodes to be visited. It can find the shortest path between two points in an unweighted graph.
[0071] The following will be combined Figure 3 The principle of searching for multiple initial transaction paths based on the breadth-first search algorithm is described in detail. Figure 3 It is a flowchart of searching all possible transaction paths based on a breadth-first search algorithm provided by an embodiment of the present application.
[0072] Combination Figure 3 , the server first initializes the queue and initializes the access mapping (such as step S301).
[0073] It should be noted that in a cross-chain transaction environment, each blockchain is regarded as a node, and the link represents the transaction path between different blockchains. Therefore, initializing the queue specifically means: creating a queue and adding the starting chain to the queue. The queue traverses the blockchain hierarchically to ensure that each relevant link can be accessed.
[0074] Initializing the access map specifically means: creating an access map to record the access status of each blockchain, including whether it has been visited and from which link the chain is reached. Initially, the starting chain is marked as visited, and its predecessor chain is set to None. The access map is used to track visited links, calculate the optimal path, and avoid repeated processing.
[0075] Afterwards, the server can detect whether the initialized queue is empty (such as step S302), and when it is detected that the queue is not empty, it can start processing the nodes in the queue; when the server detects that the queue is empty, it means that no related search is required, so the server can end the search at this time (such as step S303).
[0076] Specifically, the process of the server processing nodes in the queue is as follows:
[0077] First, extract nodes from the queue (such as step S304): take out the current chain from the front of the queue and mark it as the chain being processed. This chain is the starting point of the current path optimization.
[0078] Check the target chain (such as step S305): If the current chain is the target chain (i.e., the target blockchain of the cross-chain transaction), then display the final result and return the path (such as step S306). This step confirms that the optimal path has been reached.
[0079] If the current chain is not the target chain, then explore neighbor chains (such as step S307): check all neighbor chains of the current chain, where the neighbor chain refers to the chain directly connected to the current chain.
[0080] Specifically, the server may detect whether each neighbor chain has been visited (such as step S308), and perform the following operations:
[0081] If the neighbor chain has been visited, skip the neighbor chain and continue to visit other neighbor chains (such as step S309);
[0082] If the neighbor chain has not been visited, the neighbor chain is marked as visited (such as step S3010), and the current chain is recorded as the predecessor chain of the neighbor chain (such as step S3011). After that, the neighbor chain is added to the end of the queue (such as step S3012) and waits for subsequent processing.
[0083] After that, the server can continue to repeatedly process other nodes in the queue until the queue is empty.
[0084] Specifically, the server can continue to extract chains from the queue and process them, and repeat the above steps of processing nodes in the queue for the chain until the queue is empty, which indicates that all reachable blockchains have been visited.
[0085] Based on this, the server can obtain the possible transaction paths for this cross-chain transaction, that is, multiple initial transaction paths.
[0086] In S102, the current fee information, current liquidity information and current delay information of each intermediate node included in each of the multiple initial transaction paths at the current transaction moment are obtained.
[0087] In an embodiment of the present application, after determining multiple initial transaction paths of this cross-chain transaction, the server can obtain the current fee information, current liquidity information, and current delay information of each intermediate node contained in each of the multiple initial transaction paths at the current transaction time.
[0088] The current transaction time may be the time when the server detects the cross-chain transaction instruction, or may be any time when the server is executing the cross-chain transaction.
[0089] The current fee information includes the transaction fee of the intermediate node at the current transaction time.
[0090] The current liquidity information includes the amount of assets available to the intermediate node and the transaction depth. Among them, the transaction depth refers to the ability of the intermediate node to withstand large transactions without large fluctuations in the currency price. For example, the transaction depth can be measured by the two indicators of the number of pending orders and the spread. For example, a large number of pending orders and a small spread between adjacent pending orders indicate that the transaction depth of the intermediate node is good.
[0091] It should be noted that high liquidity means that assets can be traded quickly and at a level close to the market price. Interchain liquidity involves the ability to transfer assets between different blockchains.
[0092] The current delay information includes the asset transfer time from the intermediate node to the next node.
[0093] In some possible embodiments, the server may obtain the current fee information, current liquidity information, and current delay information through the interface (API) of each intermediate node or a decentralized liquidity protocol and data aggregation service.
[0094] It can be seen that when the server executes step S102, it does not rely on centralized services or liquidity providers, which complies with the principle of decentralization and improves the transparency and reliability of the cross-chain transaction system.
[0095] In S103, based on the current fee information, current liquidity information and current delay information of each intermediate node, each transaction path is evaluated respectively to obtain a current evaluation result of each initial transaction path.
[0096] In an embodiment of the present application, the server can perform real-time evaluation of each transaction path based on the current fee information, current liquidity information, and current delay information of each intermediate node, thereby obtaining the current evaluation results of each initial transaction path at the current transaction moment.
[0097] The current evaluation results include but are not limited to: the total transaction fee, total transaction time and liquidity of the transaction path. The liquidity is used to describe the liquidity level of each intermediate node in the transaction path.
[0098] In one embodiment of the present application, for any initial transaction path, the server can directly input the current fee information, current liquidity information, and current delay information of each intermediate node corresponding to the initial transaction path into the path evaluation model for processing, thereby obtaining the evaluation sub-results of the initial transaction path in different dimensions. The path evaluation model is obtained by training a pre-built neural network model.
[0099] Based on this, the server can obtain the evaluation sub-results on different dimensions corresponding to each initial transaction path.
[0100] It should be noted that different dimensions include but are not limited to: cost dimension, time dimension and liquidity dimension.
[0101] Afterwards, for any initial transaction path, the server can directly splice the evaluation sub-results of the initial transaction path in different dimensions to obtain the current evaluation result of the initial transaction path. Exemplarily, the current evaluation result can be [evaluation sub-result of the cost dimension, evaluation sub-result of the time dimension, evaluation sub-result of the liquidity dimension].
[0102] It should be noted that the evaluation sub-results can be specific numerical values. For example, the evaluation sub-result of the cost dimension can be the total transaction fee corresponding to the initial transaction path, the evaluation sub-result of the time dimension can be the total transaction time corresponding to the initial transaction path, and the evaluation sub-result of the liquidity dimension can be the liquidity percentage corresponding to the initial transaction path.
[0103] In this embodiment, the path evaluation model can be obtained by training a pre-constructed neural network model based on a preset sample set. Each sample data in the preset sample set includes sample information (the sample information includes the cost information, liquidity information and delay information of each intermediate node of the sample transaction path) and an evaluation matrix corresponding to the sample information. The value of each element in the evaluation matrix is used to represent the evaluation sub-result of the sample transaction path on the dimension corresponding to the element. When training the pre-constructed neural network model, the sample information in each sample data is used as the input of the neural network model, and the evaluation matrix corresponding to the sample information in each sample data is used as the output of the neural network model. Through training, the neural network model can learn the correspondence between all possible sample information and evaluations, and use the trained neural network model as the path evaluation model.
[0104] In some possible embodiments, the path evaluation model may be composed of multiple sub-evaluation models for detecting different dimensions.
[0105] Based on this, in this embodiment, the path evaluation model may include a first sub-evaluation model for detecting the cost dimension, a second sub-evaluation model for detecting the time dimension, and a third sub-evaluation model for detecting the liquidity dimension.
[0106] In another embodiment of the present application, since model training takes a lot of time and requires a lot of historical data, in order to improve the working efficiency of the server, the server can also Figure 4 Steps S401 to S404 shown determine the current evaluation results of each initial transaction path, as detailed below:
[0107] In S401, the total transaction fee of each of the initial transaction paths is calculated based on the current fee information of each of the intermediate nodes.
[0108] In S402, the total transaction time of each of the initial transaction paths is calculated based on the current delay information of each of the intermediate nodes.
[0109] In S403, based on the current liquidity information of each of the intermediate nodes, the liquidity of each of the initial transaction paths is calculated.
[0110] In S404, each of the initial transaction paths is evaluated based on the total transaction fee, total transaction time and liquidity of each of the initial transaction paths to obtain a current evaluation result of each of the initial transaction paths.
[0111] In this embodiment, for any initial transaction path, in combination with S102, the server may sum up the transaction fees of each intermediate node included in the initial transaction path, thereby calculating the total transaction fee of the initial transaction path.
[0112] For any initial transaction path, in combination with S102, the server can sum up the asset transfer time of each intermediate node included in the initial transaction path and the asset transfer time from the starting chain to the first intermediate node, so as to calculate the total transaction time of the initial transaction path.
[0113] For any initial transaction path, in combination with S102, the server can evaluate the current liquidity information of each intermediate node included in the initial transaction path based on the amount of assets that need to be transferred from the starting chain to the target chain, so as to obtain the liquidity of the initial transaction path.
[0114] Based on this, the server can obtain the total transaction fee, total transaction time and liquidity of each initial transaction path.
[0115] Afterwards, the server can compare the total transaction fees of each initial transaction path one by one, thereby determining the level of the total transaction fees of each initial transaction path, and determine the level of the total transaction fees of each initial transaction path as the evaluation sub-result of each initial transaction path in the fee dimension.
[0116] The server may compare the total transaction time of each initial transaction path one by one, thereby determining the length of the total transaction time of each initial transaction path, and determine the length of the total transaction time of each initial transaction path as an evaluation sub-result of each initial transaction path in the time dimension.
[0117] The server may compare the liquidity of each initial transaction path one by one, thereby determining the liquidity of each initial transaction path, and determine the liquidity of each initial transaction path as an evaluation sub-result of each initial transaction path in the liquidity dimension.
[0118] Based on this, for any initial transaction path, the server can directly splice the evaluation sub-results of the initial transaction path in different dimensions to obtain the current evaluation result of the initial transaction path. Exemplarily, the current evaluation result can be [evaluation sub-result of the cost dimension, evaluation result of the time dimension, evaluation sub-result of the liquidity dimension].
[0119] In S104, based on each of the current evaluation results, a target transaction path is determined from the multiple initial transaction paths.
[0120] In an embodiment of the present application, after the server obtains the current evaluation results of each initial transaction path, since each current evaluation result is used to represent the latest transaction cost of its corresponding initial transaction path at the current transaction moment, the server can determine the initial transaction path with the minimum transaction cost from multiple initial transaction paths based on each current evaluation result, and determine the initial transaction path with the minimum transaction cost as the target transaction path.
[0121] In some possible embodiments, when the current evaluation result includes the total transaction time, total transaction fee, and liquidity of the initial transaction path, in order to improve the accuracy of determining the target transaction path, the server may specifically perform the following steps:
[0122] Determining the selection priority of each of the initial transaction paths based on the total transaction time, total transaction cost and liquidity of each of the initial transaction paths;
[0123] The initial transaction path with the highest selection priority is determined as the target transaction path.
[0124] In this embodiment, for any initial transaction path, the server may perform a weighted sum of the total transaction time, total transaction fee, and liquidity of the initial transaction path, thereby calculating a score of the initial transaction path.
[0125] It should be noted that the higher the score, the lower the transaction cost of the initial transaction path corresponding to the score.
[0126] Afterwards, the server may sort the initial transaction paths in descending order of scores to obtain a score order of the initial transaction paths, and directly determine the score order as a selection priority of the initial transaction paths.
[0127] It can be understood that, in the scoring order, the higher the score of the corresponding initial transaction path, the higher the selection priority of the corresponding initial transaction path.
[0128] Based on this, the server can directly select the initial transaction path with the highest priority as the target transaction path.
[0129] In other possible embodiments, when the current evaluation result includes the total transaction time, total transaction fee and liquidity of the initial transaction path, in order to improve the trader experience and meet the actual needs of the trader, the server may also obtain the trader's transaction demand information, and determine the optimal transaction path that meets the trader's needs, i.e., the target transaction path, based on the transaction demand information and the current evaluation results of each initial transaction path.
[0130] In this embodiment, the transaction demand information is used to describe the trader's requirements for the transaction fee, transaction time, and liquidity of this cross-chain transaction.
[0131] Specifically, when the transaction demand information requires the lowest transaction fee, the server can directly determine the initial transaction path with the lowest total transaction fee as the target transaction path; when the transaction demand information requires the shortest transaction time, the server can directly determine the initial transaction path with the shortest total transaction time as the target transaction path; when the transaction demand information requires the highest liquidity, the server can directly determine the initial transaction path with the highest liquidity as the target transaction path.
[0132] It can be seen that this method can determine the optimal transaction path at the current transaction time based on the market data obtained in real time (such as fee information, liquidity information, and delay information), that is, select the initial transaction path with the highest priority, that is, the lowest transaction cost, thereby optimizing the transaction cost and execution efficiency of cross-chain transactions.
[0133] As can be seen from the above, a path determination method provided by an embodiment of the present application obtains multiple initial transaction paths from the starting chain to the target chain of the cross-chain transaction by responding to a cross-chain transaction instruction; obtains the current fee information, current liquidity information and current delay information of each intermediate node contained in each of the multiple initial transaction paths at the current transaction moment; based on the current fee information, current liquidity information and current delay information of each intermediate node, each transaction path is evaluated respectively to obtain the current evaluation result of each initial transaction path; based on each current evaluation result, the target transaction path is determined from the multiple initial transaction paths. Compared with the prior art, when the present method is cross-chain trading, because the fee information and delay information of each intermediate node in each transaction path at the transaction moment are considered in real time, the liquidity information of each intermediate node is also considered in real time. The influence of the selection of the final transaction path, therefore, the present method can realize real-time and accurate evaluation of each transaction path, so that it can be applied to complex and changeable blockchain environments, and also improves the accuracy of determining the final transaction path.
[0134] See also Figure 5 , Figure 5 is a flowchart of a path determination method provided by another embodiment of the present application. Figure 1 Corresponding embodiment, this embodiment may further include S501 to S502 after S104, which are described in detail as follows:
[0135] In S501, when executing a cross-chain transaction along the target transaction path, a next node corresponding to the cross-chain transaction is determined; the next node is used to represent the node that the cross-chain transaction is about to enter.
[0136] In S502, if the target transaction fee of the next node is greater than the historical transaction fee, and / or the target transaction time is greater than the historical transaction time, a first transaction path is determined from the remaining transaction paths, and cross-chain transactions are continued along the first transaction path; the remaining transaction paths refer to multiple initial transaction paths other than the target transaction path; the historical transaction fee specifically refers to the transaction fee of the next node when determining the target transaction path; the historical transaction time specifically refers to the transaction time of the next node when determining the target transaction path.
[0137] In this embodiment, since the market data corresponding to each intermediate node in the target transaction path changes at any time, in order to optimize the transaction cost and / or execution efficiency of this cross-chain transaction, the server can determine the next node corresponding to the cross-chain transaction at this time when executing the cross-chain transaction along the target transaction path. The next node is used to represent the node that the cross-chain transaction is about to enter.
[0138] After that, the server can obtain the latest transaction fee of the next node, i.e., the target transaction fee, and the latest asset transfer time, i.e., the target transaction time, in real time, and compare the target transaction fee with the historical transaction fee, and compare the target transaction time with the historical transaction time. Among them, the historical transaction fee specifically refers to the transaction fee of the next node when determining the target transaction path, and the historical transaction time specifically refers to the transaction time of the next node when determining the target transaction path.
[0139] In this embodiment, when the server detects that the target transaction fee of the next node is greater than the historical transaction fee, and / or the target transaction time is greater than the historical transaction time, it indicates that the transaction fee of the next node has suddenly increased, and / or the asset transfer time of the next node has suddenly increased, so the server can determine the first transaction path from the remaining transaction paths and continue to perform cross-chain transactions along the first transaction path. The remaining transaction paths refer to multiple initial transaction paths other than the target transaction path.
[0140] It should be noted that the server continues to perform cross-chain transactions along the first transaction path specifically means: the server continues to perform cross-chain transactions along the first intermediate node after the current node in the first transaction path until reaching the target chain. Among them, the current node specifically refers to the last intermediate node that has been visited before the above-mentioned next node in the target transaction path.
[0141] In some possible embodiments, when the target transaction fee of the next node is greater than the historical transaction fee, and / or the target transaction time is greater than the historical transaction time, the server may return to execute steps S102 to S104 to obtain the above-mentioned first transaction path.
[0142] From the above, it can be seen that the path determination method provided in this embodiment can monitor the market data (such as transaction fees and transaction time) of the unvisited intermediate nodes in the target transaction path in real time during the execution of the cross-chain transaction, and when it is detected that the above market data does not meet the requirements, the transaction path of this cross-chain transaction can be dynamically adjusted in real time, thereby optimizing the transaction cost and / or execution efficiency of this cross-chain transaction.
[0143] In yet another embodiment of the present application, Figure 2 ,Since multiple initial transaction paths are obtained based on the ,breadth-first search algorithm, and the breadth-first search algorithm gradually ,expands all possible paths hierarchically, it can ensure that the path found is the ,shortest when the target chain is reached for the first time.
[0144] Therefore, after step S202, the server may specifically determine the initial priority of each initial transaction path based on a breadth-first search algorithm.
[0145] In this embodiment, since the length of each initial transaction path can be determined according to the order of search by searching multiple initial transaction paths based on the breadth-first search algorithm, the server can directly determine the order of search results of each initial transaction path as the initial priority of each initial transaction path.
[0146] Exemplarily, assuming that a certain initial transaction path is the third path obtained through searching, that is, the search order of the initial transaction path is the third priority, therefore, the server may determine that the initial priority of the initial transaction path is the third priority.
[0147] It should be noted that the higher the initial priority, the higher the order in which the corresponding initial transaction path is selected.
[0148] Based on this, the server may also perform step S104 according to the following steps, which are described in detail as follows:
[0149] Based on each of the current evaluation results, adjusting the initial priority of each of the initial transaction paths to obtain a target priority of each of the initial transaction paths;
[0150] The initial transaction path with the highest target priority is determined as the target transaction path.
[0151] In this embodiment, the server can adjust the initial priority of each initial transaction path based on each current evaluation result, that is, dynamically adjust the initial priority of each initial transaction path based on the real-time market data of each intermediate node, so as to obtain the target priority of each initial transaction path.
[0152] Afterwards, the server may determine the initial transaction path with the highest target priority as the target transaction path.
[0153] It can be seen from the above that the path determination method provided in this embodiment can support dynamic optimization and adjustment of each initial transaction path to obtain the final target transaction path by real-time collection and analysis of the current evaluation results of each initial transaction path.
[0154] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0155] Corresponding to a path determination method described in the above embodiment, Figure 6 The schematic diagram of the structure of a path determination device provided by an embodiment of the present application is shown. For the convenience of explanation, only the part related to the embodiment of the present application is shown. Figure 6The path determination device 600 includes: a first acquisition unit 61, a second acquisition unit 62, a first evaluation unit 63 and a first determination unit 64. Wherein:
[0156] The first acquisition unit 61 is used to acquire multiple initial transaction paths from the starting chain to the target chain of the cross-chain transaction in response to the cross-chain transaction instruction.
[0157] The second acquisition unit 62 is used to obtain the current fee information, current liquidity information and current delay information of each intermediate node included in each of the multiple initial transaction paths at the current transaction moment.
[0158] The first evaluation unit 63 is used to evaluate each of the transaction paths based on the current fee information, current liquidity information and current delay information of each of the intermediate nodes, and obtain the current evaluation results of each of the initial transaction paths.
[0159] The first determining unit 64 is configured to determine a target transaction path from the plurality of initial transaction paths based on each of the current evaluation results.
[0160] In one embodiment of the present application, the first evaluation unit 63 specifically includes: an input unit and a second determination unit.
[0161] The input unit is used to input the current fee information, current liquidity information and current delay information of each intermediate node into the path evaluation model for processing in turn, so as to obtain evaluation sub-results of each initial transaction path in different dimensions.
[0162] The second determining unit is used to obtain the current evaluation result of each of the initial transaction paths based on the evaluation sub-results of each of the initial transaction paths in different dimensions.
[0163] In one embodiment of the present application, the first evaluation unit 63 specifically includes: a first calculation unit, a second calculation unit, a third calculation unit and a second evaluation unit.
[0164] The first calculation unit is used to calculate the total transaction fee of each of the initial transaction paths based on the current fee information of each of the intermediate nodes.
[0165] The second calculation unit is used to calculate the total transaction time of each of the initial transaction paths based on the current delay information of each of the intermediate nodes.
[0166] The third calculation unit is used to calculate the liquidity of each of the initial transaction paths based on the current liquidity information of each of the intermediate nodes.
[0167] The second evaluation unit is used to evaluate each of the initial transaction paths based on the total transaction cost, total transaction time and liquidity of each of the initial transaction paths, and obtain a current evaluation result of each of the initial transaction paths.
[0168] In one embodiment of the present application, the current evaluation result includes total transaction time, total transaction fee and liquidity; the first determination unit 64 specifically includes: a third determination unit and a fourth determination unit.
[0169] in:
[0170] The third determining unit is used to determine the selection priority of each of the initial transaction paths based on the total transaction time, the total transaction fee and the liquidity of each of the initial transaction paths.
[0171] The fourth determining unit is used to determine the initial transaction path with the highest selection priority as the target transaction path.
[0172] In one embodiment of the present application, the path determination device 600 further includes: a fifth determination unit and an execution unit.
[0173] The fifth determination unit is used to determine the next node corresponding to the cross-chain transaction when executing the cross-chain transaction along the target transaction path; the next node is used to represent the node that the cross-chain transaction is about to enter.
[0174] The execution unit is used to determine a first transaction path from the remaining transaction paths and continue to execute cross-chain transactions along the first transaction path if the target transaction fee of the next node is greater than the historical transaction fee, and / or the target transaction time is greater than the historical transaction time; the remaining transaction paths refer to multiple initial transaction paths other than the target transaction path; the historical transaction fee specifically refers to the transaction fee of the next node when determining the target transaction path; the historical transaction time specifically refers to the transaction time of the next node when determining the target transaction path.
[0175] In one embodiment of the present application, the path determination device 400 further includes: a sixth determination unit and a search unit.
[0176] The sixth determination unit is used to determine the starting chain and the target chain of the cross-chain transaction.
[0177] The search unit is used to search the path from the starting chain to the target chain based on a breadth-first search algorithm to obtain a plurality of the initial transaction paths.
[0178] In one embodiment of the present application, the path determination device 600 further includes: a seventh determination unit; correspondingly, the first determination unit 64 specifically includes: an adjustment unit and an eighth determination unit.
[0179] The seventh determining unit is used to determine the initial priority of each of the initial transaction paths based on the breadth-first search algorithm.
[0180] The adjustment unit is used to adjust the initial priority of each of the initial transaction paths based on each of the current evaluation results to obtain a target priority of each of the initial transaction paths.
[0181] The eighth determining unit is configured to determine the initial transaction path with the highest target priority as the target transaction path.
[0182] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0183] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0184] Figure 7 This is a schematic diagram of the structure of a server provided in an embodiment of the present application. Figure 7 As shown, the server 7 of this embodiment includes: at least one processor 70 ( Figure 7 Only one is shown in the figure) a processor, a memory 71, and a computer program 72 stored in the memory 71 and executable on the at least one processor 70, and when the processor 70 executes the computer program 72, the steps in any of the above-mentioned path determination method embodiments are implemented.
[0185] The server may include, but is not limited to, a processor 70 and a memory 71. Those skilled in the art will appreciate that Figure 7It is only an example of server 7 and does not constitute a limitation on server 7. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components, for example, it may also include input and output devices, network access devices, etc.
[0186] The processor 70 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0187] In some embodiments, the memory 71 may be an internal storage unit of the server 7, such as the memory of the server 7. In other embodiments, the memory 71 may also be an external storage device of the server 7, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the server 7. Further, the memory 71 may also include both an internal storage unit of the server 7 and an external storage device. The memory 71 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program. The memory 71 may also be used to temporarily store data that has been output or is to be output.
[0188] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0189] An embodiment of the present application provides a computer program product. When the computer program product runs on a server, the server can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0190] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying the computer program code to the server, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0191] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0192] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A path determination method, characterized in that: include: In response to a cross-chain transaction instruction, obtaining a plurality of initial transaction paths from a starting chain to a target chain of the cross-chain transaction; Obtaining current fee information, current liquidity information, and current delay information of each intermediate node included in each of the multiple initial transaction paths at the current transaction moment; Based on the current fee information, current liquidity information and current delay information of each intermediate node, each transaction path is evaluated respectively to obtain a current evaluation result of each initial transaction path; Based on each of the current evaluation results, a target transaction path is determined from the plurality of initial transaction paths.
2. The path determination method according to claim 1, characterized in that: Based on the current fee information, current liquidity information and current delay information of each intermediate node, each transaction path is evaluated respectively to obtain the current evaluation result of each initial transaction path, including: The current fee information, current liquidity information and current delay information of each intermediate node are sequentially input into the path evaluation model for processing to obtain evaluation sub-results of each initial transaction path in different dimensions; Based on the evaluation sub-results of each of the initial transaction paths in different dimensions, the current evaluation results of each of the initial transaction paths are obtained.
3. The path determination method according to claim 1, characterized in that: Based on the current fee information, current liquidity information and current delay information of each intermediate node, each transaction path is evaluated respectively to obtain the current evaluation result of each initial transaction path, including: Based on the current fee information of each intermediate node, the total transaction fee of each initial transaction path is calculated; Based on the current delay information of each intermediate node, the total transaction time of each initial transaction path is calculated; Based on the current liquidity information of each of the intermediate nodes, the liquidity of each of the initial transaction paths is calculated; Each of the initial transaction paths is evaluated based on the total transaction cost, total transaction time and liquidity of each of the initial transaction paths to obtain a current evaluation result of each of the initial transaction paths.
4. The path determination method according to claim 1, characterized in that: The current evaluation results include total transaction time, total transaction costs, and liquidity; and determining a target transaction path from a plurality of initial transaction paths based on each of the current evaluation results includes: Determining the selection priority of each of the initial transaction paths based on the total transaction time, total transaction cost and liquidity of each of the initial transaction paths; The initial transaction path with the highest selection priority is determined as the target transaction path.
5. The path determination method according to claim 1, characterized in that: After determining a target transaction path from a plurality of initial transaction paths based on each of the current evaluation results, the method further includes: When executing a cross-chain transaction along the target transaction path, determining a next node corresponding to the cross-chain transaction; the next node is used to represent the node that the cross-chain transaction is about to enter; If the target transaction fee of the next node is greater than the historical transaction fee, and / or the target transaction time is greater than the historical transaction time, a first transaction path is determined from the remaining transaction paths, and cross-chain transactions are continued along the first transaction path; the remaining transaction paths refer to multiple initial transaction paths other than the target transaction path; the historical transaction fee specifically refers to the transaction fee of the next node when determining the target transaction path; the historical transaction time specifically refers to the transaction time of the next node when determining the target transaction path.
6. The path determination method according to any one of claims 1 to 5, characterized in that: The multiple initial transaction paths are determined according to the following method: Determine the starting chain and target chain of the cross-chain transaction; The path from the starting chain to the target chain is searched based on a breadth-first search algorithm to obtain a plurality of initial transaction paths.
7. The path determination method according to claim 6, characterized in that: After the path from the starting chain to the target chain is searched and processed based on the breadth-first search algorithm to obtain a plurality of initial transaction paths, the method further includes: Based on the breadth-first search algorithm, determining the initial priority of each of the initial transaction paths; Accordingly, determining a target transaction path from a plurality of initial transaction paths based on each of the current evaluation results includes: Based on each of the current evaluation results, adjusting the initial priority of each of the initial transaction paths to obtain a target priority of each of the initial transaction paths; The initial transaction path with the highest target priority is determined as the target transaction path.
8. A path determination device, characterized in that: include: A first acquisition unit, configured to acquire, in response to a cross-chain transaction instruction, a plurality of initial transaction paths from a starting chain to a target chain of the cross-chain transaction; A second acquisition unit is used to acquire current fee information, current liquidity information and current delay information of each intermediate node included in each of the multiple initial transaction paths at the current transaction moment; A first evaluation unit, configured to evaluate each of the transaction paths based on current fee information, current liquidity information, and current delay information of each of the intermediate nodes, to obtain a current evaluation result of each of the initial transaction paths; The first determining unit is configured to determine a target transaction path from the plurality of initial transaction paths based on each of the current evaluation results.
9. A server comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the path determination method according to any one of claims 1 to 7 is implemented.
10. A computer program product, characterized in that The method comprises a computer program, which implements the path determination method according to any one of claims 1 to 7 when being executed.
Citation Information
Patent Citations
Joint cloud computing environment value exchange-oriented cross-chain communication method
CN108009811A
Cross-chain transaction routing node selection method and device
CN113709037A
Method and device for selecting transaction path based on block chain channel
CN114372881A
System and Method for Blockchain Automatic Tracing of Money Flow Using Artificial Intelligence
US20220067738A1
Cited By
Path planning method, electronic equipment, storage medium and program product
CN120238370A