DyFEn: Agent-Based Fee Setting in Payment Channel Networks

Kiana Asgari, Aida Afshar Mohammadian, Mojtaba TefagharXiv 2022 · DOI

Abstract

The Bitcoin Lightning Network (LN) offers a scalable solution for off-chain transactions, but node operators face a complex optimization challenge in setting routing fees. This paper introduces DyFEn (Dynamic Fee learning Environment), the first open-source reinforcement learning (RL) testbed for the LN. By framing fee-setting as a Markov Decision Process, the study evaluates various deep RL algorithms. Results indicate that on-policy agents, such as PPO, can generate up to ten times more income than traditional heuristics, providing a robust framework for automated liquidity management.

Introduction: The Fee Optimization Challenge

The Bitcoin Lightning Network is a "Layer 2" protocol designed to facilitate fast, low-cost transactions by moving them off-chain into payment channels. When a payment traverses multiple hops, intermediate nodes charge fees for providing liquidity. For these operators, setting the "optimal" fee is a balancing act: fees that are too high discourage traffic, while fees that are too low result in missed revenue or rapid liquidity depletion.

Overview of Lightning Network operations: channel opening, payment, and routing.

Historically, node operators have relied on static settings or simple heuristics, such as matching the fees of neighboring nodes. However, the dynamic nature of network topology and unpredictable transaction flows make these methods suboptimal.

The DyFEn Framework

To address this, researchers developed DyFEn, built upon the LEViN (Lightning Experimental Virtual Network) simulator. LEViN provides a high-performance environment that mimics real-world LN dynamics, including transaction routing and rebalancing, using snapshots of the actual network.

The fee-setting problem is modeled as a Markov Decision Process (MDP):

  • State Space: Includes the current balance of a node's channels and recent transaction volumes.
  • Action Space: Continuous values for the "base fee" and "fee rate" for each connected channel.
  • Reward Function: The total fee income generated within a specific simulation window.

The study benchmarks five Deep Reinforcement Learning (DRL) algorithms: on-policy methods (PPO, TRPO, A2C) and off-policy methods (DDPG, TD3).

Experimental Setup and Datasets

The simulation is grounded in real-world data:

  • LN Snapshots: Public data from April 2021 provided the network's topology and existing fee structures.
  • Merchant Data: Information from the 1ML search engine helped identify likely transaction recipients, ensuring realistic traffic patterns.

Results and Analysis

A key finding of the research is the significant performance gap between algorithm types. On-policy algorithms, particularly PPO and TRPO, demonstrated superior stability and higher rewards compared to off-policy alternatives like DDPG and TD3.

Mean episode rewards for various RL algorithms across different network nodes.

The RL agents consistently outperformed common baselines—such as static or proportional fees—by a wide margin, sometimes earning nearly 10x more income. The agents also proved robust to varying initial channel balances, suggesting they learned generalized economic strategies rather than overfitting to specific conditions.

The Sparsity Trap and Localization

The researchers identified a "sparsity trap": if fees are set even slightly above a competitive threshold, transaction volume can drop to zero instantly, leaving the agent with no feedback. Constraining the action space was necessary to facilitate learning. Furthermore, the study found that "localization" is effective; agents can learn optimal policies by focusing on their immediate topological neighborhood rather than the entire global network.

Conclusion and Future Work

DyFEn represents a significant step toward automated, intelligent management of the Lightning Network. While the current model assumes a stationary environment (where other nodes do not change their fees), future work will explore non-stationary scenarios where multiple agents compete. Additionally, the researchers plan to integrate more complex tasks like automated channel rebalancing and strategic channel management into the DyFEn environment.

Summary updated

BibTeX
@misc{asgari2022dyfen,
  author = {Kiana Asgari and Aida Afshar Mohammadian and Mojtaba Tefagh},
  title = {{DyFEn: Agent-Based Fee Setting in Payment Channel Networks}},
  year = {2022},
  eprint = {2210.08197},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2210.08197},
}
Figure