Abstract
The lightning network (LN) is a technological solution designed to solve the bitcoin blockchain transaction speed problem by introducing off-chain transactions. Since LN is a sparse and highly distributed network with three predominant routing protocols, its native pathfinding algorithms can potentially find multi-hop payment paths similar from the payment sender’s perspective, but the algorithms themselves have different performance, computational cost, energy consumption, and ultimately different CO2 emissions per step in the pathfinding phase. Bitcoin itself generates approximately 61.4 million tons of CO2 eq. per year. Since the LN is built on top of bitcoin, every small change in its energy consumption can have a significant impact on overall pollution. In this paper, we show that the reinforcement learning (RL) approach can reduce these costs and achieve better performance in terms of energy consumption at each pathfinding step. We introduce one-shot path prediction and propose a RL solution for a network agent that learns its neighborhood and uses local knowledge to cleverly solve the pathfinding problem and outperform native pathfinding algorithms.
Similar content being viewed by others
Explore related subjects
Discover the latest articles, news and stories from top researchers in related subjects.Data and code availability
All data and algorithms used can be found in the public repository: https://github.com/ellariel/ln-one-shot-path-planning.
Notes
Each node on the path other than the sender will have to lock the payment amount on its outgoing channel in the payment for a maximal duration of lock time. Nodes can decide on the lock time of their channel. Lower lock times indicate a higher risk for the node not to be able to relay information within a time interval. Higher lock times indicate that the maximal latency is higher. So, senders prefer lower lock times, while intermediaries might prefer the increased security of longer lock times.
The success rate in this case shows the relative number of transactions that were successfully routed by the agent in their neighborhood.
References
Badea L, Mungiu-Pupazan MC (2021) The economic and environmental impact of bitcoin. IEEE Access 9:48091–48104. https://doi.org/10.1109/ACCESS.2021.3068636
Mora C, Rollins RL, Taladay K, Kantar MB, Chock MK, Shimada M, Franklin EC (2018) Bitcoin emissions alone could push global warming above 2 °C. Nat Clim Change 8:931–933. https://doi.org/10.1038/s41558-018-0321-8
Masanet E, Shehabi A, Lei N, Vranken H, Koomey J, Malmodin J (2019) Implausible projections overestimate near-term bitcoin co2 emissions. Nat Clim Chang 9:653–654. https://doi.org/10.1038/s41558-019-0535-4
Stoll C, Klaaßen L, Gallersdörfer U (2019) The carbon footprint of bitcoin. Joule 3(7):1647–1661
Kohli V, Chakravarty S, Chamola V, Sangwan KS, Zeadally S (2023) An analysis of energy consumption and carbon footprints of cryptocurrencies and possible solutions. Digit Commun Netw 9(1):79–89. https://doi.org/10.1016/j.dcan.2022.06.017
Bedford Taylor M (2017) The evolution of bitcoin hardware. Computer 50(9):58–66. https://doi.org/10.1109/MC.2017.3571056
Wang Y-Z, Wu J, Chen S-H, Chao MC-T, Yang C-H (2019) Micro-architecture optimization for low-power bitcoin mining asics. In: 2019 international symposium on vlsi design, automation and test (VLSI-DAT), pp 1–4. https://doi.org/10.1109/VLSI-DAT.2019.8741726
Zamani M, Movahedi M, Raykova M (2018) Rapidchain: scaling blockchain via full sharding. In: Proceedings of the 2018 ACM sigsac conference on computer and communications security. CCS ’18, pp 931–948. Association for Computing Machinery, New York, NY, USA. https://doi.org/10.1145/3243734.3243853
Zhang Y-H, Liu XF (2021) Traffic redundancy in blockchain systems: the impact of logical and physical network structures. In: 2021 IEEE international symposium on circuits and systems (ISCAS), pp 1–5. IEEE
Poon J, Dryja T (2016) The bitcoin lightning network: scalable off-chain instant payments. Retrieved Feb 22, 2023 from https://lightning.network/lightning-network-paper.pdf
Lightning network in-progress specifications. GitHub. Retrieved Feb 22, 2023 from https://github.com/lightning/bolts
Real-time lightning network statistics. JSON data. Retrieved Feb 22, 2023 from https://1ml.com/statistics
Barratt O, Scott D(2021) Comparing bitcoin & lightning energy usage to the real world. Retrieved Feb 22, 2023 from https://blog.coincorner.com/comparing-bitcoin-lightning-energy-usage-to-the-real-world-2d64c62b1783
Prihodko P, Zhigulin SN, Sahno M, Ostrovskiy AB, Osuntokun O (2016) Flare : an approach to routing in lightning network white paper. Retrieved Feb 22, 2023 from https://bitfury.com/content/downloads/whitepaper_flare_an_approach_to_routing_in_lightning_network_7_7_2016.pdf
Finding routes in the lightning network. Builder’s guide. Retrieved Feb 22, 2023 from https://docs.lightning.engineering/the-lightning-network/pathfinding/finding-routes-in-the-lightning-network
Pacia C (2015) Lightning network skepticism. Retrieved Feb22, 2023 from https://chrispacia.wordpress.com/2015/12/23/lightning-network-skepticism
Spoke-hub distribution paradigm. Wikipedia. Retrieved Feb 22, 2023 from https://en.wikipedia.org/wiki/Spoke%E2%80%93hub_distribution_paradigm
Lin J-H, Marchese E, Tessone CJ, Squartini T (2022) The weighted bitcoin lightning network. Chaos, Solitons Fractals 164:112620. https://doi.org/10.1016/j.chaos.2022.112620
The lightning network daemon. GitHub. Retrieved Feb 22, 2023 from https://github.com/lightningnetwork/lnd
Core Lightning (CLN): a specification compliant lightning network implementation in C. GitHub. Retrieved Feb 22, 2023 from https://github.com/ElementsProject/lightning
Eclair (French for lightning) is a scala implementation of the lightning network. GitHub. Retrieved Feb 22 2023 from https://github.com/ACINQ/eclair
Zabka P, Foerster K-T, Schmid S, Decker C (2022) Empirical evaluation of nodes and channels of the lightning network. Pervasive Mob Comput 83:101584. https://doi.org/10.1016/j.pmcj.2022.101584
Seres IA, Gulyás L, Nagy DA, Burcsi P (2019) Topological analysis of bitcoin’s lightning network. arXiv. https://doi.org/10.48550/ARXIV.1901.04972
Bere, F, Seres IA, Benczur AA (2019) A cryptoeconomic traffic analysis of bitcoin’s lightning network. arXiv. https://doi.org/10.48550/ARXIV.1911.09432
Shell B (2022) How many transactions can the lightning network handle? Retrieved Feb 22, 2023 from https://voltage.cloud/blog/bitcoin-education/how-many-transactions-can-the-lightning-network-handle
Helseth A (2021) The state of lightning. Arcane Research Report. Retrieved Feb 22, 2023 from https://arcane.no/research/the-growth-of-the-lightning-network
Sutton RS, Barto AG (2018) Reinforcement learning: an introduction, 2nd edn. The MIT Press, Cambridge
Schulman J, Wolski F, Dhariwal P, Radford A, Klimov O (2017). Proximal policy optimization algorithms arXiv. https://doi.org/10.48550/ARXIV.1707.06347
Skrynnik A, Andreychuk A, Yakovlev K, Panov A (2022) Pathfinding in stochastic environments: learning vs planning. Peer J Comput Sci 8:1056. https://doi.org/10.7717/peerj-cs.1056
Asgari K, Mohammadian AA, Tefagh M (2022) DyFEn: agent-based fee setting in payment channel networks. arXiv. https://doi.org/10.48550/ARXIV.2210.08197
The Proximal Policy Optimization algorithm. Stable Baselines3 Library. Retrieved Feb 22, 2023 from https://stable-baselines3.readthedocs.io/en/master/modules/ppo.html (2021)
Brockman G, Cheung V, Pettersson L, Schneider J, Schulman J, Tang J, Zaremba W (2016). OpenAI gym arXiv. https://doi.org/10.48550/arXiv.1606.01540
Lin J-H, Primicerio K, Squartini T, Decker C, Tessone CJ (2020) Lightning network: a second path towards centralisation of the bitcoin economy. New J Phys 22(8):083022. https://doi.org/10.1088/1367-2630/aba062
Rohrer, E., Malliaris, J., Tschorsch, F (2019) Discharged payment channels: quantifying the lightning network’s resilience to topology-based attacks. arXiv. https://doi.org/10.48550/ARXIV.1904.10253
Tochner S, Schmid S, Zohar A (2019) hijacking routes in payment channel networks: a predictability tradeoff. arXiv. https://doi.org/10.48550/ARXIV.1909.06890
Zabka P, Förster K-T, Decker C, Schmid S (2024) A centrality analysis of the lightning network. Telecommun Policy 48(2):102696. https://doi.org/10.1016/j.telpol.2023.102696
Kumble SP, Roos S (2021) Comparative analysis of lightning’s routing clients. In: 2021 IEEE international conference on decentralized applications and infrastructures (DAPPS), pp 79–84. https://doi.org/10.1109/DAPPS52256.2021.00014
Malavolta G, Moreno-Sanchez P, Kate A, Maffei M (2016) SilentWhispers: enforcing security and privacy in decentralized credit networks. Cryptology ePrint Archive, Paper 2016/1054. Retrieved Feb 22, 2023 from https://eprint.iacr.org/2016/1054
Roos S, Moreno-Sanchez P, Kate A, Goldberg I (2017) Settling payments fast and private: efficient decentralized routing for path-based transactions. arXiv. https://doi.org/10.48550/ARXIV.1709.05748
Wang, P., Xu, H., Jin, X., Wang, T.: Flash: Efficient dynamic routing for offchain networks. In: Proceedings of the 15th International Conference on Emerging Networking Experiments And Technologies. CoNEXT ’19, pp. 370–381. Association for Computing Machinery, New York, NY, USA (2019). doi: https://doi.org/10.1145/3359989.3365411
Mammeri Z (2019) Reinforcement learning based routing in networks: review and classification of approaches. IEEE Access 7:55916–55950. https://doi.org/10.1109/ACCESS.2019.2913776
Godfrey D, Kim B-S, Miao H, Shah B, Hayat B, Khan I, Sung T-E, Kim K-I (2021) Q-learning based routing protocol for congestion avoidance. Comput Mater Cont 68(3):3671–3692. https://doi.org/10.32604/cmc.2021.017475
Davis V, Harrison B (2022) Learning a scalable algorithm for improving betweenness in the lightning network. In: 2022 fourth international conference on blockchain computing and applications (BCCA), pp 119–126. https://doi.org/10.1109/BCCA55292.2022.9922233
D’Angelo G, Severini L, Velaj Y (2016) On the maximum betweenness improvement problem. Electronic notes in theoretical computer science. In: Proceedings of ICTCS 2015, the 16th Italian conference on theoretical computer science, vol 322, pp 153–168. https://doi.org/10.1016/j.entcs.2016.03.011
Kulvicius T, Herzog S, Lüddecke T, Tamosiunaite M, Wörgötter F (2020). One-shot path planning for multi-agent systems using fully convolutional neural network. https://doi.org/10.48550/ARXIV.2004.00568
Valko D, Kudenko D (2023) Increasing energy efficiency of bitcoin infrastructure with reinforcement learning and one-shot path planning for the lightning network. In: Proc. of the Adaptive and Learning Agents Workshop (ALA 2023) at AAMAS 2023, May 29-30. ALA 2023. Cruz, Hayes, Wang, Yates (eds.), London, UK. https://alaworkshop2023.github.io/
Decker C (2020) Lightning network research: topology datasets. GitHub. Retrieved February 22, 2023 from https://github.com/lnresearch/topology. https://doi.org/10.5281/zenodo.4088530
Rozemberczki B, Kiss O, Sarkar R (2020) Little ball of fur: a python library for graph sampling. In: Proceedings of the 29th ACM international conference on information and knowledge management (CIKM ’20), pp. 3133–3140. ACM
Leskovec J, Faloutsos C (2006) Sampling from large graphs. In: Proceedings of the 12th ACM SIGKDD international conference on knowledge discovery and data mining. KDD ’06, pp. 631–636. Association for Computing Machinery, New York, NY, USA. https://doi.org/10.1145/1150402.1150479
Kumble SP, Epema D, Roos, S (2021) How lightning’s routing diminishes its anonymity. In: Proceedings of the 16th international conference on availability, reliability and security. ARES 21. Association for Computing Machinery, New York, NY, USA. https://doi.org/10.1145/3465481.3465761
Lottick K, Susai S, Friedler SA, Wilson JP (2019) Energy usage reports: environmental awareness as part of algorithmic accountability. arXiv. https://doi.org/10.48550/ARXIV.1911.08354
Vries AWG (2018) Bitcoin’s growing energy problem. Joule 2:801–805
Strubell E, Ganesh A, McCallum A (2019) Energy and policy considerations for deep learning in NLP. arXiv. https://doi.org/10.48550/ARXIV.1906.02243
Posani L, Paccoia A, Moschettini M (2019) The carbon footprint of distributed cloud storage. arXiv. https://doi.org/10.48550/ARXIV.1803.06973
Patterson D, Gonzalez J, Le Q, Liang C, Munguia L-M, Rothchild D, So D, Texier M, Dean J (2021) Carbon emissions and large neural network training. arXiv. https://doi.org/10.48550/ARXIV.2104.10350
Gitzel R (2022) Software tools to determine the carbon footprint of AI code. Retrieved Feb 22, 2023 from https://www.linkedin.com/pulse/software-tools-determine-carbon-footprint-ai-code-ralf-gitzel/
Schubert S, Kostic D, Zwaenepoel W, Shin KG (2012) Profiling software for energy consumption. In: 2012 IEEE international conference on green computing and communications, pp 515–522. https://doi.org/10.1109/GreenCom.2012.86
Lannelongue L, Grealey J, Inouye M (2021) Green algorithms: quantifying the carbon footprint of computation. Adv Sci 8(12):2100707. https://doi.org/10.1002/advs.202100707
Hessel M, Hasselt HV, Modayil J, Silver D (2019) On Inductive Biases in Deep Reinforcement Learning. arXiv. https://doi.org/10.48550/ARXIV.1907.02908
Wei H, Liu X, Ying L (2023) Safe reinforcement learning with instantaneous constraints: the role of aggressive exploration. https://doi.org/10.48550/ARXIV.2312.14470
Acknowledgements
The authors would like to thank Dr.-Ing. Manfred Veenker and the Veenker Foundation for their help, and Ildar Baimuratov, Konstantin Glonin, Henrik Müller and Yuan Xue for their constructive and valuable discussions and guidance during the planning and development of this research.
Funding
Not applicable.
Author information
Authors and Affiliations
Contributions
D.V. is responsible for developing the idea, implementation, experiments, and writing article; D.K. is responsible for developing the idea, validation, supervision, and writing article.
Corresponding author
Ethics declarations
Conflict of interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.
Ethical approval
Not applicable.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Appendix A
Appendix A
1.1 Experiment details and hyperparameters
We used the same setup for the additional training and the experiments and employed mostly default hyperparameters for the Stable-Baselines3 PPO implementation [31]: policy type: actor-critic; timesteps per epoch: 100,000 for general training, 10,000 for experiments and additional training; learning rate: 0.0003; discount factor (\(\gamma\)): 0.99; GAE parameter (\(\lambda\)): 0.95; clipping parameter: 0.2; value function coefficient: 0.5; maximum value for the gradient clipping: 0.5.
Hardware setup for general training. CPU: AMD EPYC 7662 64-Core Processor, 256 CPUs; GPU: 2 x A100-PCIE-80GB; 1 TB RAM, 1007.764 GB available; Platform system: Linux-5.10.0-15-amd64-x86_64-with-glibc2.31; Python version: 3.10.6.
Hardware setup for experiments and additional training. CPU: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz, 8 CPUs; GPU: 1 x NVIDIA GeForce MX350; 8 GB RAM, 7.675 GB available; Platform system: Windows-10-10.0.22621-SP0; Python version: 3.9.13.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Valko, D., Kudenko, D. Increasing energy efficiency of bitcoin infrastructure with reinforcement learning and one-shot path planning for the lightning network. Neural Comput & Applic (2024). https://doi.org/10.1007/s00521-024-10588-2
Received:
Accepted:
Published:
DOI: https://doi.org/10.1007/s00521-024-10588-2