Block chain cross-link routing system and method based on main-sub-chain architecture

The LSTM-based cross-chain routing system addresses the inefficiencies in existing blockchain networks by dynamically predicting network states and optimizing routes, reducing transmission delays and improving system performance.

CN120321164APending Publication Date: 2025-07-15CHINA IND INTERNET RES INST
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510270120.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-07
Publication Date
2025-07-15

AI Technical Summary

Technical Problem

The existing cross-link routing algorithm lacks intelligence and flexibility in the blockchain system with the main sub-chain architecture, resulting in an increase in cross-chain transaction delays, making it difficult to make optimal routing in the case of large data volumes.

Method used

A cross-link routing system based on the LSTM model is adopted to collect cross-chain transaction characteristics and network status data in real time through the data collection module, and route prediction is used to use the LSTM model, and the model is regularly evaluated and optimized through the model update and maintenance module to ensure that the model adapts to the dynamic changes of the blockchain network.

Benefits of technology

It realizes dynamic, efficient and secure cross-link routing selection, reduces large-scale data cross-chain latency, and improves the overall performance and user experience of the blockchain system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120321164A_ABST
    Figure CN120321164A_ABST
Patent Text Reader

Abstract

The invention discloses a block chain cross-link routing system and method based on a main-sub-chain architecture, and relates to the technical field of block chains. The system comprises a data collection module, a route selection decision module and a model updating and maintaining module. The data collection module is used for collecting cross-chain transaction data and network state data in real time; the route selection decision module dynamically predicts the transmission delay of the cross-link route by using an LSTM model, and selects an optimal path to improve the cross-link efficiency; and the model updating and maintaining module regularly evaluates the performance of the model and optimizes the model through incremental learning or full-amount training to adapt to the dynamic change of the block chain network. The method comprises the processes of model training, real-time routing decision making, cross-chain execution, model automatic evaluation and updating and the like. According to the invention, in combination with the characteristics of the main and sub-chain architecture, through the time sequence prediction capability of the LSTM model and the dynamic model maintenance mechanism, efficient and intelligent cross-chain routing selection is realized, the cross-chain delay is significantly reduced, and the throughput and the cooperation efficiency of the block chain system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of blockchain, and specifically discloses a blockchain cross-chain routing selection system and method based on a master-slave chain architecture. Background Art

[0002] The blockchain system with a master-slave chain architecture has great application value in the industrial field. In this architecture, the master chain serves as a hub, connecting heterogeneous business sub-chains with different functions and characteristics. Each sub-chain can provide customized services for various links of industrial production according to its own advantages, thus building a complete and efficient industrial data processing system to meet the requirements for data security, collaborative processing, and shared circulation in industrial production.

[0003] In this architecture, the interoperability and data sharing between business sub-chains are mainly achieved through cross-chain with the master chain as a relay. As the amount of cross-chain transaction data between business sub-chains continues to climb, the requirement for network latency is becoming increasingly strict, and efficient cross-chain routing selection has become a key issue. However, existing cross-chain routing selection schemes have many deficiencies. The routing algorithms designed for traditional network environments have the core principle of efficiently forwarding IP data packets through routers. In the blockchain network based on the master-slave chain architecture, its cross-chain technology mainly involves the selection of cross-chain relay gateways in routing, which is quite different from traditional network routing selection scenarios. And existing cross-chain routing selection algorithms mostly rely on static network topology information or simple heuristic rules, which can meet the requirements when the cross-chain scale is small and the network environment is relatively stable. But as the cross-chain scale increases, due to its lack of flexibility, it often leads to a lack of intelligence in cross-chain routing, and then causes a significant increase in transmission delay. In addition, although there are some dynamic shortest path cross-chain algorithms that consider the changes in network state to a certain extent, they lack the ability to accurately predict future network states, making it difficult to make the optimal routing selection when facing large amounts of cross-chain transactions. Therefore, in the blockchain system with a master-slave chain architecture, how to accurately predict information such as the routing network traffic, link state, and data transmission time of cross-chain relay gateways, and combine the actual size of cross-chain data to select the most suitable cross-chain data transmission route has become a technical problem to be solved urgently. Summary of the Invention

[0004] The purpose of the present invention is to address the above deficiencies and propose a blockchain cross-chain routing selection system and method based on a master-slave chain architecture. By predicting and comprehensively analyzing the routing-related information of cross-chain relay gateways, and combining factors such as the characteristics of the blockchain with a master-slave chain architecture and the size of cross-chain transaction data, dynamic, efficient, and secure cross-chain routing selection is achieved.

[0005] The present invention specifically adopts the following technical solutions:

[0006] A blockchain cross-chain routing selection system based on the master-slave chain architecture, including a data collection module, a routing selection decision module, and a model update and maintenance module:

[0007] The data collection module is deployed at the cross-chain relay network node of the main chain and is used to collect cross-chain transaction feature data and network status data in real time, providing a data basis for the training and inference of the LSTM model; the cross-chain transaction feature data includes the transaction initiation time, the size of the cross-chain transaction data, the source chain identifier, and the target chain identifier; the network status data includes the node load rate, the bandwidth utilization rate, and the adjacency matrix of the cross-chain relay gateway connection relationship;

[0008] The routing selection decision module is deployed at the cross-chain relay network node of the main chain and includes an LSTM model, which is used to receive the real-time data of the data collection module, generate feature vectors and input them into the LSTM model, predict the transmission delay of the cross-chain route, and select the optimal cross-chain route; after the cross-chain transaction is completed, the routing selection decision module will also write the cross-chain transaction feature data, network status data, input and output data of the LSTM model, and cross-chain execution result data of this cross-chain into the time series database for subsequent model iteration;

[0009] The model update and maintenance module is deployed on an independent server, constructs a life cycle management mechanism for the LSTM model, realizes the regular evaluation of the LSTM model through automated orchestration, and optimizes the model through incremental learning or full-scale training.

[0010] Preferably, it further includes a time series database for storing cross-chain transaction feature data, network status data, input and output data of the LSTM model, and cross-chain execution result data for model training and iteration.

[0011] Preferably, the input data of the LSTM model includes:

[0012] The normalized transaction timestamp and the logarithmic transformation value of the transaction data size;

[0013] One-hot encoding vectors of the source chain identifier and the target chain identifier;

[0014] The normalized node load rate and bandwidth utilization rate;

[0015] The flattened and normalized cross-chain relay gateway network topology diagram;

[0016] The output data is the predicted values of the data transmission delays of all routes.

[0017] A blockchain cross-chain routing selection method, which is implemented by the system as described above, including the following steps:

[0018] Step 1: Training of the original LSTM model; collect historical cross-chain transaction data of the blockchain system with the master-slave chain architecture, and construct a cross-chain routing prediction model;

[0019] Step 2: Model deployment and system initialization; deploy the trained LSTM model on the cross-chain relay gateway and start the relevant modules of the system;

[0020] Step 3: Cross-chain routing selection; when a cross-chain transaction request arrives at the cross-chain relay gateway, start the LSTM model for routing prediction and select the route with the minimum delay;

[0021] Step 4: Routing information synchronization and cross-chain execution; the cross-chain relay gateway broadcasts the optimal cross-chain routing information through the main chain consensus mechanism, and each gateway collaborates to complete the cross-chain transaction;

[0022] Step 5: Monitoring of cross-chain transaction results; after the cross-chain transaction is completed, the routing selection decision module records the actual routing execution result and transmission delay duration of this cross-chain transaction, and writes them into the time series database together with the input and output data of the LSTM model;

[0023] Step 6: Model update and maintenance; the model update and maintenance module constructs an automated life cycle management mechanism for the LSTM model, and performs operations such as model performance evaluation, model optimization update, and new model deployment at a fixed time every day to ensure that the model always adapts to the constantly changing blockchain network environment.

[0024] Preferably, Step 3 includes the following steps:

[0025] Step 3.1: Real-time data acquisition; when a cross-chain transaction request arrives at the main chain cross-chain relay gateway, the routing selection decision module obtains cross-chain transaction-related information and real-time network status information through the data acquisition module;

[0026] Step 3.2: Feature generation; generate feature data according to the real-time acquired information by the same feature engineering method as the training data;

[0027] Step 3.3: Routing performance prediction; input the generated feature vector into the trained LSTM model, predict the data transmission delay of all routes, and select the route with the minimum delay as the optimal route.

[0028] Preferably, Step 6 includes the following steps:

[0029] Step 6.1: Model evaluation; perform the following evaluation steps at a specific time every day:

[0030] 1. The change in the number of blockchain nodes exceeds the preset ratio;

[0031] 2. The mean squared error, mean absolute error, and root mean squared error between the model prediction delay value and the actual delay value of the newly added cross-chain transactions on the same day, and any one of the indicators exceeds the preset threshold;

[0032] When any of the above conditions is met, proceed to step 6.2; otherwise, end this update and maintenance process.

[0033] Step 6.2: Model fine-tuning; preprocess the newly added cross-chain transaction data on the same day and perform feature engineering to generate feature data in the same format as the training set; use the new data to fine-tune the original model, freeze the parameters of the first 3 layers of the LSTM layer, and adjust other parameters; after fine-tuning, evaluate the model using the validation set. If any one of the mean squared error, mean absolute error, and root mean squared error still exceeds the preset threshold in step 6.1, proceed to step 6.3; if all indicators are lower than the corresponding thresholds, proceed to step 6.4;

[0034] Step 6.3: Model retraining; merge the historical cross-chain transaction data and the new data, re-perform the data cleaning and feature engineering preprocessing steps, and train the LSTM model; after training is completed, proceed to step 6.4;

[0035] Step 6.4: Model redeployment; push the updated or retrained new model to each cross-chain relay gateway and replace the old model in the routing selection decision module.

[0036] The present invention has the following beneficial effects:

[0037] By using the LSTM model to analyze and predict the historical cross-chain transaction data, the present invention can accurately predict the dynamic changes of the future blockchain network, and use the actual cross-chain transaction data volume as the model input, which can provide a real-time and dynamic routing selection strategy for cross-chain transactions, improving the accuracy and rationality of cross-chain routing selection.

[0038] By deploying a data collection module at the cross-chain relay gateway, cross-chain transaction data can be comprehensively and deeply collected, providing rich and accurate data support for the LSTM model and improving the model prediction accuracy.

[0039] Through the model evaluation and optimization mechanism, the performance of the model is continuously improved, making the routing selection method more adaptable to different blockchain network environments and transaction requirements.

[0040] The deployment scheme of the system is closely combined with the characteristics of the master-slave chain architecture blockchain system for the routing selection method. Each module works together to form an efficient and intelligent cross-chain routing selection system, effectively reducing the cross-chain delay of large-scale data and improving the overall performance and user experience of the blockchain system. Description of the Drawings

[0041] Figure 1Block diagram of a cross-chain routing selection system for a blockchain based on a master-slave chain architecture;

[0042] Figure 2 Block diagram of a cross-chain routing selection method for a blockchain based on a master-slave chain architecture. Specific implementation manners

[0043] The following further describes the specific implementation manners of the present invention in conjunction with the accompanying drawings and specific embodiments:

[0044] In conjunction with Figure 1 , a cross-chain routing selection system for a blockchain based on a master-slave chain architecture includes a data collection module, a routing selection decision module, and a model update and maintenance module.

[0045] In the master-slave chain architecture, the master chain serves as a first-level node, responsible for chain group node management, cross-chain data scheduling, and digital asset anchoring, and realizing penetration monitoring and management of blockchain services and networks. The slave chain is mainly responsible for the implementation of specific business scenarios, completing the function of uploading end-user data to the chain, and providing data security isolation and trusted operation of business activities.

[0046] Each node of the master chain will deploy a cross-chain relay gateway. The cross-chain relay gateway shields the technical implementation differences at the bottom layer of heterogeneous slave chains, and realizes trusted cross-chain contract interoperability and data transfer. The cross-chain relay gateway defines a unified cross-chain protocol, stipulates the consistency of the data structure and operation objects of cross-chain transactions, defines the life cycle of cross-chain transactions between different heterogeneous blockchains, and provides a consistent call interface to the upper-layer cross-chain applications, allowing heterogeneous blockchains to perform unified cross-chain operations through the master chain without changing the underlying structure.

[0047] The slave chain realizes interoperability with other slave chains through the cross-chain relay gateway of the master chain. Each slave chain will connect to a cross-chain relay gateway of the master chain and use the master chain relay to complete cross-chain operations.

[0048] The data collection module is deployed on the cross-chain relay gateway of the master chain, and is used to collect cross-chain transaction feature data and network status data at the macro level in the blockchain network, providing a data basis for the training and inference of the LSTM model (Long Short-Term Memory long short-term memory network). The collected cross-chain transaction feature data includes the transaction initiation time, the size of cross-chain transaction data, the source chain identifier, and the target chain identifier; the network status data includes the node load rate, the bandwidth utilization rate, and the adjacency matrix of the cross-chain relay gateway connection relationship.

[0049] The routing decision module is deployed at the cross-chain relay network node and realizes the prediction of cross-chain transaction routing through the LSTM model. The gating mechanism of the LSTM model can effectively process complex time series data such as transaction information conversion, network status information, and data transmission delays of each chain during the cross-chain process, and capture the long-term dependence relationship of cross-chain transaction data in the time dimension. In the face of a complex blockchain network environment with unstable network traffic and fast-changing link states, the LSTM model can continuously learn and adjust its prediction, maintain a high prediction accuracy, and provide a more accurate and efficient routing selection for cross-chain transactions. When a cross-chain transaction arrives at the gateway, the routing decision module obtains the cross-chain transaction feature data and network status data from the data collection module, converts them into feature vectors, and inputs them into the trained LSTM model. After model inference and analysis, the optimal cross-chain route is selected. After the cross-chain transaction is completed, this module will also write the cross-chain transaction information, the input and output data of the LSTM model, and the cross-chain execution result data into the time series database for subsequent model iteration.

[0050] The model update and maintenance module is deployed on an independent server, constructs an automated life cycle management mechanism for the LSTM model, and realizes regular model evaluation, fine-tuning, retraining, etc. through orchestration to ensure that the model always maintains a high prediction accuracy.

[0051] The model update and maintenance module will obtain all the cross-chain transaction data of the day from the time series database every day (usually in the early morning to reduce business impact). The data includes the cross-chain transaction feature data (transaction initiation time, cross-chain transaction data size, source chain identifier, target chain identifier) of each cross-chain transaction, network status data (node load rate, bandwidth utilization rate, adjacency matrix of the cross-chain relay gateway connection relationship), and cross-chain result data (cross-chain routing transmission path, cross-chain transmission delay time). It evaluates the model performance. If the preset standard is not met, it will start fine-tuning or retraining and deploy the new model to the system.

[0052] The time series database is mainly used to store various data related to cross-chain transactions and network status, specifically including cross-chain transaction feature data, network status data, input and output data of the LSTM model, and cross-chain execution result data. The blockchain network has a high degree of dynamism, and data such as the occurrence frequency of cross-chain transactions and network status indicators (such as node load rate, bandwidth utilization rate, adjacency matrix of the cross-chain relay gateway connection relationship) will change continuously over time. The time series database is specifically optimized for time series data and can efficiently process and store these time-varying data. In addition, the time series database supports data query and analysis according to time range, which plays an important role in the model training and evaluation of the present invention based on historical data.

[0053] Combined Figure 2, a blockchain cross-chain routing selection method based on a master-subchain architecture, using the system as described above, includes the following steps:

[0054] Step 1: Original LSTM model training. Collect historical cross-chain transaction data of the blockchain system and build a cross-chain routing prediction model.

[0055] Step 1.1: Data collection. Before the model is deployed, the system runs for a period of time and enters the data collection phase. In this phase, the data collection module on the cross-chain relay gateway is started to collect cross-chain transaction information in the blockchain network, including transaction initiation time, cross-chain transaction data size, source chain and target chain identification and other characteristic data, as well as node load rate, bandwidth utilization, cross-chain relay gateway connection relationship and other network status data. At the same time, the routing decision module does not activate the model-based prediction function for the time being, and only records the cross-chain execution results, such as the actual cross-chain routing transmission path and the corresponding cross-chain transmission delay time. All collected data will be stored in the time series database to provide necessary data support for subsequent model training. The details are as follows:

[0056]

[0057] Step 1.2: Data preprocessing: Get historical data from the time series database for cleaning.

[0058] Step 1.2.1: First, check the integrity of the data, and mark and delete the data records that are missing key information (such as transaction initiation time, source chain identifier, target chain identifier, transmission delay, etc.).

[0059] Step 1.2.2: For duplicate data records, identify and delete them by comparing transaction hash values.

[0060] Step 1.2.3: Check data such as node load rate and network bandwidth utilization, and remove abnormal data from the data set.

[0061] Step 1.3: Feature engineering. Perform feature engineering to convert the original data into time series features suitable for LSTM input and perform normalization.

[0062] Step 1.3.1: Convert the transaction initiation time T to a timestamp t, and then normalize the timestamp to obtain the normalized time feature t norm .

[0063] Step 1.3.2: Encode the chain identifier using one-hot encoding. Assume that there are N different chain identifiers in the blockchain system. For the source chain identifier S src , create an all-zero vector V of length N src , and then the corresponding S srcSet its position to 1. For example, if S src is the third type of chain identifier, then V src = [0, 0, 1, 0,..., 0]. Similarly, perform the same encoding operation on the target chain identifier S dst .

[0064] Step 1.3.3: Normalize continuous data such as the node load rate L and the network bandwidth utilization rate B to obtain the normalized node load rate feature L inorm and the network bandwidth utilization rate feature B inorm .

[0065] Step 1.3.4: For the cross-chain transaction data size, perform logarithmic transformation and normalization, where S is the original transaction data size, S min and S max are the minimum and maximum values of the transaction data size respectively.

[0066] Step 1.3.5: Flatten and normalize the adjacency matrix of the cross-chain relay gateway connection relationship of the main chain to obtain the network topology feature A flat .

[0067] Step 1.4: Construct the LSTM model.

[0068] Step 1.4.1: Dataset division. Divide the preprocessed data in chronological order. The first 70% of the data is used as the training set D train , for training the model; the next 15% of the data is used as the validation set D val , for adjusting the hyperparameters of the model and monitoring the performance of the model during training to prevent overfitting; the last 15% of the data is used as the test set D test , for evaluating the final performance of the model.

[0069] Step 1.4.2: Generation of LSTM Model. Construct an LSTM model that includes an input layer, an LSTM layer, a fully connected layer, and an output layer. The input layer receives the preprocessed feature data, and its dimension is determined according to the results of feature engineering. Suppose that after feature engineering, the transaction initiation time is a 1-dimensional feature after normalization; the one-hot encoded vectors of the source chain identifier and the target chain identifier. If there are N different chain identifiers in the blockchain system, then the dimension of the one-hot encoded vector of each chain identifier is N, so the source chain identifier and the target chain identifier together occupy 2N dimensions; the cross-chain transaction data transmission delays on each chain are processed to be M dimensions (M is the number of involved chains); the node load rates and network bandwidth utilization rates of each chain are each K dimensions after normalization; the adjacency matrix of the cross-chain relay gateway connection relationship is 1 dimension after flattening and normalization; the cross-chain transaction data size is 1 dimension after logarithmic transformation and normalization. Then the dimension D of the input layer can be expressed as D = 1 + 2N + M + 2K + 1 + 1.

[0070] The LSTM layer of the model is responsible for processing time series features, and the fully connected layer is responsible for further processing the output of the LSTM layer. In terms of the number of units in the LSTM layer and the number of neurons in the fully connected layer, use a random search algorithm. For example, for the LSTM layer it is [16, 256], and for the fully connected layer it is [8, 128]. Each time, randomly draw a set of parameters from the range to construct a model, train it on the training set and evaluate it on the validation set, and find the number of LSTM units and the number of neurons in the fully connected layer with relatively small mean squared error (MSE), mean absolute error (MAE), and root mean squared error (RMSE) according to the evaluation metrics.

[0071] The output layer of the model is responsible for outputting the predicted value of the cross-chain transaction data transmission delay.

[0072] Step 1.4.3: Division of Training Set. Divide the data in the training set D train into multiple batches according to batch_size (the number of samples input to the model each time).

[0073] Step 1.4.4: Define the loss function as mean squared error MSE:

[0074]

[0075] where N is the number of training samples, y i is the actual large-scale data transmission delay value, is the predicted value.

[0076] Use the stochastic gradient descent (SGD) algorithm to optimize the model parameters, and the parameter update formula is:

[0077]

[0078] where θt is the model parameter at the current time step, α is the learning rate, is the gradient of the loss function with respect to the model parameter.

[0079] Step 1.4.5: After each batch of data is input into the model, perform forward propagation to calculate the prediction results, then calculate the loss value according to the loss function, calculate the gradient through backpropagation, and finally update the model parameters using the SGD algorithm.

[0080] Step 1.4.6: During the training process, every 10 rounds, use the validation set D val to evaluate the performance of the model and calculate the loss on the validation set. If the loss on the validation set does not decrease for 5 consecutive rounds, it is considered that the model has converged and stop training.

[0081] Step 1.5: Model evaluation. Use the test set D test to evaluate the trained LSTM model. Input the test set data into the model to obtain the predicted cross-chain transaction data transmission delay value. Calculate multiple error metrics, including mean squared error (MSE), mean absolute error (MAE), and root mean squared error (RMSE). If the error of the model on the test set exceeds the preset threshold (for example, MSE > 0.5, MAE > 0.3, or RMSE > 0.7), optimize the model through the following methods: 1) Adjust the model structure, such as increasing the number of LSTM units, increasing the number of LSTM layers, or adjusting the number of neurons in the fully connected layer. 2) Re-perform feature engineering, try to extract more effective features or combine existing features. 3) Adjust the training parameters, such as learning rate, batch_size, etc.

[0082] Step 2: Model deployment and system initialization. Deploy the trained LSTM model on the cross-chain relay gateway. Start the data collection module and the routing selection decision module on the cross-chain relay gateway. Configure and start the model update and maintenance module.

[0083] Step 3: Cross-chain routing selection. When a cross-chain transaction request arrives at the cross-chain relay gateway, start the routing selection process.

[0084] Step 3.1: Real-time data acquisition. When a cross-chain transaction request arrives at the main-chain cross-chain relay gateway, the routing selection decision module is immediately triggered to start. First, through the data collection module, obtain cross-chain transaction related information, including the source chain identifier the target chain identifier the size of the cross-chain transaction data, etc. At the same time, obtain real-time network status information, including the node load rate L of each chain new the network bandwidth utilization rate B new the adjacency matrix A of the cross-chain relay gateway connection relationship newetc. This information will be used to generate the feature data required for the prediction model.

[0085] Step 3.2: Feature Generation. Generate feature data according to the real-time acquired information using the same feature engineering method as the training data.

[0086] Convert the current transaction initiation time into a timestamp and normalize it to obtain t newnorm .

[0087] Perform one-hot encoding on the source chain identifier and the target chain identifier to obtain the corresponding one-hot encoding vectors and

[0088] Normalize the node load rate L new and the network bandwidth utilization rate B new to obtain L newnorm and B newnorm .

[0089] Perform logarithmic transformation and normalization on the transaction data size to obtain S newnorm .

[0090] Flatten and normalize the adjacency matrix of the cross-chain relay gateway connection relationship to obtain A newflat .

[0091] Combine the above features into a feature vector as the input of the model.

[0092] Step 3.3: Routing Performance Prediction.

[0093] Input the generated feature vector into the trained LSTM model to predict the data transmission delay of different routes. For each possible cross-chain route r j (j = 1, 2,..., k, where k is the number of possible routes), make predictions to obtain the predicted delay value D j of this route. Select the route with the minimum delay as the optimal route.

[0094] Step 4: Routing Information Synchronization and Cross-chain Execution. The cross-chain relay gateway broadcasts the determined optimal cross-chain routing information to the relevant cross-chain gateways through the main chain consensus mechanism to ensure the accurate and consistent transmission of routing information. The intermediate gateway coordinates the transfer of data between gateways according to the routing information to ensure the smoothness of the data transmission path. Through the synchronization of routing information, each cross-chain relay gateway works together to complete the cross-chain transaction process.

[0095] Step 5: Monitoring of Cross-chain Transaction Results. After the cross-chain transaction is completed, the routing selection decision module will record the actual routing execution results of this cross-chain transaction, including information such as the specific gateway nodes through which the data passes and the time points when each node processes the data, and record the actual transmission delay data of this cross-chain transaction, obtain the data transmission delays on each cross-chain relay gateway and the total duration from the source chain initiating the transaction to the target chain receiving the data, and write them together with the input and output data of the LSTM routing prediction model into the time series database for subsequent model iteration.

[0096] Step 6: Model Update and Maintenance. Build an automated lifecycle management mechanism for the model, and perform operations such as model performance evaluation, model optimization and update, and new model deployment at a fixed time every day to ensure that the model always adapts to the ever-changing blockchain network environment.

[0097] Step 6.1: Model Evaluation. At a specific time every day (usually selected in the early morning to reduce the impact on normal business), the system will automatically perform LSTM model evaluation to ensure the accuracy and applicability of the model. The evaluation is mainly based on the following two main aspects:

[0098] 1. Monitoring of Node Quantity Changes: The system will first check whether there are significant changes in the number of nodes in the blockchain network. Specifically, if the change in the number of blockchain nodes on the same day exceeds the preset ratio (such as the number of newly added / offline nodes > 10%), it is considered that such a change may affect the routing and processing efficiency of cross-chain transactions. In this case, it is necessary to re-optimize the currently used prediction model to be applicable to the new network configuration.

[0099] 2. Model Performance Evaluation: Pull all the newly added cross-chain transaction data on the same day from the time series database, and compare the difference between the delay time predicted by the model and the actually occurred delay time. Three error metrics are used for comprehensive evaluation: Mean Squared Error (MSE), Mean Absolute Error (MAE), and Root Mean Squared Error (RMSE). If any of the error metrics exceeds the preset safety threshold (for example, MSE > 0.5, MAE > 0.3, RMSE > 0.7), this indicates that the current model may have certain limitations or risks of being outdated and cannot accurately reflect the latest cross-chain transaction characteristics and network status.

[0100] Once any of the above conditions is met, that is, the change in the number of nodes exceeds the set ratio or any one of the error metrics exceeds its corresponding threshold, the system will enter the model fine-tuning process to further adjust and optimize the model; otherwise, this update and maintenance process will be regarded as completed.

[0101] Step 6.2: Model Fine-tuning. When the model needs to be updated, the model update and maintenance module first adopts an incremental learning strategy. First, preprocess the incremental data of the day and perform feature engineering to generate feature data in the same format as the training set. Then, use the new data to fine-tune the original model. Freeze the parameters of the first 3 layers of the LSTM layer and only fine-tune the last 2 layers and the fully connected layer to avoid forgetting historical patterns. Adjust the parameters of the model through the backpropagation algorithm so that the model can better adapt to the new data distribution. After fine-tuning, use the validation set to evaluate the model again. If the evaluation metrics still exceed the threshold, start the model retraining process; if the evaluation metrics meet the requirements, it indicates that the performance of the fine-tuned model meets the standard, and it can enter the model redeployment process.

[0102] Step 6.3: Model Retraining. Merge the historical cross-chain transaction data and the new data, and re-perform the data cleaning and feature engineering preprocessing steps to ensure the quality and standardization of the data. Subsequently, divide the merged data into a training set, a validation set, and a test set according to the ratio of 70%:15%:15%. Use the newly generated training set to retrain the LSTM model. By continuously adjusting the model parameters, the model can fully learn the features and patterns in the data. After training, enter the model redeployment process.

[0103] Step 6.4: Model Redeployment. Push the new model after update or retraining to each cross-chain relay gateway and replace the old model in the routing selection decision module. Ensure that the new model can be applied to the cross-chain routing selection decision process in a timely and accurate manner, providing a more accurate and efficient routing scheme for cross-chain transactions.

[0104] Of course, the above description is not a limitation of the present invention, and the present invention is not limited to the above examples. Changes, modifications, additions, or substitutions made by those skilled in the art within the scope of the essence of the present invention should also fall within the protection scope of the present invention.

Claims

1. A cross-chain routing selection system based on the master-slave chain architecture, comprising a data collection module, a routing selection decision module, and a model update and maintenance module, characterized in that: The data collection module is deployed at the cross-chain relay network node of the main chain and is used to collect cross-chain transaction feature data and network status data in real time, providing a data basis for the training and inference of the LSTM model; the cross-chain transaction feature data includes the transaction initiation time, the size of the cross-chain transaction data, the source chain identifier, and the target chain identifier; the network status data includes the node load rate, the bandwidth utilization rate, and the adjacency matrix of the cross-chain relay gateway connection relationship; The routing selection decision module is deployed at the cross-chain relay network node of the main chain and includes an LSTM model, which is used to receive the real-time data of the data collection module, generate feature vectors and input them into the LSTM model, predict the transmission delay of the cross-chain route, and select the optimal cross-chain route; After the cross-chain transaction is completed, the routing selection decision module will also write the cross-chain transaction feature data, network status data, input and output data of the LSTM model, and cross-chain execution result data of this cross-chain into the time series database for subsequent model iteration; The model update and maintenance module is deployed on an independent server, constructs a life cycle management mechanism for the LSTM model, realizes the regular evaluation of the LSTM model through automated orchestration, and optimizes the model through incremental learning or full-scale training.

2. The blockchain cross-chain routing selection system based on the master-slave chain architecture according to claim 1, wherein It also includes a time series database for storing cross-chain transaction feature data, network status data, input and output data of the LSTM model, and cross-chain execution result data for model training and iteration.

3. A cross-chain routing selection system for a blockchain based on a master-slave chain architecture according to claim 1, wherein The input data of the LSTM model includes: The normalized transaction timestamp and the logarithmic transformation value of the transaction data size; One-hot encoding vectors of the source chain identifier and the target chain identifier; The normalized node load rate and bandwidth utilization rate; The flattened and normalized cross-chain relay gateway network topology map; The output data is the predicted values of the data transmission delays of all routes.

4. A blockchain cross-chain routing selection method based on a master-slave chain architecture, characterized in that, The method is implemented by the system according to any one of claims 1-3, and includes the following steps: Step 1: Training of the original LSTM model; collecting historical cross-chain transaction data of the blockchain system with the master-slave chain architecture, and constructing a cross-chain routing prediction model; Step 2: Model deployment and system initialization; deploying the trained LSTM model on the cross-chain relay gateway and starting the relevant modules of the system; Step 3: Cross-chain routing selection; when a cross-chain transaction request arrives at the cross-chain relay gateway, start the LSTM model for routing prediction and select the route with the minimum delay; Step 4: Routing information synchronization and cross-chain execution; the cross-chain relay gateway broadcasts the optimal cross-chain routing information through the main chain consensus mechanism, and each gateway collaborates to complete the cross-chain transaction; Step 5: Monitoring of cross-chain transaction results; after the cross-chain transaction is completed, the routing selection decision module records the actual routing execution result and transmission delay duration of this cross-chain transaction, and writes them into the time series database together with the input and output data of the LSTM model; Step 6: Model Update and Maintenance; The model update and maintenance module constructs an automated lifecycle management mechanism for the LSTM model, and performs operations such as model performance evaluation, model optimization and update, and new model deployment at a fixed time every day to ensure that the model always adapts to the changing blockchain network environment.

5. The cross-chain routing selection method of a blockchain based on the master-slave chain architecture according to claim 4, wherein Step 3 includes the following steps: Step 3.1: Real-time Data Acquisition; When a cross-chain transaction request arrives at the main-chain cross-chain relay gateway, the routing decision-making module obtains cross-chain transaction-related information and real-time network status information through the data acquisition module. Step 3.2: Feature Generation; According to the information obtained in real time, generate feature data using the same feature engineering method as the training data. Step 3.3: Routing Performance Prediction; Input the generated feature vectors into the trained LSTM model, predict the data transmission delay of all routes, and select the route with the minimum delay as the optimal route.

6. The cross-chain routing selection method for a blockchain based on the master-slave chain architecture according to claim 4, wherein Step 6 includes the following steps: Step 6.1: Model Evaluation; Perform the following evaluation steps at a specific time every day:

1. The change in the number of blockchain nodes exceeds a preset ratio; 2. The mean square error, mean absolute error, and root mean square error between the model prediction delay value and the actual delay value of the newly added cross-chain transactions on the same day, and any one of the indicators exceeds the preset threshold; When any of the above conditions is met, enter Step 6.2; otherwise, end the current update and maintenance process. Step 6.2: Model Fine-tuning; Preprocess and perform feature engineering on the newly added cross-chain transaction data on the same day to generate feature data in the same format as the training set; Use the new data to fine-tune the original model, freeze the parameters of the first 3 layers of the LSTM layer, and adjust other parameters; After fine-tuning, evaluate the model using the validation set. If any one of the mean square error, mean absolute error, and root mean square error still exceeds the preset threshold described in Step 6.1, enter Step 6.3; If all indicators are lower than the corresponding thresholds, enter Step 6.4; Step 6.3: Model Retraining; Combine the historical cross-chain transaction data and the new data, and perform data cleaning and feature engineering preprocessing steps again to train the LSTM model; After training is completed, enter Step 6.4; Step 6.4: Model Redeployment; Push the new model after update or retraining to each cross-chain relay gateway and replace the old model in the routing decision-making module.

Citation Information

Cited By

  • Optimization method for cross-chain atomic exchange of digital currency

    CN121010361A