Deep Reinforcement Learning-Based Rebalancing Policies for Profit Maximization of Relay Nodes in Payment Channel Networks

Nikolaos Papadis, Leandros Tassiulas

This paper, a recipient of the best paper award at MARBLE 2023, explores how relay nodes in Payment Channel Networks (PCNs) can use Deep Reinforcement Learning to manage liquidity and maximize profits.

TL;DR

The authors introduce RebEL (Rebalancing Enabled by Learning), a Deep Reinforcement Learning policy that optimizes when and how much a relay node should rebalance its channels using submarine swaps. By modeling the system as a Markov Decision Process, the policy learns to maximize long-term profit, outperforming traditional threshold-based heuristics by accounting for transaction demand and on-chain costs.

What Problem Does This Paper Address?

Payment Channel Networks (like the Lightning Network) allow users to transact "off-chain" quickly and cheaply. However, these channels have a finite capacity. As transactions flow through a relay node, funds accumulate on one side and deplete on the other, eventually "locking" the channel and causing future transactions to fail.

To stay operational, nodes must rebalance. One popular method is the submarine swap, which allows a node to trade on-chain funds for off-chain channel liquidity (and vice versa). The challenge is a classic optimization trade-off: rebalancing too often incurs high on-chain fees that eat into profits, while rebalancing too little leads to missed relay fees from failed transactions. Existing tools like "Autoloop" use simple balance thresholds, which often ignore the actual demand and the cost-benefit reality of the fees involved.

A basic payment channel where balances shift between nodes as transactions occur.

Methods

The authors formulate the relay node's life cycle as a Markov Decision Process (MDP) with continuous state and action spaces.

  1. Stochastic Modeling: They model transaction arrivals as a marked point process, capturing the random nature of when and how much money moves through the node.
  2. Submarine Swap Protocol: They formally model the multi-step process of a swap, including the "confirmation time" (the delay while waiting for the blockchain to record the on-chain part of the swap).
  3. The RebEL Policy: To solve the MDP, they use Soft Actor-Critic (SAC), a state-of-the-art Deep Reinforcement Learning algorithm. SAC is particularly well-suited here because it handles continuous actions (like "rebalance exactly 0.42 BTC") and encourages exploration through entropy maximization.
  4. Action Engineering: Since neural networks might suggest "illegal" moves (like swapping more money than the node actually has), the authors designed a mapping layer that translates raw model outputs into valid, constrained swap amounts.
The system model showing a relay node N connected to nodes L and R, using a Liquidity Service Provider (LSP) for swaps.

Datasets

Because real-world PCN transaction data is largely private, the authors developed a custom discrete event simulator using the Python library SimPy.

  • Simulated Environments: They tested the policy under various conditions, including high vs. low transaction intensity and skewed (one-way) vs. symmetric (two-way) traffic.
  • Benchmarks: The DRL policy was compared against "None" (no rebalancing), "Autoloop" (threshold-based), and "Loopmax" (a demand-aware heuristic designed by the authors).

Key Insights and Ideas

  • The "Profitability Trap": A major "aha" moment in the paper is the mathematical proof that under current market conditions (low relay fees vs. high on-chain fees), rebalancing is often a losing game. RebEL is the only policy that "learned" this—it eventually stops rebalancing if the costs exceed the potential gains, whereas heuristics will blindly drain the node's on-chain wallet.
  • Demand-Awareness: Unlike simple thresholds, RebEL considers the rate of arrivals. If a channel is depleting slowly, it waits; if it's depleting fast, it acts.
  • Handling Latency: Because submarine swaps take time to confirm (e.g., 10 minutes for Bitcoin), the agent learns to "predict" what the balance will be by the time the swap actually finishes, rather than just reacting to the current state.
The step-by-step protocol of a submarine swap, highlighting the interaction between the client and the LSP.

Key Results

  • Superiority in Skewed Demand: In scenarios where traffic mostly flows in one direction (the most common real-world case), RebEL significantly outperformed Autoloop and Loopmax in total fortune.
  • Selective Rebalancing: In low-demand regimes, RebEL correctly identified that rebalancing wasn't worth the cost. While other policies lost money by constantly trying to stay balanced, RebEL's profit curve remained flat or slightly positive.
  • Robustness: The policy performed well across different initial balance configurations and uneven channel capacities, proving it can adapt to the "messy" reality of a live network.

Limitations and Future Work

  • Scale: The current model focuses on a single relay node with two channels. Real nodes often have dozens or hundreds of channels. Scaling the DRL state space to handle a "star graph" of channels is a logical next step.
  • Passive Neighbors: The model assumes the nodes on the other side of the channels are passive. In reality, they might also be running rebalancing algorithms, leading to a competitive game-theoretic environment.
  • Batching: The authors suggest that future versions could learn to "batch" multiple rebalancing operations into a single on-chain transaction to further save on fees.

Summary updated

BibTeX
@inproceedings{papadis2023deep,
  author = {Nikolaos Papadis and Leandros Tassiulas},
  title = {{Deep Reinforcement Learning-Based Rebalancing Policies for Profit Maximization of Relay Nodes in Payment Channel Networks}},
  booktitle = {MARBLE},
  year = {2023},
  doi = {10.1007/978-3-031-48731-6\_1},
}
Figure