Transaction distribution method of block chain network, storage medium and electronic equipment

By dynamically selecting the most suitable blockchain network to process transactions in the blockchain network and utilizing machine learning and deep learning algorithms, the problems of low transaction processing efficiency and network congestion in existing technologies are solved, and efficient transaction allocation and resource optimization are achieved.

CN120672471APending Publication Date: 2025-09-19中国邮政储蓄银行股份有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510778775.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-11
Publication Date
2025-09-19

AI Technical Summary

Technical Problem

Existing blockchain networks find it difficult to process all transactions in a timely manner in high-frequency trading environments, resulting in inefficiency and network congestion. The lack of flexible transaction allocation strategies makes it impossible to adapt to dynamic changes in real-time status and transaction traffic.

Method used

By obtaining the characteristics and types of new transaction data, using network prediction models to dynamically select the most suitable blockchain network for processing, combined with machine learning and deep learning algorithms, dynamic allocation of transactions can be achieved, optimizing resource utilization and network load.

Benefits of technology

It improves the transaction processing efficiency and response speed of the blockchain network, reduces resource waste and network congestion, and improves the overall operating efficiency of the system and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120672471A_ABST
    Figure CN120672471A_ABST
Patent Text Reader

Abstract

The invention provides a transaction distribution method of a block chain network, a storage medium and electronic equipment, and the method comprises the steps: obtaining new transaction data, and determining the transaction type of the new transaction data and the feature data of the new transaction data; according to the transaction type of the new transaction data, inputting feature data of the new transaction data into a corresponding network prediction model, and predicting to obtain network identification data of the target block chain network, the network prediction model is used for selecting a target block chain network for processing new transaction data from the plurality of preparation block chain networks according to the transaction processing capabilities of the plurality of preparation block chain networks; and distributing the new transaction data to the target block chain network for processing according to the network identification data of the target block chain network. According to the method, a classic machine learning algorithm or a deep learning model is adopted to select an optimal block chain network, so that the processing efficiency and the response speed of a multi-chain block chain system are improved, and meanwhile, resource waste and congestion caused by improper network selection are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of blockchain technology, and more specifically, to a transaction allocation method for a blockchain network, a transaction allocation device for a blockchain network, a storage medium, and an electronic device. Background Art

[0002] The blockchain industry, particularly in high-frequency trading environments, places high demands on transaction processing efficiency, network resource optimization, and dynamic transaction load management. Blockchain, a distributed ledger technology, is widely used in various fields, including finance, supply chain, and healthcare, due to its decentralized, tamper-proof, and highly transparent nature. Blockchain networks ensure data consistency and security through a consensus mechanism between nodes, with each transaction recorded in a block on the chain. However, with the increase in applications, challenges facing the network are becoming increasingly significant, particularly in terms of transaction processing capacity and network congestion.

[0003] Existing multi-chain solutions often rely on static or pre-set rules to distribute transactions to different blockchain networks, or differentiate by business type. These solutions lack flexibility and cannot adapt to the real-time state of the network or the dynamic changes in transaction volume. While this can alleviate load pressure to a certain extent, it can still lead to network congestion and resource waste. Especially in situations with high transaction volumes, existing blockchain networks often struggle to process all transactions in a timely manner, leading to inefficiencies and network congestion. Summary of the Invention

[0004] The main purpose of this application is to provide a transaction allocation method for a blockchain network, a transaction allocation device for a blockchain network, a storage medium and an electronic device, so as to at least solve the problem in the prior art that the blockchain network is difficult to process all transactions in a timely manner, resulting in inefficiency and network congestion.

[0005] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a transaction allocation method for a blockchain network is provided, including: obtaining new transaction data, and determining the transaction type of the new transaction data and characteristic data of the new transaction data, wherein the characteristic data of the new transaction data represents the transaction time of the new transaction data, and the new transaction data is the transaction data obtained at the current moment; according to the transaction type of the new transaction data, the characteristic data of the new transaction data is input into a corresponding network prediction model to predict the network identification data of the target blockchain network, wherein the network prediction model is used to select a target blockchain network for processing the new transaction data from multiple preliminary blockchain networks according to the transaction processing capabilities of the multiple preliminary blockchain networks, and the network identification data is used to uniquely identify the target blockchain network; according to the network identification data of the target blockchain network, the new transaction data is allocated to the target blockchain network for processing.

[0006] Optionally, before obtaining new transaction data, the method further includes: determining the transaction processing type of each blockchain network, the transaction processing type of the blockchain network being one of a first type, a second type and a third type, the first type being a type for processing transactions with a security level greater than a preset level and non-large data volume transactions, the second type being a type for processing transactions with a priority greater than or equal to a preset priority and large data volume transactions, and the third type being a type for processing batch transactions; determining that a type of the blockchain network corresponds to a type of the network prediction model, and the transaction processing type of the blockchain network corresponds one-to-one to the transaction type of the transaction data.

[0007] Optionally, before obtaining new transaction data, the method further includes: obtaining multiple historical transaction data and determining the transaction type and historical feature data of each of the historical transaction data, where the historical feature data of the historical transaction data is obtained based on the historical transaction time of the historical transaction data; determining the preliminary blockchain network corresponding to the transaction type of the historical transaction data based on the transaction type of the historical transaction data; determining a network score of each of the preliminary blockchain networks at the historical transaction time, where the network score represents the transaction processing capability of the preliminary blockchain network corresponding to the historical transaction time; determining the preliminary blockchain network with the largest network score as the transaction blockchain network of the historical transaction data, where the transaction blockchain network is used to process the historical transaction data; obtaining an initial prediction model using a deep learning method or a machine learning method, and training the initial prediction model using the historical feature data of the historical transaction data and the transaction blockchain network corresponding to the historical transaction data to obtain the network prediction model.

[0008] Optionally, determining the network score of each of the preliminary blockchain networks at the historical transaction moment includes: obtaining a network block number score, the network block number score being related to the number of blocks of the preliminary blockchain network; obtaining a server resource score, the server resource score being related to the computing power of the server; and calculating the network block number score, the server resource score, and the blockchain scoring model S=w1S according to the network block number score, the server resource score, and the blockchain scoring model S=w1S block +w2S resource , determine the network score of the preliminary blockchain network, where S is the network score of the preliminary blockchain network, w1 is the first weighting coefficient, w2 is the second weighting coefficient, and S block Score the number of blocks of the network, S resource Score the server resources, w1>0, w2>0, w1+w2=1.

[0009] Optionally, obtaining the network block number score includes: calculating the score according to the first score calculation formula Determine the network block number score, where S block is the number of network blocks scored, B is the number of network blocks of the preliminary blockchain network at the time of the historical transaction, B min is the minimum number of blocks of all the prepared blockchain networks corresponding to the transaction type at the historical transaction time, B max is the maximum number of blocks of all the prepared blockchain networks corresponding to the transaction type at the historical transaction moment, λ is a constant greater than 1; and / or, obtaining a server resource score, including: calculating the server resource score according to the second score calculation formula Determine the server resource score, where S resource is the server resource score, C1j is a single-row m-column matrix, and the elements of each column in C1j are parameters that characterize the computing power of the server, k j is the weighting coefficient, k j >0, and

[0010] Optionally, determining the historical feature data of each of the historical transaction data includes: obtaining the timestamp and holiday information of the historical transaction data; performing a first normalization process on the year feature, month feature and date feature in the timestamp to obtain a first time feature, wherein the first normalization process is a normalization process performed using the scikit-learn library; performing a second normalization process on the hour feature, minute feature, second feature and millisecond feature in the timestamp to obtain a second time feature, wherein the second normalization process is a normalization process performed using sine and cosine functions; determining a holiday identifier based on the holiday information of the historical transaction data to obtain a third time feature, wherein when the holiday identifier is the first identifier, it indicates that the transaction time of the historical transaction data is a holiday, and when the holiday identifier is the second identifier, it indicates that the transaction time of the historical transaction data is a non-holiday; obtaining the historical feature data of the transaction data based on the first time feature, the second time feature and the third time feature.

[0011] Optionally, the initial prediction model is one of the following: random forest model, gradient boosting machine, convolutional neural network, long short-term memory neural network, gated recurrent unit, transformer.

[0012] According to another aspect of the present application, a transaction allocation device for a blockchain network is provided, comprising: an acquisition unit, configured to acquire new transaction data, and determine the transaction type of the new transaction data and characteristic data of the new transaction data, wherein the characteristic data of the new transaction data represents the transaction time of the new transaction data, and the new transaction data is the transaction data acquired at the current moment; a prediction unit, configured to input the characteristic data of the new transaction data into a corresponding network prediction model according to the transaction type of the new transaction data, and predict network identification data of a target blockchain network, wherein the network prediction model is configured to select one target blockchain network for processing the new transaction data from a plurality of prepared blockchain networks according to their transaction processing capabilities, and the network identification data is configured to uniquely identify the target blockchain network; and an allocation unit, configured to allocate the new transaction data to the target blockchain network for processing according to the network identification data of the target blockchain network.

[0013] According to another aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored program, wherein when the program is run, the device where the computer-readable storage medium is located is controlled to execute any one of the transaction allocation methods for the blockchain network.

[0014] According to another aspect of the present application, an electronic device is provided, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include a method for executing any one of the transaction allocation methods of the blockchain network.

[0015] Applying the technical solution of the present application, the transaction allocation method of the above-mentioned blockchain network first obtains new transaction data, determines the transaction type of the new transaction data and the characteristic data of the new transaction data; then, based on the transaction type of the new transaction data, the characteristic data of the new transaction data is input into the corresponding network prediction model to predict the network identification data of the target blockchain network. The network prediction model is used to select a target blockchain network for processing the new transaction data from multiple preliminary blockchain networks based on the transaction processing capabilities of the multiple preliminary blockchain networks; finally, based on the network identification data of the target blockchain network, the new transaction data is allocated to the target blockchain network for processing. This method uses classical machine learning algorithms or deep learning models to select the optimal blockchain network, improves the processing efficiency and response speed of the multi-chain blockchain system, and at the same time reduces resource waste and congestion caused by improper network selection, solving the problem that blockchain networks in the existing technology are difficult to process all transactions in a timely manner, resulting in low efficiency and network congestion. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The drawings that constitute part of this application are used to provide a further understanding of this application. The illustrative embodiments of this application and their descriptions are used to explain this application and do not constitute an improper limitation on this application. In the drawings:

[0017] Figure 1 A hardware structure block diagram of a mobile terminal for executing a transaction allocation method for a blockchain network provided in an embodiment of the present application is shown;

[0018] Figure 2 A flowchart of a transaction allocation method for a blockchain network provided in accordance with an embodiment of the present application is shown;

[0019] Figure 3 A schematic diagram illustrating a process flow of another transaction allocation method for a blockchain network provided according to an embodiment of the present application is shown;

[0020] Figure 4 A structural block diagram of a transaction allocation device for a blockchain network provided according to an embodiment of the present application is shown.

[0021] The above drawings include the following reference numerals:

[0022] 102. Processor; 104. Memory; 106. Transmission device; 108. Input / output device. DETAILED DESCRIPTION

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

[0024] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.

[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0026] For ease of description, some nouns or terms involved in the embodiments of the present application are explained below:

[0027] Blockchain technology: A distributed database or ledger technology that allows multiple parties to share and synchronize data without the need for a centralized authority.

[0028] Multi-chain technology: Design and implement multiple blockchains within a single blockchain application to distribute processing and storage loads, thereby improving system scalability and efficiency.

[0029] Machine learning: A subfield of artificial intelligence that allows software applications to become more precise through experience rather than through explicit programming.

[0030] Deep learning: A subset of machine learning that simulates the workings of the human brain, using a large number of hierarchical processing units and combined weights to process data, thereby performing pattern recognition and intelligent decision-making.

[0031] As introduced in the background technology, the existing technology has the following problems: (1) Insufficient transaction processing efficiency. With the increasing popularity of blockchain applications, the number of transaction requests has increased dramatically. When faced with large-scale, high-concurrency business scenarios such as commercial electronic bills, supply chain bills, and credit card activation information writing, the traditional single blockchain network deployment model is difficult to maintain high security while ensuring efficient processing speed. In particular, it will seriously affect transaction efficiency during peak trading periods. (2) Static resource allocation limitations: Currently, multi-chain deployment adopts a static blockchain network resource allocation strategy, which is difficult to dynamically adjust according to the real-time blockchain network performance and server resource occupancy rate, which easily leads to uneven resource allocation and network congestion. (3) Lack of intelligent prediction and dynamic allocation strategies. Currently, there is a lack of efficient and scientific methods to predict and manage the distribution of transactions between multiple blockchain networks, which makes it difficult to adapt to complex transaction patterns and rapid traffic changes.

[0032] To address the problem in the prior art that blockchain networks are unable to process all transactions in a timely manner, resulting in inefficiency and network congestion, the embodiments of the present application provide a transaction allocation method for a blockchain network, a transaction allocation device for a blockchain network, a storage medium, and an electronic device.

[0033] The technical solutions in the embodiments of the present invention will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present invention.

[0034] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure diagram of a mobile terminal for a transaction allocation method of a blockchain network according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown) a processor 102 (the processor 102 may include but is not limited to a microprocessor MCU or a programmable logic device FPGA and other processing devices) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input and output device 108 for communication functions. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.

[0035] Memory 104 can be used to store computer programs, such as software programs and modules for application software, such as the computer program corresponding to the transaction allocation method for a blockchain network in an embodiment of the present invention. Processor 102 executes the computer program stored in memory 104 to perform various functional applications and data processing, thereby implementing the aforementioned method. Memory 104 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 104 may further include memory remotely located from processor 102, which can be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof. Transmission device 106 is used to receive or transmit data via a network. Specific examples of such networks may include a wireless network provided by the mobile terminal's telecommunications provider. In one example, transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0036] In this embodiment, a transaction allocation method for a blockchain network running on a mobile terminal, a computer terminal or a similar computing device is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0037] Figure 2 This is a flow chart of a transaction allocation method for a blockchain network according to an embodiment of the present application. Figure 2 As shown, the method includes the following steps:

[0038] Step S201: Acquire new transaction data and determine the transaction type and characteristic data of the new transaction data, wherein the characteristic data of the new transaction data represents the transaction time of the new transaction data, and the new transaction data is the transaction data acquired at the current moment;

[0039] Specifically, in a blockchain environment, new transaction data may originate from various transaction activities, such as transfers, contract executions, and data logging. These data are sent to the blockchain system over the network, awaiting verification and inclusion in the next block. Transaction type refers to the classification of transactions based on their specific content or purpose. This type of transaction may influence the type of blockchain network to which it is assigned. For example, some transactions may involve sensitive information and therefore require a higher level of security, thus being assigned to a blockchain network specifically designed for high-security transactions. Other transactions, such as the batch processing of large quantities of electronic invoices, may be more appropriately assigned to a blockchain network optimized for batch transactions. Determining transaction types allows for targeted subsequent assignment of transactions to the blockchain network best suited for processing that type of transaction. Feature data refers to data or information that reflects transaction characteristics, primarily transaction time. Transaction time feature data helps the system understand the frequency and patterns of transactions, which is crucial for predicting future transaction loads. Transaction time may include specific dates, times (hours, minutes, seconds), and even millisecond-level precision, as blockchain transaction processing often requires accounting for very fine-grained time variances.

[0040] Step S202: Inputting the characteristic data of the new transaction data into a corresponding network prediction model based on the transaction type of the new transaction data to predict network identification data of the target blockchain network. The network prediction model is used to select a target blockchain network for processing the new transaction data from the multiple prepared blockchain networks based on their transaction processing capabilities, and the network identification data is used to uniquely identify the target blockchain network.

[0041] Specifically, transaction data can be categorized into various types based on security level, data volume, and priority. Different types of transaction data are assigned to different blockchain networks for processing, resulting in different blockchain networks processing corresponding transaction data types. Multiple blockchain networks are categorized into different types based on the types of transaction data they process, with each type corresponding to the type of transaction data. A network prediction model is trained for each type of blockchain network. This allows us to select the network prediction model that best suits the type of new transaction data upon receiving it.

[0042] Step S203: Distribute the new transaction data to the target blockchain network for processing based on the network identification data of the target blockchain network.

[0043] Specifically, the dynamic allocation strategy first uses a network prediction model to analyze the characteristics of new transaction data, including transaction type and time, and then predicts a target blockchain network. This target network is determined by its unique "network identification data," which, similar to a network ID, uniquely identifies a specific blockchain network. Based on the model's predictions, it indicates which blockchain network is best suited to process incoming transaction data under the current circumstances. Upon receiving new transaction data, the network prediction model analyzes its characteristics, particularly transaction time and type, to predict a target blockchain network. Based on this network's unique identification data, the transaction data is accurately allocated to that network for processing. This maximizes the utilization of blockchain network resources, reduces transaction delays, prevents network overload, improves overall system processing capacity and responsiveness, and provides users with a more efficient and stable service experience. Furthermore, this dynamic allocation strategy can adapt to changes in the blockchain network environment, such as fluctuations in server resources and seasonal changes in transaction volume, ensuring that the system maintains high operational efficiency under various conditions.

[0044] The transaction allocation method of the blockchain network mentioned above in the present application first obtains new transaction data, determines the transaction type of the new transaction data and the characteristic data of the new transaction data; then, based on the transaction type of the new transaction data, inputs the characteristic data of the new transaction data into the corresponding network prediction model to predict the network identification data of the target blockchain network. The network prediction model is used to select a target blockchain network for processing the new transaction data from multiple preparatory blockchain networks based on the transaction processing capabilities of the multiple preparatory blockchain networks; finally, based on the network identification data of the target blockchain network, the new transaction data is allocated to the target blockchain network for processing. This method uses classical machine learning algorithms or deep learning models to select the optimal blockchain network, improves the processing efficiency and response speed of the multi-chain blockchain system, and at the same time reduces resource waste and congestion caused by improper network selection, solving the problem that the blockchain network in the prior art is difficult to process all transactions in a timely manner, resulting in low efficiency and network congestion.

[0045] Among them, the network prediction model has been pre-trained by calculation. When a new transaction enters, there is no need to go through the calculation and training steps. It can be predicted directly through the network prediction model.

[0046] In some embodiments, before obtaining new transaction data, the method further includes the following steps:

[0047] Step S301: Determine the transaction processing type of each blockchain network. The transaction processing type of the blockchain network is one of the first, second, and third types. The first type is a type for processing transactions with a security level greater than a preset level and non-large-scale transactions. The second type is a type for processing transactions with a priority level greater than or equal to a preset priority and large-scale transactions. The third type is a type for processing batch transactions.

[0048] Step S302: Determine that a type of the above-mentioned blockchain network corresponds to a type of the above-mentioned network prediction model, and the above-mentioned transaction processing type of the above-mentioned blockchain network corresponds one-to-one to the transaction type of the transaction data.

[0049] Specifically, by classifying blockchain networks' transaction processing capabilities into Type 1, Type 2, and Type 3, the invention accurately assigns transactions to the most suitable blockchain network based on their security requirements, data volume, and whether they are batch transactions. This classification method ensures that high-security transactions are prioritized on blockchain networks dedicated to ensuring security levels above a preset threshold, avoiding unnecessary processing delays caused by security measures. Large-volume and high-priority transactions are sent to networks with greater processing capabilities and more sufficient resources to ensure their quick and efficient completion. Furthermore, for batch transactions, the invention provides a specialized processing pathway that can process a large number of similar transactions in a short period of time, improving efficiency.

[0050] Assigning each type of blockchain network to a specific network prediction model allows the model to make predictions and decisions based on the specific type of transaction data. This design makes model training more focused and effective, as the model only needs to learn and predict the network selection for the corresponding type of transaction, reducing model complexity and improving prediction accuracy and processing speed. For example, a Type 1 network processing security-sensitive transactions might be equipped with a prediction model specifically tailored to this type of transaction. By learning from the behavior and trends of past security-related transactions, this model can more accurately predict whether the current network can meet the security requirements of such transactions.

[0051] This dynamic allocation strategy, based on transaction type and real-time performance metrics, effectively avoids resource waste and network congestion. While traditional static allocation methods can overload a particular network, the proposed strategy dynamically adjusts transaction allocation based on real-time transaction type and network performance, directing transactions to the network with the most suitable processing capabilities. This balances network load and improves overall transaction processing efficiency.

[0052] Among them, transactions with a security level greater than a preset level are high-security transactions, transactions with non-large data volumes are ordinary transactions, and transactions with a priority greater than or equal to a preset priority are high-priority transactions. The above embodiment can divide the blockchain network into multiple types (type A, type B, type C, ..., type N), numbered A, B, C, ..., N respectively, and each type of network processes different transactions. For example, type A (first type) network processes high-security and ordinary transactions, numbered A1, A2, ..., A n ; Type B (second type) network handles high priority and large data volume transactions, numbered B1, B2...B n ; Type C (third type) blockchain network processes batch transactions, numbered C1, C2...C n ; N types of network processing..., numbered N1, N2...N n .

[0053] It should be noted that the above three types are only examples. The types of blockchain networks are not limited to the above three types, but also include multiple types. The specific type can be set according to actual conditions.

[0054] In some embodiments, before obtaining new transaction data, the method further includes the following steps:

[0055] Step S401: Acquire multiple historical transaction data and determine the transaction type and historical feature data of each of the historical transaction data, where the historical feature data of the historical transaction data is obtained based on the historical transaction time of the historical transaction data;

[0056] Step S402: Determine the preliminary blockchain network corresponding to the transaction type of the historical transaction data based on the transaction type of the historical transaction data;

[0057] Step S403: Determine a network score for each of the aforementioned backup blockchain networks at the aforementioned historical transaction time. The network score represents the transaction processing capability of the corresponding backup blockchain network at the aforementioned historical transaction time. The backup blockchain network with the highest network score is determined as the transaction blockchain network for the aforementioned historical transaction data. The transaction blockchain network is used to process the aforementioned historical transaction data.

[0058] Step S404: A deep learning method or a machine learning method is used to obtain an initial prediction model, and the initial prediction model is trained using the historical feature data of the historical transaction data and the transaction blockchain network corresponding to the historical transaction data to obtain the network prediction model.

[0059] Specifically, steps S401 and S402 collect and analyze historical transaction data to identify the type of each transaction and, based on the transaction type, determine the matching candidate blockchain network. This allows the neural network model to focus on specific transaction types during the training phase and learn which blockchain networks perform best when processing those transactions. This targeted training significantly improves the model's predictive capabilities, enabling it to more accurately predict the most suitable blockchain network for new transactions of the same type, thereby improving transaction processing efficiency and success rates. Step S403 calculates a network score for each candidate blockchain network at the time of historical transactions, assigning a quantitative performance metric to each blockchain network. The network score integrates the current state of the blockchain (such as block height and server resource usage) and its processing capacity, providing the system with an objective criterion for network selection, rather than relying solely on subjective judgment or preset rules. By comparing the scores of each network, the system can quickly identify the blockchain network with the strongest transaction processing capabilities within a specific time period, achieving optimal resource allocation. Step S404 describes how to utilize historical transaction data, historical feature data, and transaction blockchain network information, and employ deep learning or machine learning methods to generate an initial prediction model. This model can predict the most suitable blockchain network for transaction processing under current conditions based on the temporal characteristics of new transactions and other relevant information. This dynamic prediction capability enables the system to flexibly respond to resource demands during peak trading periods or other special conditions, instantly adjusting transaction allocation strategies to prevent network congestion, optimize resource utilization, and improve overall system efficiency. Furthermore, while machine learning methods can generate an initial prediction model directly from historical data, deep learning methods require the construction of a neural network model.

[0060] Among them, steps S401 to S404 are the specific steps for constructing a network prediction model. A network prediction model is trained for each type of blockchain network. The training steps for each network prediction model are the same, except that the training data is different. Taking the example of blockchain networks being divided into first, second, and third types of networks, there are multiple blockchain networks of each type. The first network prediction model is trained based on the network score of the first type of network and the corresponding historical transaction data. The second network prediction model is trained based on the network score of the second type of network and the corresponding historical transaction data. The third network prediction model is trained based on the network score of the third type of network and the corresponding historical transaction data. When new transaction data comes in, the first type of network is determined to process the new transaction data. For example, if the new transaction data needs to be processed using the first type of blockchain network, the feature data of the new transaction data is input into the first network prediction model to determine the blockchain network to be processed.

[0061] In some embodiments, determining the network score of each of the aforementioned preliminary blockchain networks at the aforementioned historical transaction time comprises the following steps:

[0062] Step S4031: Obtain a network block count score, where the network block count score is related to the number of blocks in the preliminary blockchain network.

[0063] Step S4032: Obtain a server resource score, which is related to the computing power of the server.

[0064] Step S4033: Based on the network block number score, the server resource score and the blockchain scoring model S=w1S block +w2S resource , determine the network score of the above-mentioned preliminary blockchain network, where S is the network score of the above-mentioned preliminary blockchain network, w1 is the first weighting coefficient, w2 is the second weighting coefficient, and S block Score the number of blocks in the above network, S resource Score the above server resources, w1>0, w2>0, w1+w2=1.

[0065] Specifically, by calculating a score based on the number of network blocks and a score based on server resource utilization, the system can monitor the current status of each blockchain network in real time, including transaction processing progress (number of network blocks) and server load (resource utilization). Quantitative evaluation of these metrics enables the system to accurately measure the processing capacity of each blockchain, providing a solid data foundation for transaction allocation decisions. The score based on the number of network blocks reflects the network's activity and transaction processing speed, while the score based on server resource utilization reveals the network's current resource consumption. Taking these two scores into consideration, transactions can be allocated to the blockchain network with the fastest processing speed and sufficient resources (not overloaded), thereby improving overall transaction processing efficiency, reducing transaction confirmation time, and enhancing user experience. Traditional static resource allocation strategies are often ineffective in responding to sudden high-volume transactions or network load fluctuations. The dynamic scoring mechanism in the above embodiment can dynamically adjust the transaction allocation strategy based on real-time network status and resource consumption, avoiding overloading certain networks while leaving other network resources idle, and achieving optimal allocation of network resources. By accurately assessing the network's current processing capacity and resource status, this scoring mechanism helps prevent network congestion. During peak transaction times, the system can intelligently direct transactions to less-loaded blockchain networks, avoiding congestion on a single network and improving the overall throughput of the system. w1 and w2 can be adjusted based on the importance attached to network load and capacity.

[0066] In some embodiments, obtaining a network block number score includes: calculating the network block number score according to a first score calculation formula Determine the above network block number score, where S block Score the number of network blocks above, B is the number of network blocks of the above-mentioned pre-blockchain network at the above-mentioned historical transaction time. min is the minimum number of blocks of all the above-mentioned prepared blockchain networks corresponding to the above-mentioned transaction types at the above-mentioned historical transaction moments, B max is the maximum number of blocks of all the above-mentioned preliminary blockchain networks corresponding to the above-mentioned transaction type at the above-mentioned historical transaction time, and λ is a constant greater than 1; and / or, obtaining a server resource score, including: according to the second score calculation formula Determine the server resource score above, where S resource is the score of the server resources mentioned above, C1j is a single-row m-column matrix, and the elements of each column in C1j are parameters that characterize the computing power of the server, k j is the weighting coefficient, k j >0, and

[0067] Among them, B max =B min When S block= 1. In some embodiments, m = 3, that is, C1j is a matrix with one row and three columns, and the elements of each column in C1j represent the CPU usage, memory usage, and disk usage respectively.

[0068] Specifically, after collecting and filtering historical data using an appropriate sampling method, the system evaluates server performance at a specific point in time using CPU, memory, and disk usage. The current network load is determined using the current block height, the maximum block height of the cluster network, and the minimum block height, thereby quantifying the blockchain network score. This scoring mechanism not only considers the server's hardware resource usage (such as CPU, memory, and disk) but also analyzes the software-level status of the blockchain network (such as block height). This makes the evaluation more comprehensive, reflecting the real-time health and processing capacity of the entire system. This quantitative scoring approach allows the system to monitor and adjust in real time. Whenever server resource status or network load changes, the score is updated accordingly. The system can immediately make transaction allocation decisions based on the latest score, ensuring dynamic resource optimization and rapid transaction processing. Converting multi-dimensional performance data into a quantitative score provides easily understandable and processable input for intelligent decision-making systems (such as machine learning or deep learning models). Based on this historical scoring data, the model can learn and predict future network status, thereby more intelligently guiding the dynamic allocation of transactions.

[0069] In some embodiments, determining the historical feature data of each of the above historical transaction data includes the following steps:

[0070] Step S401, obtaining the timestamp and holiday information of the above historical transaction data;

[0071] Step S402: performing a first normalization process on the year feature, month feature, and date feature in the timestamp to obtain a first time feature, wherein the first normalization process is performed using the scikit-learn library;

[0072] Step S403: performing a second normalization process on the hour feature, minute feature, second feature, and millisecond feature in the timestamp to obtain a second time feature, wherein the second normalization process is a normalization process performed using a sine and cosine function;

[0073] Step S404: Determine the holiday identifier based on the holiday information of the historical transaction data and obtain a third time feature, wherein when the holiday identifier is the first identifier, it indicates that the transaction time of the historical transaction data is a holiday; when the holiday identifier is the second identifier, it indicates that the transaction time of the historical transaction data is a non-holiday; obtain historical feature data of the transaction data based on the first time feature, the second time feature and the third time feature.

[0074] It should be noted that the scikit-learn library is only a specific and desirable method for the first normalization process, and is not limited to this method. Other methods can also be used for the first normalization process. Similarly, the sine and cosine functions are also a specific and desirable method for the second normalization process, and are not limited to this method. Other methods can also be used for the second normalization process.

[0075] Specifically, when processing timestamp information in historical transaction data, considering the strong periodicity of hours, minutes, seconds, and milliseconds, a sine-cosine normalization method is proposed to encode the periodicity of timestamps and perform statistically consistent feature processing. The cosine function converts timestamp data to the interval [-1, 1], achieving data normalization. Normalization is a key preprocessing step in machine learning and deep learning. It eliminates the impact of data scale differences, facilitates model convergence during training, and improves model prediction accuracy. Directly training models using raw timestamp data may fail to capture the inherent patterns in temporal data. However, periodic encoding using sine-cosine functions converts temporal features into continuous periodic signals, simplifying the model learning process and enabling the model to more efficiently understand temporal patterns without requiring additional complex feature engineering. Applying periodic encoding to timestamps enhances the model's generalization across different time periods, enabling it to not only learn trading patterns at specific time points but also generalize these patterns to similar time periods, such as weekend and weekday trading patterns or peak and trough periods throughout the day.

[0076] In some embodiments, data is collected over a period of time (e.g., a single quarter), and data samples are collected by systematic sampling or stratified sampling. The data samples are grouped into A, B, ..., N according to the transaction type, and the sample data of different groups are labeled as follows: W(X,S x )=Y x That is, for transaction data X at different times, calculate the scores S of each blockchain network of the corresponding type at that time. x , select the network ID corresponding to the maximum network score to get Y x .

[0077] Extract the timestamp and holiday information from transaction flow X and process these two features as follows:

[0078] (1) Normalize the year, month, and day features in the timestamp. One option is to use the Scikit-learn library.

[0079] (2) For hour, minute, second, and millisecond features, considering their strong periodicity, an optional method is to use sine and cosine functions for normalization, as follows: Here, t represents hours, minutes, seconds, and milliseconds, and M represents time periods of 24, 60, 60, and 1000, respectively. Using sine and cosine functions effectively captures cyclical characteristics in time data, such as the number of hours in a day (24-hour period), the number of minutes in an hour (60-minute period), the number of seconds in a minute (60-second period), and the number of milliseconds in a second (1000-millisecond period). This encoding method intuitively reflects the cyclical changes in time and is crucial for exploring the relationship between trading patterns and time.

[0080] (3) Use flags 0 and 1 to distinguish between holidays and non-holidays.

[0081] After the above processing, feature separation and combination can be performed to obtain the normalized feature set X norm , feature set X norm Including Y x and the timestamp of the transaction data, and perform independent hot encoding on the target variable Y to obtain Y c , Y c is an independent hot encoding. For example, if there are five blockchain networks and the target blockchain network is selected as the first one, then Y c is 10000. If the target blockchain network is the third one, then Y c is 00100.

[0082] The blockchain splitting strategy proposed in the above examples, which predicts and selects networks based on historical transactions, uses independent hot encoding to determine blockchain network IDs. In the deep learning network selection approach, a fully connected (Dense) layer equal to the number of networks currently selected is added, and the softmax function is used to predict the probability of each network. Network selection is then achieved by comparing the maximum values.

[0083] Then the feature set X norm and the corresponding Y c After being divided into training set and test set according to a certain ratio, the model is input for model compilation, training and evaluation in the following way: M = Model (X norm_train,X norm_test ,Y c_train ,Y c_test ). Where M is the network prediction model, X norm_train and Y c_train is the feature set X divided into the training set norm and the corresponding Y c , X norm_test and Y c_test is the feature set X divided into the test set norm and the corresponding Y c In some embodiments, feature set X norm and the corresponding Y c It can also be divided into training set, test set and validation set according to a certain ratio. For different blockchain network types A, B...N, each needs to train the corresponding model M A 、M B …M N .

[0084] In some embodiments, the initial prediction model is one of the following: a random forest model, a gradient boosting machine, a convolutional neural network, a long short-term memory neural network, a gated recurrent unit, or a Transformer.

[0085] It should be noted that the types of the above-mentioned initial prediction models are only examples for reference and are not limited to the models listed above. They can be adjusted according to actual applications.

[0086] Specifically, the above embodiment uses a suitable machine learning algorithm or deep learning model, combined with multi-dimensional features such as transaction time and server resource usage, to train a dynamic chain splitting strategy based on historical transaction predictions. This strategy can cope with rapid changes in transaction volume and emergencies, ensuring efficient utilization of network resources and timely transaction processing. The target blockchain network is preferably trained using Transformer.

[0087] The following machine learning algorithms are available:

[0088] (1) Random Forest:

[0089] An ensemble learning method based on decision trees, suitable for classification and regression tasks. Random forests can handle large datasets well and are very robust to outliers and nonlinear data.

[0090] (2) Gradient Boosting Machines (GBM):

[0091] GBM is a powerful machine learning technique used for regression and classification problems. It builds predictive models by optimizing any differentiable loss function. It builds models in a step-by-step manner, reducing model error at each step, making it well-suited for handling complex nonlinear relationships.

[0092] The deep learning models available are as follows:

[0093] (1) Convolutional Neural Network (RNN):

[0094] RNNs are a type of neural network architecture particularly well-suited for processing sequential data. They use the output of the previous time step as part of the input for the current time step, enabling them to process and predict the flow of information within a sequence. RNNs are particularly well-suited for processing time series data, natural language text, or any other form of sequential data.

[0095] (2) Long Short-Term Memory Neural Network (LSTM):

[0096] LSTM is an improved version of RNN. It introduces a three-gate structure (input gate, forget gate, and output gate) to control the inflow, memory, and outflow of information. LSTM is designed to solve the vanishing gradient problem encountered by standard RNN when processing long sequences of data.

[0097] (3) Gated Recurrent Unit (GRU):

[0098] GRU is another recurrent neural network structure similar to LSTM, but it is structurally simpler because it uses fewer gate mechanisms (update gates and reset gates). GRU training is generally faster and requires fewer parameters, making it suitable for situations where the dataset is small or there are limits on model complexity.

[0099] (4) Transformer:

[0100] Based entirely on the self-attention mechanism, it abandons the traditional dependency-heavy recurrent network structure, allowing the model to significantly improve parallel processing capabilities and efficiency when processing sequence data. Due to its excellent ability to capture long-range dependencies, it is widely used in various complex sequence modeling and classification tasks.

[0101] For Random Forest and GBM, you can directly use the predict_proba() method in the Scikit-Learn library to obtain the predicted probability for each category. For RNN, LSTM, GRU, Transformer, and BERT, the output layer is set to a fully connected (Dense) layer equal to the total number of blockchain networks of the current type, n, and a softmax activation function is used to predict the probability of each blockchain network.

[0102] The above-mentioned examples first categorize blockchains into three different types to handle different types of transactions, then propose a scientific blockchain scoring model to select the optimal network. This model employs classical machine learning algorithms or deep learning models to capture the characteristic dependencies and complex patterns of transactions, and provides a specific training and network prediction process for transaction data. Existing technologies rely on static or pre-defined rules for chain partitioning, lacking flexibility and adaptability to future changes in conditions. In contrast, this approach leverages statistical analysis of various indicators and superior processing capabilities to improve the intelligence and efficiency of transaction allocation. Furthermore, it can dynamically adapt to new data and environmental changes without requiring manual redefinition of rules, which is particularly important in rapidly changing blockchain application scenarios.

[0103] The primary purpose of the above-described embodiments is to improve the processing efficiency and response speed of multi-chain blockchain systems while reducing resource waste and congestion caused by inappropriate network selection. The implementation of this invention not only enhances the scalability and robustness of blockchain systems but also provides technical support for the further application and development of blockchain technology, particularly in complex systems that need to process large numbers of heterogeneous transactions.

[0104] The embodiments of this application combine classic machine learning algorithms or deep learning models to determine the specific blockchain network to which each transaction should be assigned. A model training and prediction architecture is also proposed, including dataset selection and preprocessing methods, as well as the model's input and output layer configuration. This method has future applications in areas such as fintech, supply chain management, and smart contracts. This multi-chain classification deployment and network selection solution can significantly improve the processing efficiency and response speed of blockchain networks and reduce transaction failure rates due to network congestion, thereby enhancing user satisfaction and enterprise competitiveness.

[0105] In some embodiments, the transaction allocation logic can also be implemented directly in the code using predefined rules or heuristic methods, such as using a load balancing algorithm (polling, hash modulus, minimum number of connections) or a priority queue method (classifying transactions and selecting corresponding performance network allocation).

[0106] In some embodiments, the blockchain's own distributed consensus algorithm can also be used for network prediction and selection, such as using smart contracts for allocation or selecting through communication protocols between multiple chains and side chains.

[0107] In order to enable those skilled in the art to more clearly understand the technical solution of the present application, the implementation process of the transaction allocation method of the blockchain network of the present application will be described in detail below with reference to specific embodiments.

[0108] This embodiment relates to a specific transaction allocation method of a blockchain network, such as Figure 3 As shown, the following steps are included:

[0109] Step S1: First, collect historical data and preprocess them. Then, input the collected historical data into the training and evaluation of the initial prediction model to obtain the network prediction model.

[0110] Step S2: Real-time transaction data flows in, feature data of the incoming real-time transaction data is extracted, and prediction is performed using the corresponding network prediction model. The feature data of the incoming real-time transaction data is collected as new historical data to repeatedly train the network prediction model in real time to improve the accuracy of the network prediction model;

[0111] Step S3: According to the target blockchain network predicted by the network prediction model, the real-time transaction data is distributed to the corresponding target blockchain network for processing, wherein the target blockchain network is divided into multiple types, including: Class A blockchain network, Class B blockchain network, Class C blockchain network, and Class N blockchain network.

[0112] The above embodiment collects historical data and preprocesses it, and obtains the corresponding model after training and evaluation. When a new transaction arrives, the model is used to predict the network ID, and transaction features are extracted as new inputs to further train the model. The model can be optimized and corrected by adjusting machine learning model parameters or selecting a suitable algorithm, changing the number of deep learning neurons, time step, batch size and learning rate to continuously adapt to the specific environment.

[0113] The embodiments of the present application also provide a transaction allocation device for a blockchain network. It should be noted that the transaction allocation device for a blockchain network in the embodiments of the present application can be used to execute the transaction allocation method for a blockchain network provided in the embodiments of the present application. The device is used to implement the above-mentioned embodiments and preferred implementation methods, and the details that have been explained will not be repeated here. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and conceivable.

[0114] The following is an introduction to the transaction allocation device of the blockchain network provided in the embodiment of the present application.

[0115] Figure 4 Schematic diagram of a transaction allocation device for a blockchain network according to an embodiment of the present application. Figure 4As shown, the device includes an acquisition unit 10, a prediction unit 20 and an allocation unit 30, the acquisition unit 10 is used to acquire new transaction data, and determine the transaction type of the above-mentioned new transaction data and the characteristic data of the above-mentioned new transaction data, wherein the characteristic data of the above-mentioned new transaction data represents the transaction time of the above-mentioned new transaction data, and the above-mentioned new transaction data is the transaction data acquired at the current moment; the prediction unit 20 is used to input the characteristic data of the above-mentioned new transaction data into the corresponding network prediction model according to the transaction type of the above-mentioned new transaction data, and predict the network identification data of the target blockchain network, wherein the above-mentioned network prediction model is used to select one of the above-mentioned target blockchain networks for processing the above-mentioned new transaction data from the above-mentioned prepared blockchain networks according to the transaction processing capabilities of the above-mentioned multiple prepared blockchain networks, and the above-mentioned network identification data is used to uniquely identify the above-mentioned target blockchain network; the allocation unit 30 is used to allocate the above-mentioned new transaction data to the above-mentioned target blockchain network for processing according to the network identification data of the above-mentioned target blockchain network.

[0116] The transaction allocation device for the blockchain network described in the present application includes an acquisition unit, a prediction unit, and an allocation unit. The acquisition unit is configured to first acquire new transaction data and determine the transaction type and characteristic data of the new transaction data. The prediction unit is configured to input the characteristic data of the new transaction data into a corresponding network prediction model based on the transaction type of the new transaction data to predict network identification data of a target blockchain network. The network prediction model is configured to select a target blockchain network from multiple preparatory blockchain networks based on the transaction processing capabilities of the multiple preparatory blockchain networks to process the new transaction data. The allocation unit is configured to allocate the new transaction data to the target blockchain network for processing based on the network identification data of the target blockchain network. The device uses a classical machine learning algorithm or a deep learning model to select the optimal blockchain network, thereby improving the processing efficiency and response speed of the multi-chain blockchain system while reducing resource waste and congestion caused by improper network selection. This solves the problem in the prior art that blockchain networks have difficulty processing all transactions in a timely manner, resulting in low efficiency and network congestion.

[0117] In some embodiments, the apparatus further includes a first determination module and a second determination module. The first determination module is configured to determine the transaction processing type of each blockchain network before acquiring new transaction data. The transaction processing type of the blockchain network is one of a first type, a second type, and a third type. The first type is a type for processing transactions with a security level greater than a preset level and transactions with small amounts of data. The second type is a type for processing transactions with a priority level greater than or equal to a preset priority and transactions with large amounts of data. The third type is a type for processing batch transactions. The second determination module is configured to determine that a type of blockchain network corresponds to a type of network prediction model. The transaction processing type of the blockchain network corresponds one-to-one to the transaction type of the transaction data. By classifying the transaction processing capabilities of blockchain networks into the first, second, and third types, transactions can be accurately assigned to the most suitable blockchain network based on characteristics such as security requirements, data volume, and whether they are batch transactions.

[0118] In some embodiments, the above-mentioned device also includes a first acquisition module, a third determination module, a fourth determination module, a fifth determination module and a construction module. The first acquisition module is used to obtain multiple historical transaction data and determine the transaction type and historical feature data of each of the above-mentioned historical transaction data before obtaining new transaction data. The historical feature data of the above-mentioned historical transaction data is obtained according to the historical transaction time of the above-mentioned historical transaction data; the third determination module is used to determine the above-mentioned preliminary blockchain network corresponding to the transaction type of the above-mentioned historical transaction data according to the transaction type of the above-mentioned historical transaction data; the fourth determination module is used to determine the network score of each of the above-mentioned preliminary blockchain networks at the above-mentioned historical transaction time, and the above-mentioned network score represents the transaction processing capability of the above-mentioned preliminary blockchain network corresponding to the above-mentioned historical transaction time; the fifth determination module is used to determine the above-mentioned preliminary blockchain network with the largest network score as the transaction blockchain network of the above-mentioned historical transaction data, and the above-mentioned transaction blockchain network is used to process the above-mentioned historical transaction data; the construction module is used to obtain an initial prediction model using a deep learning method or a machine learning method, and train the above-mentioned initial prediction model using the historical feature data of the above-mentioned historical transaction data and the transaction blockchain network corresponding to the above-mentioned historical transaction data to obtain the above-mentioned network prediction model. This model can predict the blockchain network that is most suitable as a transaction processing platform under current conditions based on the time characteristics of new transactions and other relevant information.

[0119] In some embodiments, the fourth determination module includes a second acquisition module, a third acquisition module, and a first determination submodule, wherein the second acquisition module is used to obtain a network block number score, wherein the network block number score is related to the number of blocks of the preliminary blockchain network; the third acquisition module is used to obtain a server resource score, wherein the server resource score is related to the computing power of the server; the first determination submodule is used to determine the server resource score based on the network block number score, the server resource score, and the blockchain scoring model S=w1S block +w2S resource , determine the network score of the above-mentioned preliminary blockchain network, where S is the network score of the above-mentioned preliminary blockchain network, w1 is the first weighting coefficient, w2 is the second weighting coefficient, and S block Score the number of blocks in the above network, S resource Score the above server resources, w1>0, w2>0, w1+w2=1.

[0120] In some embodiments, the second acquisition module includes a second determination submodule for calculating the score according to the first scoring formula Determine the above network block number score, where S block Score the number of network blocks above, B is the number of network blocks of the above-mentioned pre-blockchain network at the above-mentioned historical transaction time. min is the minimum number of blocks of all the above-mentioned prepared blockchain networks corresponding to the above-mentioned transaction types at the above-mentioned historical transaction moments, B max is the maximum number of blocks of all the above-mentioned preliminary blockchain networks corresponding to the above-mentioned transaction type at the above-mentioned historical transaction time, and λ is a constant greater than 1; the third acquisition module includes a third determination submodule for calculating the score according to the second scoring formula Determine the server resource score above, where S resource is the score of the server resources mentioned above, C1j is a single-row m-column matrix, and the elements of each column in C1j are parameters that characterize the computing power of the server, k j is the weighting coefficient, k j >0, and This scoring mechanism not only considers the server's hardware resource usage (such as CPU, memory, and disk), but also analyzes the software-level status of the blockchain network (such as block height). This makes the evaluation results more comprehensive and reflects the real-time health and processing capacity of the entire system.

[0121] In some embodiments, the first acquisition module includes a fourth acquisition module, a first processing module, a second processing module, a third processing module, and a fourth processing module, wherein the fourth acquisition module is used to obtain the timestamp and holiday information of the above-mentioned historical transaction data; the first processing module is used to perform a first normalization process on the year feature, month feature, and date feature in the above-mentioned timestamp to obtain a first time feature, wherein the above-mentioned first normalization process is a normalization process performed using the scikit-learn library; the second processing module is used to perform a second normalization process on the hour feature, minute feature, second feature, and millisecond feature in the above-mentioned timestamp to obtain a second time feature, wherein the above-mentioned second normalization process is a normalization process performed using a sine and cosine function; the third processing module is used to determine a holiday identifier based on the holiday information of the above-mentioned historical transaction data to obtain a third time feature, wherein when the above-mentioned holiday identifier is the first identifier, it indicates that the transaction time of the above-mentioned historical transaction data is a holiday, and when the above-mentioned holiday identifier is the second identifier, it indicates that the transaction time of the above-mentioned historical transaction data is a non-holiday; and the fourth processing module is used to obtain historical feature data of the above-mentioned transaction data based on the above-mentioned first time feature, the above-mentioned second time feature, and the above-mentioned third time feature. By applying periodic encoding to timestamps, the model’s generalization ability across different time periods can be enhanced, enabling it to not only learn trading patterns at specific points in time, but also generalize these patterns to similar time periods, such as weekend versus weekday trading patterns, or peak and trough periods throughout the day.

[0122] In some embodiments, the initial prediction model is one of the following: a random forest model, a gradient boosting machine, a convolutional neural network, a long short-term memory neural network, a gated recurrent unit, or a transformer. These embodiments utilize a suitable machine learning algorithm or deep learning model, trained on multi-dimensional features such as transaction time and server resource usage, to provide a dynamic chain-splitting strategy based on historical transaction predictions. This strategy addresses rapid changes in transaction volume and emergencies, ensuring efficient utilization of network resources and timely transaction processing.

[0123] The transaction allocation device for the blockchain network includes a processor and a memory. The acquisition unit and other components are stored as program units in the memory, and the processor executes the program units stored in the memory to implement the corresponding functions. The modules are all located in the same processor; alternatively, the modules can be located in different processors in any combination.

[0124] The processor contains a kernel, which retrieves the corresponding program unit from memory. One or more kernels can be configured, and kernel parameters can be adjusted to address existing blockchain network issues, such as difficulty processing all transactions in a timely manner, resulting in inefficiency and network congestion.

[0125] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0126] An embodiment of the present invention provides a computer-readable storage medium, which includes a stored program. When the program is run, the device where the computer-readable storage medium is located is controlled to execute the transaction allocation method of the blockchain network.

[0127] An embodiment of the present invention provides a processor, which is used to run a program, wherein the transaction allocation method of the blockchain network is executed when the program is run.

[0128] An embodiment of the present invention provides a device, comprising a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, at least the steps of the transaction allocation method of the blockchain network described above are implemented.

[0129] The devices in this article can be servers, PCs, PADs, mobile phones, etc.

[0130] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program for initializing at least the steps of the transaction allocation method of the above-mentioned blockchain network.

[0131] Obviously, those skilled in the art will appreciate that the various modules or steps of the present invention described above can be implemented using a general-purpose computing device, can be centralized on a single computing device, or can be distributed across a network of multiple computing devices. They can be implemented using program code executable by the computing device, and thus, can be stored in a storage device and executed by the computing device. In some cases, the steps shown or described herein can be performed in a different order than that shown, or can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0132] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0133] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0134] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0135] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0136] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0137] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0138] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.

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

[0140] From the above description, it can be seen that the above embodiments of the present application achieve the following technical effects:

[0141] 1) The transaction allocation method of the above-mentioned blockchain network of the present application first obtains new transaction data, determines the transaction type of the new transaction data and the characteristic data of the new transaction data; then, based on the transaction type of the new transaction data, inputs the characteristic data of the new transaction data into the corresponding network prediction model to predict the network identification data of the target blockchain network. The network prediction model is used to select a target blockchain network for processing new transaction data from multiple preliminary blockchain networks based on the transaction processing capabilities of the multiple preliminary blockchain networks; finally, based on the network identification data of the target blockchain network, the new transaction data is allocated to the target blockchain network for processing. This method uses classical machine learning algorithms or deep learning models to select the optimal blockchain network, improves the processing efficiency and response speed of the multi-chain blockchain system, and at the same time reduces resource waste and congestion caused by improper network selection, solving the problem that the blockchain network in the prior art is difficult to process all transactions in a timely manner, resulting in low efficiency and network congestion.

[0142] 2) The transaction allocation device for the blockchain network of the present application includes an acquisition unit, a prediction unit, and an allocation unit. The acquisition unit is used to first acquire new transaction data, determine the transaction type of the new transaction data, and the characteristic data of the new transaction data; the prediction unit is used to input the characteristic data of the new transaction data into the corresponding network prediction model based on the transaction type of the new transaction data, and predict the network identification data of the target blockchain network. The network prediction model is used to select a target blockchain network for processing the new transaction data from multiple preliminary blockchain networks based on the transaction processing capabilities of the multiple preliminary blockchain networks; the allocation unit is used to allocate the new transaction data to the target blockchain network for processing based on the network identification data of the target blockchain network. The device uses a classical machine learning algorithm or a deep learning model to select the optimal blockchain network, improve the processing efficiency and response speed of the multi-chain blockchain system, and at the same time reduce resource waste and congestion caused by improper network selection, solving the problem that the blockchain network in the prior art is difficult to process all transactions in a timely manner, resulting in low efficiency and network congestion.

[0143] The above description is merely a preferred embodiment of the present application and is not intended to limit the present application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present application shall be included within the scope of protection of the present application.

Claims

1. A transaction allocation method for a blockchain network, characterized in that: include: Acquire new transaction data, and determine a transaction type of the new transaction data and characteristic data of the new transaction data, wherein the characteristic data of the new transaction data represents a transaction time of the new transaction data, and the new transaction data is transaction data acquired at the current moment; Inputting characteristic data of the new transaction data into a corresponding network prediction model based on the transaction type of the new transaction data to predict network identification data of the target blockchain network, wherein the network prediction model is used to select a target blockchain network for processing the new transaction data from the multiple prepared blockchain networks based on their transaction processing capabilities, and the network identification data is used to uniquely identify the target blockchain network; According to the network identification data of the target blockchain network, the new transaction data is distributed to the target blockchain network for processing.

2. The method according to claim 1, characterized in that Before acquiring new transaction data, the method further includes: Determining a transaction processing type for each blockchain network, where the transaction processing type of the blockchain network is one of a first type, a second type, and a third type, wherein the first type is a type for processing transactions with a security level greater than a preset level and transactions with a small amount of data, the second type is a type for processing transactions with a priority level greater than or equal to a preset priority and transactions with a large amount of data, and the third type is a type for processing batch transactions; Determine that a type of the blockchain network corresponds to a type of the network prediction model, and the transaction processing type of the blockchain network corresponds one-to-one to the transaction type of the transaction data.

3. The method according to claim 1, characterized in that Before acquiring new transaction data, the method further includes: Acquire a plurality of historical transaction data and determine a transaction type and historical feature data of each of the historical transaction data, wherein the historical feature data of the historical transaction data is obtained based on a historical transaction time of the historical transaction data; Determining, according to the transaction type of the historical transaction data, the preliminary blockchain network corresponding to the transaction type of the historical transaction data; Determining a network score of each of the preliminary blockchain networks at the historical transaction time, wherein the network score represents a transaction processing capability of the corresponding preliminary blockchain network at the historical transaction time; Determining the preliminary blockchain network with the largest network score as the transaction blockchain network for the historical transaction data, wherein the transaction blockchain network is used to process the historical transaction data; An initial prediction model is obtained by using a deep learning method or a machine learning method, and the initial prediction model is trained using historical feature data of the historical transaction data and a transaction blockchain network corresponding to the historical transaction data to obtain the network prediction model.

4. The method according to claim 3, characterized in that Determining a network score of each of the prepared blockchain networks at the historical transaction time includes: Obtaining a network block number score, where the network block number score is related to the number of blocks of the preliminary blockchain network; Obtaining a server resource score, wherein the server resource score is related to the computing power of the server; According to the network block number score, the server resource score and the blockchain scoring model S=w1S block +w2S resource , determine the network score of the preliminary blockchain network, where S is the network score of the preliminary blockchain network, w1 is the first weighting coefficient, w2 is the second weighting coefficient, and S block Score the number of blocks of the network, S resource Score the server resources, w1>0, w2>0, w1+w2=1.

5. The method according to claim 4, characterized in that Obtain the network block number score, including: according to the first score calculation formula Determine the network block number score, where S block is the number of network blocks scored, B is the number of network blocks of the preliminary blockchain network at the time of the historical transaction, B min is the minimum number of blocks of all the prepared blockchain networks corresponding to the transaction type at the historical transaction time, B max is the maximum number of blocks of all the prepared blockchain networks corresponding to the transaction type at the historical transaction moment, and λ is a constant greater than 1; and / or, Obtain server resource scores, including: calculating the second score according to the formula Determine the server resource score, where S resource is the server resource score, C1j is a single-row m-column matrix, and the elements of each column in C1j are parameters that characterize the computing power of the server, k j is the weighting coefficient, k j >0, and 6. The method according to claim 3, characterized in that Determining historical characteristic data of each of the historical transaction data includes: Obtaining the timestamp and holiday information of the historical transaction data; Performing a first normalization process on the year feature, the month feature, and the date feature in the timestamp to obtain a first time feature, wherein the first normalization process is a normalization process performed using a scikit-learn library; Performing a second normalization process on the hour feature, minute feature, second feature, and millisecond feature in the timestamp to obtain a second time feature, wherein the second normalization process is a normalization process performed using a sine and cosine function; Determining a holiday identifier based on the holiday information of the historical transaction data to obtain a third time feature, wherein if the holiday identifier is a first identifier, it indicates that the transaction time of the historical transaction data is a holiday; and if the holiday identifier is a second identifier, it indicates that the transaction time of the historical transaction data is not a holiday; Historical feature data of the transaction data is obtained according to the first time feature, the second time feature, and the third time feature.

7. The method according to any one of claims 3 to 6, characterized in that The initial prediction model is one of the following: random forest model, gradient boosting machine, convolutional neural network, long short-term memory neural network, gated recurrent unit, transformer.

8. A transaction allocation device for a blockchain network, characterized in that: include: an acquiring unit, configured to acquire new transaction data and determine a transaction type of the new transaction data and characteristic data of the new transaction data, wherein the characteristic data of the new transaction data represents a transaction time of the new transaction data, and the new transaction data is transaction data acquired at the current moment; a prediction unit, configured to input characteristic data of the new transaction data into a corresponding network prediction model based on the transaction type of the new transaction data, and predict network identification data of a target blockchain network, wherein the network prediction model is configured to select a target blockchain network for processing the new transaction data from a plurality of prepared blockchain networks based on their transaction processing capabilities, and the network identification data is configured to uniquely identify the target blockchain network; An allocating unit is used to allocate the new transaction data to the target blockchain network for processing based on the network identification data of the target blockchain network.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored program, wherein, when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the transaction allocation method of the blockchain network according to any one of claims 1 to 7.

10. An electronic device, characterized in that: include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include a method for executing the transaction allocation method of the blockchain network according to any one of claims 1 to 7.