Blockchain Transaction Fee Forecasting: A Comparison of Machine Learning Methods
Abstract
:1. Introduction
- First and foremost, the time period studied is in the aftermath of the so-called Ethereum London Hard Fork when the immediate aftereffects of this had passed. In particular, we feel that Research Question 3 of our study provides an update on Pierro and Rocha’s work of 2019 [23] on the link between EthUSD/BitUSD and gas price.
- This study is the first that we have found to investigate performance over different forecast horizons. These time horizons are useful, as a user must select between these and potentially be penalized in terms of cost or missed transactions for choosing one over the other. There is thus a real cost penalty for the user in not choosing correctly here.
- In our study, we use multiple approaches: a direct-recursive hybrid LSTM forecasting approach, inclusion of an attention mechanism with the matrix profile, as seen applied to low-granularity daily COVID data and also Convolutional Neural Networks (CNNs), fed to LSTM architectures, or CNN-LSTMs. In the case of matrix profiles, this is the first incidence that we could find of the use of the method in gas price prediction.
2. Glossary
Ethereum Network Terminology [4]
- Block: Batch of transactions added to the blockchain.
- Contract/Smart Contract: Complex transaction, with clauses and dependencies for operation; not a simple transfer of ETH. Basis of complex applications.
- ETH: Ether, cryptocurrency of the Ethereum network.
- Gas: Unit of computational work completed when processing transaction on the Ethereum network. The gas required to process transactions increases with transaction complexity.
- Gas Price: Fee paid to miners by transaction sender, per unit of gas, to process a transaction and include it in the blockchain. Operates on priority queuing basis: the highest gas price transactions are selected by miners, the gas price is selected by transaction senders. Price is typically quoted in gwei.
- Gwei: The denomination of ETH cryptocurrency. One ETH is equivalent to 1018 wei. A giga-wei, or gwei, is equivalent to 109 wei, or 10-9 ETH. All gas price values given in this work are in gwei.
- Mempool: Cryptocurrency nodes that function as a way to store data on unconfirmed transactions, acting as a transaction waiting room prior to inclusion in a block.
- Miner: Third party that performs necessary computations for the inclusion of transaction on the blockchain, at a fee.
- Transaction: Cryptographically signed instruction from one Ethereum network account to another, which includes simple ETH transfer and more complex contract deployments that allow for various applications on the network.
3. Gas Price Mechanics Literature Survey
3.1. Economics of Ethereum Gas Price
3.2. Influencing Factors on Ethereum Gas Price
3.3. Experiences around the Ethereum Hard Fork
4. Previous Work on Gas Price Prediction
4.1. The Role and Performance of Gas Price Oracles
4.2. Time Series Signal Processing and Data Mining
4.3. Deep Learning Models
4.4. Research Gaps and Innovations
- While a number of authors have covered the time period following the Ethereum London Fork (e.g., Refs. [26,27,28]), cited above, we feel that the relationship between EthUSD/BitUSD and gas price posited in Research Question 3 of our study provides an update on Pierro and Rocha’s work of 2019 [24] on the link. This, we think, is an important addition to the corpus of research given the wide fluctuations in the price of cryptocurrencies.
- Specifically investigating the performance of forecasts over different horizons. These time horizons are useful, as a user must select between these and potentially be penalized in terms of cost or missed transactions for choosing one over the other. There is thus a real cost penalty for the user in not choosing correctly here.
- In our study, we use multiple approaches: a direct-recursive hybrid LSTM forecasting approach, inclusion of an attention mechanism with the matrix profile, as seen applied to low-granularity daily COVID data and also Convolutional Neural Networks (CNNs) fed to LSTM architectures or CNN-LSTMs.
5. Materials and Methods
5.1. Research Framework and Methodology
5.2. Description of Dataset
5.3. Wavelet Coherence
5.4. Wavelet Denoising
5.5. Down-Sampling and Normalization
5.6. Matrix Profile
6. Methods for Data Modeling
6.1. Long Short-Term Memory (LSTM)
6.2. Recursive and Hybrid Strategies
6.3. Encoder–Decoder and Attention Mechanism
6.4. CNN-LSTM
6.5. Training Strategies
7. Results
7.1. Wavelet Coherence
7.2. Single Step Lookahead
7.3. Hybrid Models
7.4. CNN-LSTM
7.5. Attention
7.6. Matrix Profile
7.7. Wavelet Denoising
8. Discussion
8.1. Research Questions
8.2. Comparison with Previous Works
9. Conclusions
9.1. Summary
9.2. Contributions
9.3. Limitations of the Study
9.4. Future Work
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- etherscan.io. Ethereum Daily Transactions Chart. Available online: https://etherscan.io/chart/tx (accessed on 27 April 2023).
- Ethereum.org. Ethereum Development Documentation. Available online: https://ethereum.org/en/developers/docs/ (accessed on 21 April 2023).
- Feng, Y.; Sun, Y.; Qu, J. An Attention-GRU Based Gas Price Prediction Model for Ethereum Transactions. In Signal and Information Processing, Networking and Computers. Lecture Notes in Electrical Engineering; Sun, J., Wang, Y., Huo, M., Xu, L., Eds.; Springer: Singapore, 2023; Volume 917. [Google Scholar] [CrossRef]
- Zarir, A.A.; Oliva, G.A.; Jiang, Z.M.; Hassan, A.E. Developing Cost-Effective Blockchain-Powered Applications: A Case Study of the Gas Usage of Smart Contract Transactions in the Ethereum Blockchain Platform. ACM Trans. Softw. Eng. Methodol. 2021, 30, 28. [Google Scholar] [CrossRef]
- Coinfyi. Constitution DAO Will Pay More than $1.5 Million in “Gas Fees”. Available online: https://coin.fyi/news/ethereum/constitutiondao-will-paymore-than-1-5-million-in-gas-fees-r0gndz (accessed on 10 March 2022).
- Oosterbaan, E. Ethereum’s Hotly Anticipated ‘London’ Hard Fork Is Now Live. Coindesk, 5 August 2021. Available online: https://www.coindesk.com/tech/2021/08/05/ethereums-hotly-anticipated-london-hard-fork-is-now-live/(accessed on 22 April 2023).
- Cai, L.; Li, Q.; Liang, X. Introduction to Blockchain Basics. In Advanced Blockchain Technology; Springer: Singapore, 2022. [Google Scholar] [CrossRef]
- Scharfman, J. Additional Topics in Blockchain and Distributed Ledger Technology. In Cryptocurrency Compliance and Operations; Palgrave Macmillan: Cham, Switzerland, 2022. [Google Scholar] [CrossRef]
- OriginStamp. What Is the Ethereum London Hard Fork and How Does It Impact Token Holders? 2022. Available online: https://originstamp.com/blog/what-is-the-ethereum-london-hard-fork-and-how-does-it-impact-token-holders/ (accessed on 21 April 2023).
- geth.ethereum.org. Go Ethereum. Available online: https://geth.ethereum.org/ (accessed on 10 November 2021).
- EthGasStation. Available online: https://ethgasstation.info/ (accessed on 29 July 2022).
- GasStation—Express. Available online: https://github.com/ethgasstation/gasstationexpress-oracle (accessed on 29 July 2022).
- Caldarelli, G. Overview of Blockchain Oracle Research. Future Int. 2022, 14, 175. [Google Scholar] [CrossRef]
- Mars, R.; Abid, A.; Cheikhrouhou, S.; Kallel, S. A Machine Learning Approach for Gas Price Prediction in Ethereum Blockchain. In Proceedings of the IEEE 45th Annual Computers, Software, and Applications Conference (COMPSAC), Madrid, Spain, 12–16 July 2021; pp. 156–165. [Google Scholar] [CrossRef]
- Werner, S.M.; Pritz, P.J.; Perez, D. Step on the Gas? A Better Approach for Recommending the Ethereum Gas Price. In Proceedings of the 2nd International Conference on Mathematical Research for Blockchain Economy (MARBLE 2020), Online, 24 August 2020; pp. 161–177. [Google Scholar] [CrossRef]
- Garrigan, J.; Crane, M.; Bezbradica, M. Received Total Wideband Power Data Analysis: Multiscale wavelet analysis of RTWP data in a 3G network. In Proceedings of the 22nd International ACM Conference on Modeling, Analysis and Simulation of Wireless and Mobile Systems, Miami Beach, FL, USA, 25–29 November 2019. [Google Scholar] [CrossRef]
- Sun, Q.; Xu, W. Wavelet analysis of the co-movement and lead–lag effect among multi-markets. Phys. A Stat. Mech. Its Appl. 2018, 512, 489–499. [Google Scholar] [CrossRef]
- Guo-Qing, Q.; Bin, Z.; Xiao-Qing, S. Wavelet Correlation Analysis of Geodetic Signals. In Proceedings of the 2009 Fifth International Conference on Natural Computation, Tianjian, China, 14–16 August 2009; Volume 6, pp. 585–590. [Google Scholar] [CrossRef]
- Liu, Q.; Fung, D.L.X.; Lac, L.; Hu, P. A Novel Matrix ProfileGuided Attention LSTM Model for Forecasting COVID-19 Cases in USA. Front. Public Health 2021, 9, 741030. [Google Scholar] [CrossRef] [PubMed]
- Chandra, R.; Goyal, S.; Gupta, R. Evaluation of Deep Learning Models for Multi-Step Ahead Time Series Prediction. IEEE Access 2021, 9, 83105–83123. [Google Scholar] [CrossRef]
- Dyllon, S.; Xiao, P. Wavelet Transform for Educational Network Data Traffic Analysis. In Wavelet Theory and Its Applications; IntechOpen: London, UK, 2018. [Google Scholar] [CrossRef]
- Qiu, J.; Wang, B.; Zhou, C. Forecasting stock prices with longshort term memory neural network based on attention mechanism. PLoS ONE 2020, 15, e0227222. [Google Scholar] [CrossRef] [PubMed]
- Pierro, G.A.; Rocha, H. The Influence Factors on Ethereum Transaction Fees. In Proceedings of the 2019 IEEE/ACM 2nd International Workshop on Emerging Trends in Software Engineering for Blockchain (WETSEB), Montreal, Canada, 27 May 2019; pp. 24–31. [Google Scholar] [CrossRef]
- Donmez, A.; Karaivanov, A. Transaction fee economics in the Etheeum blockchain. Econ. Inq. 2022, 60, 265–292. [Google Scholar] [CrossRef]
- Liu, F.; Wang, X.; Li, Z.; Xu, J.; Gao, Y. Effective GasPrice Prediction for Carrying Out Economical Ethereum Transaction. In Proceedings of the 2019 6th International Conference on Dependable Systems and Their Applications (DSA), Harbin, China, 3–6 January 2020; pp. 329–334. [Google Scholar] [CrossRef]
- Roughgarden, T. Transaction Fee Mechanism Design. arXiv 2021, arXiv:2106.01340. [Google Scholar] [CrossRef]
- Reijsbergen, D.; Sridhar, S.; Monnot, B.; Leonardos, S.; Skoulakis, S.; Piliouras, G. Transaction Fees on a Honeymoon: Ethereum’s EIP-1559 One Month Later. In Proceedings of the 2021 IEEE International Conference on Blockchain (Blockchain), Melbourne, Australia, 6–8 December 2021; pp. 196–204. [Google Scholar] [CrossRef]
- Liu, Y.; Lu, Y.; Nayak, K.; Zhang, F.; Zhang, L.; Zhao, Y. Empirical analysis of eip-1559: Transaction fees, waiting time, and consensus security. arXiv 2022, preprint. arXiv:2201.05574. [Google Scholar]
- Lan, D.; Wang, H.; Yin, C.; Zhou, L.; Ge, C.; Lu, X. Gas Price Prediction Based on Machine Learning Combined with Ethereum Mempool. In Proceedings of the 2022 IEEE 19th International Conference on Mobile Ad Hoc and Smart Systems (MASS), Denver, CO, USA, 20–22 October 2022; pp. 346–354. [Google Scholar] [CrossRef]
- Beniiche, A. A Study of Blockchain Oracles. arXiv 2020. Available online: https://arxiv.org/pdf/2004.07140.pdf (accessed on 31 March 2023).
- Pierro, G.A.; Rocha, H.; Tonelli, R.; Ducasse, S. Are the Gas Prices Oracle Reliable? A Case Study using the EthGasStation. In Proceedings of the 2020 IEEE International Workshop on Blockchain Oriented Software Engineering (IWBOSE), London, ON, Canada, 18 February 2020; pp. 1–8. [Google Scholar] [CrossRef]
- Pierro, G.A.; Rocha, H.; Ducasse, S.; Marchesi, M.; Tonelli, R. A user-oriented model for Oracles’ Gas price prediction. Future Gener. Comput. Syst. 2022, 128, 142–157. [Google Scholar] [CrossRef]
- Turksonmez, K.; Furtak, M.; Wittie, M.P.; Millman, D.L. Two Ways Gas Price Oracles Miss the Mark. In Proceedings of the 2021 IEEE International Conference on Omni-Layer Intelligent Systems (COINS), Barcelona, Spain, 23–25 July 2021; pp. 1–7. [Google Scholar] [CrossRef]
- Chuang, C.; Lee, T. A Practical and Economical Bayesian Approach to Gas Price Prediction. In Lecture Notes in Networks and Systems, Proceedings of the International Conference on Deep Learning, Big Data and Blockchain (Deep-BDB 2021), Online Conference, 23–25 August 2021; Awan, I., Benbernou, S., Younas, M., Aleksy, M., Eds.; Springer: Cham, Switzerland, 2022; Volume 309. [Google Scholar] [CrossRef]
- Laurent, A.; Brotcorne, L.; Fortz, B. Transaction fees optimization in the Ethereum blockchain. Blockchain Res. Appl. 2022, 3, 100074. [Google Scholar] [CrossRef]
- Barry, B.; Crane, M. Analysis of Cryptocurrency Commodities with Motifs and LSTM. In CEUR Workshop Proceedings 2563, Proceedings of the 27th AIAI Irish Conference on Artificial Intelligence and Cognitive Science, Galway, Ireland, 5–6 December 2019; Curry, E., Keane, M.T., Ojo, A., Salwala, D., Eds.; CEUR-WS.org: Aachen, Germany, 2020; Available online: https://ceur-ws.org/Vol-2563/aics_5.pdf (accessed on 22 April 2023).
- Fajge, A.M.; Goswami, S.; Srivastava, A.; Halder, R. Wait or Reset Gas Price?: A Machine Learning-based Prediction Model for Ethereum Transactions’ Waiting Time. In Proceedings of the 2021 IEEE 20th International Conference on Trust, Security and Privacy in Computing and Communications (TrustCom), Shenyang, China, 20–22 October 2021; pp. 1153–1160. [Google Scholar] [CrossRef]
- Livieris, I.E.; Pintelas, E.; Pintelas, P. A CNN–LSTM model for gold price time-series forecasting. Neural Comput. Appl. 2020, 32, 17351–17360. [Google Scholar] [CrossRef]
- Widiputra, H.; Mailangkay, A.; Gautama, E. Multivariate CNNLSTM Model for Multiple Parallel Financial Time-Series Prediction. Complexity 2021, 2021, 9903518. [Google Scholar] [CrossRef]
- Ferenczi, A.; Bădică, C. Prediction of Ether Prices Using DeepAR and Probabilistic Forecasting. In Lecture Notes in Computer Science, Proceedings of the 22nd International Conference on Computational Science—ICCS 2022, London, UK, 21–23 June 2022; Groen, D., de Mulatier, C., Paszynski, M., Krzhizhanovskaya, V.V., Dongarra, J.J., Sloot, P.M.A., Eds.; Springer: Cham, Switzerland, 2022; Volume 13351. [Google Scholar] [CrossRef]
- Salinas, D.; Flunkert, V.; Gasthaus, J.; Januschowski, T. DeepAR: Probabilistic forecasting with autoregressive recurrent networks. Int. J. Forecast. 2020, 36, 1181–1191. [Google Scholar] [CrossRef]
- Binance. ETH/USDT Minute-Tick Open Data. Available online: https://data.binance.vision/?prefix=data/spot/monthly/klines/ETHUSDT/1m/ (accessed on 12 May 2022).
- Torrence, C.; Webster, P.J. Interdecadal Changes in the ENSO–Monsoon System. J. Clim. 1999, 12, 2679–2690. (In English) [Google Scholar] [CrossRef]
- Liu, Y.; Liang, X.S.; Weisberg, R.H. Rectification of the Bias in the Wavelet Power Spectrum. J. Atmos. Ocean. Technol. 2007, 24, 2093–2102. [Google Scholar] [CrossRef]
- Hussain, R. A Concise Introduction to Wavelets. Available online: https://rafat.github.io/sites/wavebook/index.html (accessed on 26 July 2022).
- Yeh, C.C.M.; Zhu, Y.; Ulanova, L.; Begum, N.; Ding, Y.; Dau, H.A.; Silva, D.F.; Mueen, A.; Keogh, E. Matrix Profile I: All Pairs Similarity Joins for Time Series: A Unifying View That Includes Motifs, Discords and Shapelets. In Proceedings of the 2016 IEEE 16th International Conference on Data Mining (ICDM), Barcelona, Spain, 12–15 December 2016; pp. 1317–1322. [Google Scholar] [CrossRef]
- Selvin, S.; Vinayakumar, R.; Gopalakrishnan, E.A.; Menon, V.K.; Soman, K.P. Stock price prediction using LSTM, RNN and CNN sliding window model. In Proceedings of the 2017 International Conference on Advances in Computing, Communications and Informatics (ICACCI), Udupi, India, 13–16 September 2017; pp. 1643–1647. [Google Scholar] [CrossRef]
- Bontempi, G.; Taieb, S.B.; Le Borgne, Y.-A. Machine Learning Strategies for Time Series Forecasting. In Business Intelligence: Second European Summer School, eBISS 2012, Brussels, Belgium, 15–21 July 2012, Tutorial Lectures; Aufaure, M.-A., Zimányi, E., Eds.; Springer: Berlin/Heidelberg, Germany, 2013; pp. 62–77. [Google Scholar]
- Zhou, H.; Zhang, S.; Peng, J.; Zhang, S.; Li, J.; Xiong, H.; Zhang, W. Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting. Proc. AAAI Conf. Artif. Intell. 2021, 35, 11106–11115. [Google Scholar] [CrossRef]
Variable | RMSE | MAE | MAPE | R2 |
---|---|---|---|---|
No Additional Variables | 20.28 | 10.50 | 0.142 | 0.680 |
Block Size (Gas) | 19.18 | 9.55 | 0.125 | 0.715 |
Base Fee | 19.89 | 10.28 | 0.132 | 0.693 |
Transaction Count | 20.00 | 9.94 | 0.129 | 0.687 |
Block Size (Bytes) | 19.96 | 10.16 | 0.133 | 0.687 |
ETH/USDT | 20.14 | 10.42 | 0.135 | 0.685 |
Average Gas Price | 20.11 | 10.46 | 0.142 | 0.683 |
Maximum Gas Price | 20.42 | 10.75 | 0.140 | 0.674 |
Smart Contract Count | 20.09 | 10.40 | 0.135 | 0.684 |
All of Above | 19.35 | 9.74 | 0.126 | 0.711 |
Variable | RMSE | MAE | MAPE | R2 |
---|---|---|---|---|
Att 1 Head | 27.15 | 15.89 | 0.226 | 0.435 |
Multi-Att 1 Layer | 28.46 | 15.86 | 0.245 | 0.389 |
Multi-Att 2 Layer | 24.70 | 14.00 | 0.199 | 0.521 |
Multi-Att 2 Layer MP | 25.63 | 14.33 | 0.206 | 0.486 |
Multi-Att 2 Layer Uni | 25.74 | 14.47 | 0.190 | 0.484 |
Multi-Att 2 Layer Uni MP | 27.38 | 15.76 | 0.220 | 0.421 |
Variable | RMSE | MAE | MAPE | R2 |
---|---|---|---|---|
CNN | 27.30 | 16.25 | 0.230 | 0.414 |
CNN MP FWD | 27.68 | 16.42 | 0.238 | 0.414 |
Multi-Att 2 Layer | 27.00 | 15.60 | 0.217 | 0.436 |
Multi-Att 2 Layer MP | 28.27 | 17.30 | 0.237 | 0.402 |
Multi-Att 2 Layer MP DB4 | 27.13 | 15.37 | 0.213 | 0.435 |
Multi-Att 2 Layer Uni Bior 3.3 | 27.85 | 16.38 | 0.232 | 0.410 |
Hybrid | 26.08 | 13.09 | 0.171 | 0.5421 |
Hybrid MP | 27.02 | 14.29 | 0.195 | 0.5166 |
Hybrid MP DB4 | 27.27 | 14.34 | 0.193 | 0.5082 |
Variable | RMSE | MAE | MAPE | R2 |
---|---|---|---|---|
Multi-Att 2 Layer MP Rev | 25.07 | 14.02 | 0.193 | 0.509 |
Multi-Att 2 Layer Uni MP Rev | 25.54 | 14.17 | 0.194 | 0.501 |
Variable | RMSE | MAE | MAPE | R2 |
---|---|---|---|---|
Multi-Att 2 Layer MP Rev | 26.78 | 15.49 | 0.221 | 0.452 |
Multi-Att 2 Layer MP Rev DB4 | 26.82 | 15.17 | 0.212 | 0.450 |
Multi-Att 2 Layer MP Rev Bior 3.3 | 27.25 | 15.65 | 0.228 | 0.431 |
Hybrid MP Rev | 27.33 | 13.92 | 0.184 | 0.509 |
Hybrid MP Rev DB4 | 27.40 | 13.82 | 0.179 | 0.508 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Butler, C.; Crane, M. Blockchain Transaction Fee Forecasting: A Comparison of Machine Learning Methods. Mathematics 2023, 11, 2212. https://doi.org/10.3390/math11092212
Butler C, Crane M. Blockchain Transaction Fee Forecasting: A Comparison of Machine Learning Methods. Mathematics. 2023; 11(9):2212. https://doi.org/10.3390/math11092212
Chicago/Turabian StyleButler, Conall, and Martin Crane. 2023. "Blockchain Transaction Fee Forecasting: A Comparison of Machine Learning Methods" Mathematics 11, no. 9: 2212. https://doi.org/10.3390/math11092212
APA StyleButler, C., & Crane, M. (2023). Blockchain Transaction Fee Forecasting: A Comparison of Machine Learning Methods. Mathematics, 11(9), 2212. https://doi.org/10.3390/math11092212