An ethanet transaction fee prediction method, system, device and medium
Patent Information
- Application Number
- CN202610899450.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-22
- Publication Date
- 2026-09-11
AI Technical Summary
然而,基于RNN的预测模型对长期依赖关系的捕捉能力有限,且由于区块链交易费历史数据以及相关外生变量数据规模庞大,单机串行的优化过程耗时过长,难以满足实际应用中实时预测的需求
本发明采用NBEATSx来建模交易费时间序列,纳入了多个与交易费预测任务相关的外生变量,并引入Spark并行计算框架实现DCNo-GWO的分布式并行优化,利用Spark集群并行计算各个体对应的适应度函数,从而在合理时间内同步完成最优超参数和最优外生变量子集的联合搜索,进而采用预训练后的NBEATSx预测模型,通过分布式混沌非线性灰狼优化器DCNo-GWO自动筛选最优外生变量子集,将外生变量影响特征与内生时序特征进行非线性融合映射,提取以太坊交易费时间序列中的长期依赖关系与多层次时序特征,可根据相关的外生变量自动重优化模型,相比现有基于RNN的方法,能够更精准地预测未来时刻的交易费,适应区块链网络状态的快速变化,实现交易费的近实时预测,显著降低预测误差。
Smart Images

Figure CN122736659A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of transaction fee prediction technology, and in particular to an Ethereum transaction fee prediction method, system, device and medium. Background Technology
[0002] Blockchain technology, characterized by its transparency, tamper resistance, decentralization, and traceability, has been widely applied in various fields such as finance, the Internet of Things (IoT), connected vehicles, the metaverse, and healthcare systems. Transactions, as a core element of blockchain, facilitate the decentralized transfer of digital assets. Specifically, a transaction is defined as the process of transferring cryptocurrency from one account or address to another within a blockchain network. Before a transaction is accepted, it must be verified by nodes (miners) in the blockchain; this process is managed by a consensus mechanism. Miners typically select transactions from a mempool, which contains transactions awaiting processing. Furthermore, blockchain protocols require transaction initiators to pay a transaction fee before the transaction begins.
[0003] Transaction fees are significantly correlated with the congestion level of blockchain networks. Because miners tend to prioritize transactions offering higher fees, users often increase their transaction fees to ensure timely confirmation. However, high transaction fees and long confirmation times degrade user experience, limiting the adoption and accessibility of blockchain applications and increasing the energy consumption of the entire transaction system. This has spurred extensive research into optimizing user transaction fee payment decisions. Therefore, leveraging big data from blockchain networks to accurately predict transaction fees can optimize user trading strategies, manage user fees, alleviate blockchain network congestion, and ultimately improve the overall user experience.
[0004] Currently, transaction fee prediction is considered a challenge in the field of time series forecasting. In recent years, deep learning has attracted widespread attention in time series forecasting, achieving significant progress in prediction accuracy. In particular, the application of various Recurrent Neural Networks (RNNs) has played a crucial role in enhancing prediction models. In RNN prediction, exogenous variables (such as network congestion, block size, miner hashrate, and cryptocurrency market volatility) play a key role in improving the prediction model, enabling it to identify complex relationships and causal connections between endogenous transaction fees and external factors, thereby improving the performance, reliability, and interpretability of the prediction results. However, RNN-based prediction models have limited ability to capture long-term dependencies, and due to the massive scale of historical blockchain transaction fee data and related exogenous variable data, the single-machine serial optimization process is too time-consuming, making it difficult to meet the real-time prediction requirements of practical applications. Summary of the Invention
[0005] The purpose of this invention is to address the shortcomings of the prior art by providing an Ethereum transaction fee prediction method, system, device, and medium to solve the problems in the prior art.
[0006] The present invention specifically provides the following technical solution: An Ethereum transaction fee prediction method includes the following steps: Obtain historical transaction fee time series data of the Ethereum blockchain network, as well as time series data of exogenous variables related to transaction fee prediction; The historical transaction fee time series data and exogenous variable time series data are input into the pre-trained NBEATSx prediction model. The hyperparameters of the NBEATSx prediction model and the subset of exogenous variables used are pre-optimized by the distributed chaotic nonlinear gray wolf optimizer DCNo-GWO. The DCNo-GWO uses a piecewise chaotic mapping to generate the initial population, updates the population position by a leader wolf guidance strategy that integrates neighborhood search and nonlinear weight allocation, and obtains the fitness function in parallel based on the Spark parallel computing framework to select the optimal hyperparameters and exogenous variable subset. The pre-trained NBEAT's prediction model is used to extract time-series features from historical transaction fee time series and exogenous variable influence features from exogenous variable time series. The extracted time-series features and exogenous variable influence features are then mapped to the prediction space nonlinearly, and the predicted Ethereum transaction fees for future moments are output based on the mapping results.
[0007] Preferably, the DCNo-GWO uses a piecewise chaotic mapping to generate the initial population, updates the population position through a leader wolf guidance strategy that integrates neighborhood search and nonlinear weight allocation, and obtains the fitness function in parallel based on the Spark parallel computing framework to screen the optimal subset of hyperparameters and exogenous variables, specifically: The DCNo-GWO method is used to define each set of parameter values in the NBEATSx prediction model as an individual in the population, and a piecewise chaotic mapping is used to generate an initial population from multiple sets of parameter values in the solution space; wherein, the parameters are the parameters to be optimized in the NBEATSx prediction model, including the model structure parameters, model training parameters and exogenous variable selection parameters of the NBEATSx model; The parameter combination corresponding to each individual in the initial population is iteratively updated using an individual nearest neighbor search strategy and a nonlinear weight update strategy. The optimal parameter combination is obtained by parallel search in the solution space based on the optimal fitness of the updated parameter combination. The fitness is constructed based on the mean absolute percentage error of the prediction.
[0008] Preferably, the model structure parameters, model training parameters, and exogenous variable selection parameters are as follows: Model structure parameters include: backtracking window length coefficient, number of hidden layer units in the first four layers of the block, number of hidden layer units in the last two layers of the block, stack type combination, number of blocks in each stack, polynomial order of the trend stack, and number of harmonic oscillation terms in the seasonal stack. Model training parameters include: batch size, learning rate, weight decay, learning rate decay rate, and second-order learning rate decay rate. The exogenous variable selection parameters include: a binary vector indicating whether to select the corresponding exogenous variable.
[0009] Preferably, the iterative update of the parameter combination corresponding to each individual in the initial population using an individual nearest neighbor search strategy and a nonlinear weight update strategy specifically involves: In the iteration, the position of individuals in the population is updated by introducing individual search behavior based on neighboring wolves, and nonlinear time-varying weights are assigned to the leader wolf. The parameter combination corresponding to each individual in the initial population is iteratively updated based on the updated position and nonlinear time-varying weights.
[0010] Preferably, the assignment of nonlinear time-varying weights to the leader wolf specifically involves: When there are multiple leader wolves in the population, the weights of different leader wolves are adjusted in different ways during the search process.
[0011] Preferably, the step of obtaining the optimal parameter combination in parallel search in the solution space based on the optimal fitness of the updated parameter combination specifically involves: Multiple initial solutions are obtained based on the initial population size, and the data format of the multiple initial solutions is converted; wherein, the initial solution is a combination of parameters; The fitness results of multiple initial solutions after format conversion are obtained in parallel, and the fitness results are sorted to obtain the optimal parameter combination in the solution space through parallel search based on the optimal fitness.
[0012] Preferably, the exogenous variable time series data related to transaction fee prediction includes: average gas price, average block size, Ethereum daily price, daily transaction volume, average block time, total number of unique addresses, number of unique receiving addresses, number of unique sending addresses, number of verification contracts, and number of deployed contracts.
[0013] This invention provides an Ethereum transaction fee prediction system, comprising: The data acquisition module is used to acquire historical transaction fee time series data of the Ethereum blockchain network, as well as time series data of exogenous variables related to transaction fee prediction; The data input module is used to input the historical transaction fee time series data and exogenous variable time series data into the pre-trained NBEATSx prediction model. The hyperparameters of the NBEATSx prediction model and the subset of exogenous variables used are pre-optimized by the distributed chaotic nonlinear gray wolf optimizer DCNo-GWO. The DCNo-GWO uses a piecewise chaotic mapping to generate an initial population, updates the population position through a leader wolf guidance strategy that integrates neighborhood search and nonlinear weight allocation, and obtains the fitness function in parallel based on the Spark parallel computing framework to select the optimal hyperparameters and subset of exogenous variables. The prediction module is used to extract time-series features from historical transaction fee time series and exogenous variable influence features from exogenous variable time series using a pre-trained NBEAT's prediction model. The extracted time-series features and exogenous variable influence features are then mapped to the prediction space non-linearly, and the predicted Ethereum transaction fees for future moments are output based on the mapping results.
[0014] The present invention provides a computer device, including a memory and a processor, wherein the memory stores a program, and when the program is executed by the processor, the processor performs the steps of the above-described Ethereum transaction fee prediction method.
[0015] The present invention provides a storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the Ethereum transaction fee prediction method described above.
[0016] Compared with the prior art, the present invention has the following significant advantages: This invention uses NBEATSX to model transaction fee time series, incorporating multiple exogenous variables related to the transaction fee prediction task. It introduces the Spark parallel computing framework to achieve distributed parallel optimization of DCNo-GWO, utilizing a Spark cluster to compute the fitness function corresponding to each individual in parallel. This allows for the simultaneous joint search of optimal hyperparameters and the optimal subset of exogenous variables within a reasonable timeframe. A pre-trained NBEATSX prediction model is then employed, automatically selecting the optimal subset of exogenous variables through the distributed chaotic nonlinear gray wolf optimizer DCNo-GWO. The influence features of exogenous variables are nonlinearly fused and mapped with endogenous time series features to extract long-term dependencies and multi-level time series features from the Ethereum transaction fee time series. The model can be automatically re-optimized based on relevant exogenous variables. Compared to existing RNN-based methods, this approach can more accurately predict future transaction fees, adapt to rapid changes in the blockchain network state, achieve near real-time transaction fee prediction, and significantly reduce prediction errors. Attached Figure Description
[0017] Figure 1 This is an architectural diagram of the NBEATSx of the present invention; Figure 2 This is a diagram illustrating the overall technical framework of the transaction fee prediction method in this invention. Figure 3 This is a flowchart of DCNo-GWO in this invention; Figure 4 This is the optimal fitness curve on the ETH dataset in this invention; Figure 5 This is the optimal fitness curve on the ETH-c dataset in this invention; Figure 6 This is a graph showing the DCNo-GWO time consumption under different conditions in this invention; Figure 7 This is a speedup graph of DCNo-GWO under different conditions in this invention. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0019] NBEATSx is an extension of Neural Basis Expansion Analysis for Interpretable Time Series Forecasting (NBEATS) that incorporates exogenous variables into its framework. This improvement not only enhances the performance of high-performance deep learning models with only fully connected and residual structures but also expands their capabilities by incorporating exogenous variables. NBEATSx demonstrates state-of-the-art (SOTA) performance in various time series forecasting tasks, including electricity price forecasting, runoff estimation, real-time hydrogen consumption assessment, and natural gas load forecasting, but it has not yet addressed transaction fee forecasting or blockchain-related tasks. Despite these advances, global optimization of hyperparameters within the NBEATSx framework remains a significant challenge in the field of deep learning. In summary, the research motivation for this invention is as follows:
[0020] Existing research on Ethereum transaction fee prediction has failed to effectively utilize exogenous variables. While NBEATSx, as a cutting-edge paradigm, demonstrates significant advantages in modeling time series data incorporating exogenous variables, its applicability in transaction fee prediction remains unproven. Furthermore, the parameter optimization problem of NBEATSx has not been thoroughly investigated. To date, no research has systematically identified the NBEATSx hyperparameters that require optimization.
[0021] Therefore, this invention proposes an improved heuristic algorithm aimed at optimizing the hyperparameters of NBEATSx, thereby facilitating the training of NBEATSx with an improved structural framework and performance results. This algorithm is called DCNo-GWO. Its main objective is to improve the efficiency and search capability of the original Grey Wolf Optimizer (GWO) algorithm. Ultimately, NBEATSx and DCNo-GWO are combined to predict future Ethereum transaction fees. The main contributions of this invention are as follows:
[0022] This paper is the first to use NBEATSSx to predict Ethereum transaction fees and identifies the hyperparameters that significantly impact NBEATSSx performance. It is also the first to apply a heuristic algorithm to optimize the hyperparameters affecting NBEATSSx performance while simultaneously filtering exogenous variables. The DCNo-GWO algorithm is proposed, which is an algorithm capable of efficiently optimizing the hyperparameters and optimal subset of exogenous variables of NBEATSSx without prior knowledge. The effectiveness of DCNo-GWO and the superiority of the optimized NBEATSSx are verified on two transaction fee datasets constructed in this invention.
[0023] The Impact of Transaction Fees on Blockchain: Transaction fees consist of two parts: base fees (Gas) and priority fees. Gas is the minimum price the network sets to ensure a transaction is included in a block. Priority fees are tips from users to miners, designed to incentivize them to prioritize specific transactions. In the Ethereum blockchain ecosystem, users can speed up transaction processing by increasing transaction fees. This practice not only promotes the decentralization of the Ethereum network but also provides a clear indicator of the risk of blockchain network overload. Typically, during periods of network congestion, average transaction fees (mempool) rise significantly because increasing the transaction fee cap in the transaction queue pool correlates with a reduction in the time required for transaction verification. Analysis of data from nearly 900 million blockchain transactions reveals a significant positive correlation between Gas and block utilization. Furthermore, the degree of blockchain network congestion and participants' risk preferences are key factors in differentiating optimal transaction fees across platforms with various block sizes.
[0024] This impact has spurred extensive research into optimizing user transaction fee payment decisions. For example, existing technologies have proposed a novel Monte Carlo-based method to determine the minimum price. The minimum price represents the amount a user needs to pay to ensure their transaction is executed with a specific probability within a given timeframe. Of course, predicting future transaction fees is an effective strategy for mitigating network congestion.
[0025] Transaction Fee Prediction: Transaction fee prediction is a type of time series forecasting task. Existing techniques utilize Long Short-Term Memory (LSTM) and Gated Recurrent Unit (GRU) models to predict natural gas prices. Their research found that LSTM and GRU outperform the Oracle model and natural gas price oracles. A comparative analysis of various machine learning models, particularly LSTM and GRU, and a hybrid architecture integrating Convolutional Neural Network (CNN) and LSTM, was conducted to predict transaction fees on Ethereum. The study found that the hybrid model outperformed other evaluated models. A hybrid CNN-LSTM model was proposed to predict transaction fees on the Ethereum network after EIP-1559, yielding similar conclusions to existing techniques. Similarly, the lowest fees for Quality of Service (QoS) were predicted using the Oracle model and Autoregressive Integrated Moving Average (ARIMA).
[0026] Clearly, current transaction fee prediction methods primarily employ a range of approaches utilizing recurrent neural networks. None of the aforementioned studies incorporated exogenous variables into their prediction models. Incorporating appropriate exogenous variables could potentially enhance model efficiency and interpretability, as demonstrated by ARMAX, ARIMAX, and temporary fusion transformers. However, current research on the application of exogenous variables in transaction fee prediction remains limited.
[0027] Applications of NBEATSx in Time Series Forecasting: NBEATSx is a deep learning-based neural network model initially proposed for electricity price forecasting. This study investigates the effectiveness of NBEATSx in predicting daily stock realization volatility over multiple time intervals, finding that it outperforms traditional time series forecasting models, including LSTM and temporal convolutional networks, in this specific application. Combining wavelet transform with the NBEATSx framework significantly improves runoff forecasting performance. Real-time estimation of hydrogen consumption for fuel cell vehicles is achieved using the NBEATSx model. The natural gas load series is analyzed using the STL time series decomposition technique, decomposing it into trend, seasonal, and residual components. These components are then used as inputs to the NBEATSx and XGBoost models to reduce the impact of noise in the original dataset. The forecast results generated by NBEATSx and XGBoost are then integrated using the inverse variance method to obtain the final forecast. Existing techniques utilize Copula entropy metrics to select predictors significantly correlated with active power output from offshore wind power generation. They then integrated auxiliary and historical power data from wind farms into NBEATSx to predict future wind power generation.
[0028] The aforementioned studies did not address the hyperparameter optimization problem of NBEATsx. Preliminary research was conducted on this problem, but it only focused on optimizing five parameters related to the NBEATsx optimizer, neglecting specific parameters of NBEATsx. While research on N-BEATs has provided valuable insights, studies on specific parameters of NBEATsx remain scarce.
[0029] Problem definition: Definition 1 (Transaction Fee Time Series): A transaction fee time series consists of a set of random variables. Composition, denoted as . This represents the total amount of transaction fees paid on the Ethereum network, and . It is a set of timestamps with equally spaced time intervals. Definition 2 (Exogenous Variable Time Series): An exogenous variable time series consists of multiple sets of random variables. Composition, denoted as . Represents the value of the exogenous variable, and Definition 3 (Transaction Fee Prediction): At a specified timestamp The complete set of transaction fees observed can be represented as The goal of transaction fee prediction is to utilize... and predict The transaction fee value is denoted as SL represents the length of the feed to be predicted.
[0030] NBEATSx inherits two unique model structures from N-BEATS: blocks and stacks. The architecture of NBEATSx is as follows: Figure 1 As shown.
[0031] The i-th block receives its corresponding input sequence and outputs two vectors. and For the first block, its corresponding sequence is the input to the entire NBEATSx, consisting of the lagged terms of the target time series and the exogenous variable time series X. For subsequent blocks, their input sequence is the residual output of the previous block.
[0032] The functionality of a block can be described as follows: (1); (2); (3); (4); Then, NBEATSx will expand the coefficients. and Mapping to output and Their calculation formulas are as follows: (5); (6); in, and These are the basis vectors for prediction and backtracking, respectively. yes The i-th element. Function and supply and This allows their outputs to be passed through and The changes are appropriately represented. There are three types of stacks: trend stack, seasonality stack, and exogenous variable stack, each corresponding to different... and The output of each block can be calculated using formula (7-9).
[0033] (7); (8); (9); For the trend stack, NBEATSX will and Constraints polynomial of order 1. Represents the time vector, defined from 0 to... On a discrete grid, it is used to predict future SL step data. Control harmonic oscillations. For seasonal stacks, NBEATSx will... and The constraint is a periodic function category. ,in It is a seasonal cycle. This refers to the number of exogenous variables. Clearly, the optimal combination of stacks differs for different datasets.
[0034] NBEATSx inherits a dual residual topology from N-BEATS. One branch is responsible for performing backtracking predictions, while the other branch is responsible for predicting the branch. This computation process can be described as follows:
[0035] (10); This architecture achieves more efficient gradient backpropagation through hierarchical decomposition. First, aggregate at the stack level, and then aggregate at the overall level of the NBEAT Sx framework.
[0036] The overall technical framework of the transaction fee prediction method proposed in this invention is as follows: Figure 2 As shown. This embodiment describes an Ethereum transaction fee prediction method, including the following steps:
[0037] Step 1: Obtain historical transaction fee time series data of the Ethereum blockchain network and time series data of exogenous variables related to transaction fee prediction.
[0038] Step 2: Input the historical transaction fee time series data and exogenous variable time series data into the pre-trained NBEATSx prediction model; the hyperparameters of the NBEATSx prediction model and the subset of exogenous variables used are pre-optimized by the distributed chaotic nonlinear gray wolf optimizer DCNo-GWO; DCNo-GWO uses piecewise chaotic mapping to generate the initial population, updates the population position through a leader wolf guidance strategy that integrates neighborhood search and nonlinear weight allocation, and obtains the fitness function in parallel based on the Spark parallel computing framework to select the optimal hyperparameters and exogenous variable subset.
[0039] The pre-training process of the NBEATSx prediction model is as follows: Determine the set of parameters to be optimized for the BEATSx prediction model; the parameter set includes the model structure parameters, model training parameters, and exogenous variable selection parameters of the BEATSx model, and the values of each set of parameters constitute a candidate solution in the solution space.
[0040] Based on comprehensive experiments, this invention summarizes the hyperparameters that have a significant impact on the performance of NBEATSx, as shown in Table 1.
[0041] Table 1 Summary of NBEATSx Hyperparameters A solution is a combination of a set of hyperparameters. It is worth noting that this invention simultaneously performs hyperparameter optimization and exogenous variable selection. Assume that Adam is used as the optimizer to train NBEATSx (some parameters are unique to Adam). A detailed description of the hyperparameters requiring special explanation is as follows:
[0042] The length of the Fee used to predict Fee' is determined. An empirical formula is provided, expressed as follows: (11); HU represents the number of hidden units in the first four fully connected layers of each block. TD represents the number of hidden units in the last two fully connected layers of each block. ST determines the stack type of NBEATSx. This invention maintains the default number of stacks, i.e., NBEATSx has three stacks. Therefore, there are a total of 27 stack combinations. BPS represents the number of blocks in each stack of NBEATSx. Each stack contains at least one block. Npd represents the number of polynomial terms in each trend stack. Nhr represents the number of harmonic oscillation terms in each seasonal stack. WD represents the change in LR relative to each training epoch.
[0043] (12); in, This represents the learning rate at the (i+1)th time.
[0044] EV represents a vector that determines the selection of exogenous variables. If evi=1, the i-th exogenous variable will be selected. If evi=0, the i-th exogenous variable will not be selected.
[0045] Exogenous variables for transaction fee prediction: We collected external variables that may affect transaction fee predictions from https: / / etherscan.io / , including: Average Gas Price: Represents the average daily gas price used in the Ethereum network.
[0046] Average Block Size: Represents the historical average block size of the Ethereum blockchain (in bytes).
[0047] Daily Price: Represents the historical price of Ethereum per day (in US dollars).
[0048] Daily Transactions: Represents the total number of transactions on the Ethereum blockchain each day.
[0049] Average Block Time: This represents the average time (in seconds) it takes for a block to be included in the Ethereum blockchain.
[0050] Unique Address Total Count: Represents the total number of unique addresses on the Ethereum blockchain.
[0051] Unique Address Receive Count: Represents the number of unique receive addresses on the Ethereum blockchain.
[0052] Unique Address Sent Count: Represents the number of unique sending addresses on the Ethereum blockchain.
[0053] Verified Contracts: This represents the total number of contracts verified daily.
[0054] Deployed Contracts: This represents the total number of historical contracts deployed on the Ethereum network.
[0055] Correlation analysis was performed using Pearson correlation coefficient (PCC), Spearman rank correlation coefficient (SRCC), and Kendall rank correlation coefficient (KRCC) to assess the effectiveness of the exogenous variables. The results are shown in Table 2. All exogenous variables were related to transaction costs; therefore, all of these variables were included in the forecasting method.
[0056] Table 2 Correlation analysis between exogenous variables and transaction costs (* indicates significance level p<0.01) Fitness function: The fitness function is the fundamental criterion for evaluating proposed solutions. This invention employs a fitness function based on MAPE. fitness It can be expressed as follows:
[0057] (13); Where SL represents the length of the Fee to be predicted. Indicates the initial solution The predicted value. MAPE is a dimensionless metric applicable to most time series datasets. Clearly, the novel optimization problem related to NBEATSx proposed in this invention can be classified as an NP-hard problem.
[0058] A distributed chaotic nonlinear gray wolf optimizer (DCNo-GWO) is used to define each set of values in the NBEATTSx prediction model as an individual in the population. An initial population is generated based on a piecewise chaotic mapping, with parameters being the parameters to be optimized in the NBEATTSx prediction model, including the model structure parameters, model training parameters, and exogenous variable selection parameters. The parameter combinations corresponding to each individual in the initial population are iteratively updated using an individual neighbor search strategy and a nonlinear weight update strategy. The optimal parameter combination is obtained by parallel searching in the solution space based on the optimal fitness of the updated parameter combination. The fitness is constructed based on the mean absolute percentage error of the prediction.
[0059] The specific parameters for model structure, model training, and exogenous variable selection are as follows: Model structure parameters include: backtracking window length coefficient, number of hidden layer units in the first four layers of a block, number of hidden layer units in the last two layers of a block, stack type combination, number of blocks in each stack, polynomial order of the trend stack, and number of harmonic oscillation terms in the seasonal stack; model training parameters include: batch size, learning rate, weight decay, learning rate decay rate, and second-order learning rate decay rate; exogenous variable selection parameters include: a binary vector indicating whether to select the corresponding exogenous variable.
[0060] The initial solution generation for DCNo-GWO is specifically as follows: When initiating a heuristic algorithm, an initial solution (initial population), denoted as NP, is typically generated randomly within a defined solution space [ub, lb]. To improve the quality of the initial solution, a piecewise chaotic map (PCM) is employed, a method for generating random sequences based on simple deterministic systems. Compared to traditional random number methods, PCM can improve the uniformity and diversity of the initial solution and achieve a more uniform distribution within the [ub, lb] interval.
[0061] The defining equation for the piecewise chaotic map (PCM) is as follows: (14); in, This represents the sequence value at time t+1. This represents the sequence value at time t. These are inherent parameters.
[0062] In step 2, during iteration, the positions of individuals in the population are updated by introducing individual search behavior based on neighboring wolves, and nonlinear time-varying weights are assigned to the leader wolf. The parameter combinations corresponding to each individual in the initial population are iteratively updated based on the updated positions and nonlinear time-varying weights. The specific processing procedure is as follows:
[0063] In the original Gray Wolf Optimizer (GWO), , and The leader of the wolf guides all Wolves move towards regions in the search space deemed favorable for finding optimal solutions. However, relying solely on this collective behavior can lead to reduced population diversity later in the optimization process, potentially causing convergence to local optima. To enhance population diversity, this invention proposes incorporating this individual search behavior by allowing individuals to obtain hunting information from their neighboring wolves.
[0064] The position of the i-th wolf in the t-th iteration is represented as follows: d represents the dimension of the problem to be optimized, and N represents the number of wolves in the wolf pack. The entire pack can be represented by a matrix, denoted as Wolves, which has N rows and d columns.
[0065] The neighboring wolf, denoted as It can be constructed as follows: (15); in, yes and The Euclidean distance between them. The hunting radius of wolf i can be defined as:
[0066] (16); New location obtained through additional search The following can be determined: (17); in, From Random sampling It was randomly sampled from Wolves. It is a random number between 0 and 1.
[0067] If subsequent generations are only influenced by three leader wolves, this will lead to a decrease in individual diversity within the population. Furthermore, given the pyramidal hierarchy of wolf packs, it is unrealistic for the three leader wolves to have equal status. This invention assigns non-linear, time-varying weights to the leader wolves; that is, when multiple leader wolves exist in the population, the weights of different leader wolves are adjusted in different ways during the search process, as shown below:
[0068] ; (18); in, The influence of the three leading wolves, They are respectively Wolf, wolves and The weight of wolves.
[0069] The goal of this improvement is to gradually allocate resources as the search process progresses. The wolf's weight is increased to 1. The wolf's weight gradually decreases to 0 over a specific period of time. The wolf's weight will gradually decrease to 0. Therefore, the following nonlinear weighting function is proposed:
[0070] (19); (20); (twenty one); Finally, the group search results and individual search results of the original GWO should be compared, and the optimal value should be taken as the result. Then add 1 to t.
[0071] Parallelization of DCNo-GWO: Although DCNo-GWO, as a heuristic algorithm, can provide a satisfactory solution within a finite time, its efficiency still has considerable room for improvement. To address this issue, a parallelized architecture for DCNo-GWO utilizing the Spark framework was developed.
[0072] The optimal parameter combination is obtained by parallel searching in the solution space based on the optimal fitness of the updated parameter combination, specifically: Multiple initial solutions are obtained according to the initial population size, and the data format of the multiple initial solutions is converted; wherein, the initial solution is a parameter combination; the fitness results of the multiple initial solutions after format conversion are obtained in parallel, and the fitness results are sorted, and the optimal parameter combination is obtained by parallel search in the solution space based on the optimal fitness.
[0073] Existing heuristic algorithms' parallel designs encompass the parallelization of all critical steps. However, this parallel design is not entirely suitable for DCNo-GWO, which works in the field of machine learning parameter optimization. A significant portion of DCNo-GWO's runtime originates from the computation time of the fitness function. NBEATSx requires training once for each fitness function computation. When initiating the parallelized algorithm, the Spark cluster needs time to perform basic operations, including job initiation, task allocation, and resource management. When the computational workload handled by the Executors within the Spark cluster is small, the overall parallelization performance is negatively impacted. Therefore, this invention develops a parallelized DCNo-GWO focused on the fitness function, the pseudocode of which is shown in Algorithm 1.
[0074] Algorithm 1: DCNo-GWO Parallelization Design Input: Population size Npop, maximum number of iterations Spark cluster parameters conf.
[0075] Output: Optimal parameter set .
[0076] Create a SparkContext object sc using conf.
[0077] Generate N initial solutions (pop).
[0078] Use sc.paralleize() to convert pop to RDD data format RDDpop.
[0079] The fitness function of each solution in RDDpop is computed in parallel using map(getFitness()).
[0080] Sort the fitness results and use collect() to return listfitness.
[0081] tmp = 0: While tmp ≥ do: Find the three leader wolves based on ListFitness. , , .
[0082] Update pop.
[0083] Use sc.paralleize() to convert pop to RDD data format RDDpop.
[0084] The fitness function of each solution in RDDpop is computed in parallel using map(getFitness()).
[0085] Sort the fitness results and use collect() to return listfitness.
[0086] Find the minimum value in listfitness: fitnessbest.
[0087] tmp = tmp + 1.
[0088] End while.
[0089] Decode the solution best corresponding to fitnessbest. .
[0090] End algorithm.
[0091] The solutions generated in DCNo-GWO are transformed into Resilient Distributed Datasets (RDD) format. This function acts as a distributed in-memory abstraction, evaluating the fitness of the solution set across a wide cluster using map(). Furthermore, collect() can initiate transformation operations such as map() that are not performed due to Spark's inherent lazy computation characteristics. Map(getFitness()) is the core of DCNo-GWO, as it processes each element in RDDpop with the specified getFitness(), resulting in a new RDD. Algorithm 2 provides the pseudocode for getFitness().
[0092] Algorithm 2 getFitness(): Input: training data datat, validation data datav, RDDpop.
[0093] Output: The fitness value corresponding to solutioni.
[0094] Decode solutioni in RDDpop into a parameter combination of NBEATSx and store it in a Set.
[0095] For i in Set do / / i is .
[0096] Train NBEATSx using i and datat.
[0097] The error mapei is calculated using datav.
[0098] Calculate fitnessi using i and mapei.
[0099] End for.
[0100] End algorithm.
[0101] In summary, the complete process of DCNo-GWO is as follows: Figure 3 As shown. Computational complexity: The overall computational complexity of the original GWO is... Due to the introduction of a neighborhood-based learning step, the computational complexity of DCNo-GWO increases to [value missing]. To balance this complexity, this invention reduced the DCNo-GWO in experiments. .
[0102] Step 3: Use the pre-trained NBEAT's prediction model to extract time-series features from historical transaction fee time series and exogenous variable influence features from exogenous variable time series. Then, map the extracted time-series features and exogenous variable influence features to the prediction space through nonlinear mapping and output the predicted Ethereum transaction fees for future times based on the mapping results.
[0103] The NBEATSx prediction model is configured using the optimal parameter combination, and the configured NBEATSx model is finally trained using historical transaction fee time series data and multiple exogenous variable time series data to obtain the mapping relationship between transaction fees and historical transaction fee data and exogenous variables.
[0104] Experiments: This invention aims to experimentally verify the performance of the proposed Distributed Chaotic Nonlinear Gray Wolf Optimizer (DCNo-GWO) in optimizing the hyperparameters of NBEATSx and selecting exogenous variables, and further evaluate the performance of NBEATSx optimized with DCNo-GWO in the transaction fee prediction task. The experimental analysis mainly revolves around the following four core research questions:
[0105] RQ1: Is DCNo-GWO the optimal algorithm for optimizing NBEATSx hyperparameters and selecting exogenous variables? RQ2: Can parallelization improve computational efficiency in DCNo-GWO? RQ3: Can incorporating exogenous variables improve the accuracy of transaction fee forecasts? RQ4: Is the method proposed in this invention the state-of-the-art (SOTA) method in the field of transaction fee prediction? Data and Experimental Setup: The Ethereum transaction fee data and related exogenous variable data used in this invention are all sourced from https: / / etherscan.io / . This data was processed and converted into a time series format. Based on this data, this invention constructed two datasets: a smaller ETH dataset and a larger ETH-c dataset. To simplify the calculation process, this invention uniformly divided transaction fees by 1x1020. Specific information for these two datasets is shown in Table 3.
[0106] Table 3 Dataset Description The test set is divided into Each subset contains a corresponding input and output result.
[0107] (twenty two); in, yb The sample size is given. This study uses mean absolute error (MAE) and mean absolute percentage error (MAPE) as evaluation indicators.
[0108] Convergence Test (RQ1): According to the No Free Lunch theorem, this invention cannot directly determine which optimization algorithm is suitable for hyperparameter optimization of NBEATSx. Therefore, this study compares and analyzes the performance of DCNo-GWO with other heuristic algorithms in optimizing hyperparameters of NBEATSx to highlight the advantages of DCNo-GWO. The heuristic algorithms compared include: GWO, Differential Evolution (DE), Multiverse optimizer (MVO), Flow Direction Algorithm (FDA), Flower pollination algorithm (FPA), Sine cosine algorithm (SCA), Student Psychology Based Optimization (SPBO), Whale Optimization Algorithm (WOA), and Path finding algorithm (PHA).
[0109] In the experimental setup, the population size... It was set to 20. To balance the convergence capability introduced by the additional search strategy, DCNo-GWO's... The maximum number of iterations, MaxIter, was set to 10. The maximum number of iterations for all algorithms, MaxIter, was set to 25, a value considered sufficient to ensure the convergence of these heuristics. Table 5 shows the experimental results regarding the convergence capabilities of the heuristics.
[0110] Table 5. Experimental results on the convergence capability of the heuristic algorithm. As shown in Table 5, on the ETH dataset, DCNo-GWO achieved an average fitness value 2.05% higher than the second-ranked algorithm; on the ETH-c dataset, DCNo-GWO's average fitness value was 0.71% higher than the second-ranked algorithm. GWO performed second only to DCNo-GWO, further confirming the rationale for using GWO as the base algorithm. The standard deviations of all algorithms were within acceptable ranges. Furthermore, DCNo-GWO achieved the lowest average MAE and average MAPE values on both datasets, indicating that DCNo-GWO exhibited superior convergence ability compared to other algorithms. Figure 4 and Figure 5 The fitness convergence curves corresponding to the optimal results obtained by each heuristic algorithm are shown.
[0111] Scalability Experiment (RQ2): In this experiment, DCNo-GWO is applied to different cluster configurations, including a single node (running independently), a cluster of 2 nodes, a cluster of 4 nodes, and a cluster of 8 nodes, to evaluate the execution time and corresponding speedup of the algorithm. The high-performance computing cluster used in the experiment belongs to Beijing China High Performance Computing Technology Co., Ltd. The dataset used in the experiment is the ETH dataset.
[0112] acceleration ratio Speeddup It is the most intuitive indicator for measuring parallel efficiency and scalability, and its definition is as follows: (twenty three); in, This represents the time required for sequential calculation. Indicates the use of The time required for each node to perform parallel computation. Ideally, the speedup should be equal to... . Figure 6 and Figure 7 The experimental results are presented.
[0113] like Figure 6As shown, the computation time of DCNo-GWO gradually increases with the increase in computational load. When the computational load is low, the speedup achieved by DCNo-GWO is relatively low. This phenomenon can be attributed to the limited speedup provided by the Spark cluster, mainly due to inherent operations such as cluster startup, task allocation, and resource allocation. However, as computational demands gradually increase, the advantages of the proposed parallel architecture become increasingly apparent, causing the speedup of DCNo-GWO to gradually approach its ideal value.
[0114] Figure 7 The results clearly demonstrate that, under different node configurations, the speedup of DCNo-GWO gradually increases with the number of nodes, eventually approaching the ideal speedup. This result indicates that as the scale of the computational task expands, DCNo-GWO can fully utilize cluster resources to achieve efficient parallel computing, thereby significantly reducing computation time. Furthermore, this parallelization method does not negatively impact the training data, thus ensuring the performance of DCNo-GWO. In summary, the experimental results fully demonstrate the strong scalability of DCNo-GWO in parallel computing environments, enabling it to effectively handle large-scale computational tasks and providing powerful support for solving complex problems.
[0115] Prediction Performance Comparison (RQ3 and RQ4): To evaluate the effectiveness of the proposed method, it was compared with existing state-of-the-art transaction fee prediction techniques using the two datasets mentioned above. The transaction fee prediction methods included in the comparison are:
[0116] ARIMA: An ARIMA model optimized via grid search, designed to predict the minimum transaction fees for Quality of Service (QoS). CNN-LSTM: A hybrid architecture combining a two-layer CNN with a single-layer LSTM for predicting transaction fees on Ethereum. N-BEATS: An N-BEATS model with default parameters. ARDE-N-BEATS: An N-BEATS model with hyperparameters optimized via differential evolution, excluding BT, Npd, Nhr, and EV. DIGWO-N-BEATS: An N-BEATS model with hyperparameters optimized via an improved Grey Wolf optimizer, excluding Npd, Nhr, and EV. NBEATSx: An NBEATSx model with default parameters.
[0117] During the experiments, this invention first emphasizes the importance of referring to the hyperparameters listed above. When these parameters are unavailable, this invention reconstructs the method based on two Ethereum datasets using the optimized hyperparameters. The experimental results are shown in Table 6.
[0118] Table 6 Comparison of the SOTA method and the method of this invention As can be clearly seen from Table 6, the transaction fee prediction method proposed in this invention outperforms other baseline models on both datasets. Compared with the most competitive baseline models, the model of this invention reduces MAPE by 2.2% and 2.77% on the two datasets, and MAE by 6.59% and 0.71%, respectively.
[0119] The method of this invention fully leverages the inherent advantages of NBEATSx, significantly outperforming ARIMA and LSTM+CNN in prediction performance. Through parameter optimization, the method of this invention substantially surpasses NBEATSx in performance. Compared to N-BEATS, the NBEATSx model reduces MAPE by 16.86% and 2.07%, respectively, which fully demonstrates the effectiveness of incorporating exogenous variables in transaction fee prediction tasks. In the optimal hyperparameter combination obtained by DCNo-GWO, all exogenous variables are included except for validated and deployed contracts. In summary, the experimental results fully verify that the transaction fee prediction method proposed in this invention is the current state-of-the-art (SOTA) in the field of transaction fee prediction.
[0120] Conclusion: This invention proposes a novel transaction fee prediction method, and its performance has been validated through multiple experiments. The results show that this method outperforms current state-of-the-art methods in terms of consistency on the Ethereum dataset, while employing a less complex network architecture. This research is of significant importance for analyzing blockchain network congestion.
[0121] This invention proposes an Ethereum transaction fee prediction system, comprising: a data acquisition module, a data input module, and a prediction module.
[0122] The system comprises several modules: a data acquisition module for acquiring historical transaction fee time-series data of the Ethereum blockchain network and time-series data of exogenous variables related to transaction fee prediction; a data input module for inputting the historical transaction fee time-series data and exogenous variable time-series data into the pre-trained NBEATSx prediction model; the hyperparameters of the NBEATSx prediction model and the subset of exogenous variables used are pre-optimized by the Distributed Chaotic Nonlinear Gray Wolf Optimizer (DCNo-GWO); DCNo-GWO uses piecewise chaotic mapping to generate the initial population, updates the population position through a leader wolf guidance strategy that integrates neighborhood search and nonlinear weight allocation, and obtains the fitness function in parallel based on the Spark parallel computing framework to select the optimal hyperparameters and exogenous variable subset; and a prediction module for extracting temporal features from the historical transaction fee time series and exogenous variable influence features from the exogenous variable time series using the pre-trained NBEATSx prediction model, mapping the extracted temporal features and exogenous variable influence features to the prediction space nonlinearly, and outputting the predicted Ethereum transaction fee values for future times based on the mapping results.
[0123] The present invention also provides a computer device, including a memory and a processor, wherein the memory stores a program, and when the program is executed by the processor, the processor performs the steps of an Ethereum transaction fee prediction method.
[0124] According to the disclosed embodiments, the computer device can communicate with one or more external devices (e.g., keyboard, pointing device, Bluetooth communication, etc.) or with any device that enables the computing device to communicate with one or more other computing devices (e.g., router, demodulator, etc.).
[0125] The present invention also provides a storage medium storing a computer program thereon, characterized in that the computer program, when executed by a processor, implements the steps of an Ethereum transaction fee prediction method.
[0126] According to the disclosed embodiments, the storage medium can be a non-volatile computer-readable storage medium, such as, but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this invention, the storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0127] The above description, in conjunction with specific preferred embodiments, provides a more detailed explanation of the present invention. For those skilled in the art, various simple deductions or substitutions can be made without departing from the concept of the present invention, and all such deductions or substitutions should be considered to fall within the scope of protection of the present invention.
Claims
1. A method for predicting Ethereum transaction fees, characterized in that, Including the following steps: Obtain historical transaction fee time series data of the Ethereum blockchain network, as well as time series data of exogenous variables related to transaction fee prediction; The historical transaction fee time series data and exogenous variable time series data are input into the pre-trained NBEATSx prediction model. The hyperparameters of the NBEATSx prediction model and the subset of exogenous variables used are pre-optimized by the distributed chaotic nonlinear gray wolf optimizer DCNo-GWO. The DCNo-GWO uses a piecewise chaotic mapping to generate the initial population, updates the population position by a leader wolf guidance strategy that integrates neighborhood search and nonlinear weight allocation, and obtains the fitness function in parallel based on the Spark parallel computing framework to select the optimal hyperparameters and exogenous variable subset. The pre-trained NBEAT's prediction model is used to extract time-series features from historical transaction fee time series and exogenous variable influence features from exogenous variable time series. The extracted time-series features and exogenous variable influence features are then mapped to the prediction space nonlinearly, and the predicted Ethereum transaction fees for future moments are output based on the mapping results.
2. The Ethereum transaction fee prediction method as described in claim 1, characterized in that, The DCNo-GWO uses a piecewise chaotic mapping to generate the initial population, updates the population position through a leader wolf guidance strategy that integrates neighborhood search and nonlinear weight allocation, and obtains the fitness function in parallel based on the Spark parallel computing framework to select the optimal subset of hyperparameters and exogenous variables. Specifically: The DCNo-GWO method is used to define each set of parameter values in the NBEATSx prediction model as an individual in the population, and a piecewise chaotic mapping is used to generate an initial population from multiple sets of parameter values in the solution space; wherein, the parameters are the parameters to be optimized in the NBEATSx prediction model, including the model structure parameters, model training parameters and exogenous variable selection parameters of the NBEATSx model; The parameter combination corresponding to each individual in the initial population is iteratively updated using an individual nearest neighbor search strategy and a nonlinear weight update strategy. The optimal parameter combination is obtained by parallel search in the solution space based on the optimal fitness of the updated parameter combination. The fitness is constructed based on the mean absolute percentage error of the prediction.
3. The Ethereum transaction fee prediction method as described in claim 2, characterized in that, The specific model structure parameters, model training parameters, and exogenous variable selection parameters are as follows: Model structure parameters include: backtracking window length coefficient, number of hidden layer units in the first four layers of the block, number of hidden layer units in the last two layers of the block, stack type combination, number of blocks in each stack, polynomial order of the trend stack, and number of harmonic oscillation terms in the seasonal stack. Model training parameters include: batch size, learning rate, weight decay, learning rate decay rate, and second-order learning rate decay rate. The exogenous variable selection parameters include: a binary vector indicating whether to select the corresponding exogenous variable.
4. The Ethereum transaction fee prediction method as described in claim 2, characterized in that, The step of iteratively updating the parameter combination corresponding to each individual in the initial population using an individual nearest neighbor search strategy and a nonlinear weight update strategy is as follows: In the iteration, the position of individuals in the population is updated by introducing individual search behavior based on neighboring wolves, and nonlinear time-varying weights are assigned to the leader wolf. The parameter combination corresponding to each individual in the initial population is iteratively updated based on the updated position and nonlinear time-varying weights.
5. The Ethereum transaction fee prediction method as described in claim 4, characterized in that, The assignment of nonlinear time-varying weights to the leader wolf is specifically as follows: When there are multiple leader wolves in the population, the weights of different leader wolves are adjusted in different ways during the search process.
6. The Ethereum transaction fee prediction method as described in claim 2, characterized in that, The process of obtaining the optimal parameter combination in parallel search of the solution space based on the optimal fitness of the updated parameter combination is specifically as follows: Multiple initial solutions are obtained based on the initial population size, and the data format of the multiple initial solutions is converted; wherein, the initial solution is a combination of parameters; The fitness results of multiple initial solutions after format conversion are obtained in parallel, and the fitness results are sorted to obtain the optimal parameter combination in the solution space through parallel search based on the optimal fitness.
7. The Ethereum transaction fee prediction method as described in claim 1, characterized in that, The exogenous variable time series data related to transaction fee prediction includes: average gas price, average block size, Ethereum daily price, daily transaction volume, average block time, total number of unique addresses, number of unique receiving addresses, number of unique sending addresses, number of validating contracts, and number of deployed contracts.
8. An Ethereum transaction fee prediction system, characterized in that, include: The data acquisition module is used to acquire historical transaction fee time series data of the Ethereum blockchain network, as well as time series data of exogenous variables related to transaction fee prediction; The data input module is used to input the historical transaction fee time series data and exogenous variable time series data into the pre-trained NBEATSx prediction model. The hyperparameters of the NBEATSx prediction model and the subset of exogenous variables used are pre-optimized by the distributed chaotic nonlinear gray wolf optimizer DCNo-GWO. The DCNo-GWO uses a piecewise chaotic mapping to generate an initial population, updates the population position through a leader wolf guidance strategy that integrates neighborhood search and nonlinear weight allocation, and obtains the fitness function in parallel based on the Spark parallel computing framework to select the optimal hyperparameters and subset of exogenous variables. The prediction module is used to extract time-series features from historical transaction fee time series and exogenous variable influence features from exogenous variable time series using a pre-trained NBEAT's prediction model. The extracted time-series features and exogenous variable influence features are then mapped to the prediction space non-linearly, and the predicted Ethereum transaction fees for future moments are output based on the mapping results.
9. A computer device, characterized in that, The device includes a memory and a processor, wherein the memory stores a program that, when executed by the processor, causes the processor to perform the steps of an Ethereum transaction fee prediction method as described in any one of claims 1 to 7.
10. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of an Ethereum transaction fee prediction method according to any one of claims 1 to 7.