Channel Liquidity
Managing Lightning channel liquidity. Inbound vs outbound capacity, rebalancing, and liquidity strategies for agents.
Channel Liquidity
Liquidity is the ability to send and receive payments. In Lightning, liquidity is directional—you need outbound liquidity to send and inbound liquidity to receive.
Why Liquidity Matters for Agents
| Challenge | Impact |
|---|---|
| No inbound | Can’t receive payments |
| No outbound | Can’t send payments |
| Unbalanced | Limited payment sizes |
| Depleted | Need to rebalance or open new channels |
Liquidity Fundamentals
Channel Capacity vs Liquidity
Channel Capacity: 1,000,000 sats (total)
├── Your side (outbound): 600,000 sats
└── Their side (inbound): 400,000 sats
Capacity: Total BTC locked in the channel (fixed at open) Liquidity: How much you can move in each direction (changes with payments)
Outbound Liquidity
Funds on your side of channels = what you can send.
You ──[600,000]──→ Peer
(outbound)
You gain outbound when:
- Opening a channel with your funds
- Receiving payments
- Rebalancing inward
Inbound Liquidity
Funds on their side of channels = what you can receive.
You ←──[400,000]── Peer
(inbound)
You gain inbound when:
- Peer opens channel to you
- Sending payments
- Buying inbound (LSP)
- Rebalancing outward
The Liquidity Problem
Opening Your First Channel
When you open a channel with your funds:
Before: You have 1 BTC on-chain
After: Channel [You: 1 BTC | Peer: 0 BTC]
Problem: 100% outbound, 0% inbound. You can send but not receive.
Solving the Inbound Problem
| Method | Cost | Speed | Complexity |
|---|---|---|---|
| Send payments | Variable | Immediate | Low |
| Receive from peer | Free | Depends | Low |
| Buy from LSP | ~1-3% | Minutes | Low |
| Channel swap | On-chain fee | 10-60 min | Medium |
| Circular rebalance | Routing fees | Seconds | Medium |
Liquidity Strategies
1. Balanced Channel Opening
Open channels with a push amount—immediately give some to the peer:
lnd.open_channel(
node_pubkey=peer_pubkey,
local_funding_amount=1000000,
push_sat=500000 # Give peer 50%
)
Result: 50% outbound, 50% inbound (but you lose 500k sats)
2. Dual-Funded Channels
Both parties contribute to the channel:
You contribute: 500,000 sats
Peer contributes: 500,000 sats
Channel: [You: 500,000 | Peer: 500,000]
Requires peer support (Core Lightning, Eclair).
3. Loop Out (Submarine Swap)
Move funds from Lightning to on-chain, creating inbound:
Before: [You: 1M | Peer: 0]
Loop: Send 500k via LN, receive on-chain
After: [You: 500k | Peer: 500k] + 500k on-chain
Cost: On-chain fee + service fee (~0.1-1%)
4. Circular Rebalancing
Route a payment to yourself through other channels:
You ─[outbound]→ A ─→ B ─→ C ─[inbound]→ You
Cost: Routing fees only Requirement: Multiple channels, circular path exists
Monitoring Liquidity
Check Channel Balances
channels = lnd.list_channels()
for ch in channels:
total = ch.capacity
local = ch.local_balance
remote = ch.remote_balance
local_pct = (local / total) * 100
print(f"Channel {ch.chan_id}: {local_pct:.0f}% outbound")
Liquidity Alerts
def check_liquidity_health(channels, min_threshold=0.1):
alerts = []
for ch in channels:
local_ratio = ch.local_balance / ch.capacity
remote_ratio = ch.remote_balance / ch.capacity
if local_ratio < min_threshold:
alerts.append(f"Low outbound: {ch.chan_id}")
if remote_ratio < min_threshold:
alerts.append(f"Low inbound: {ch.chan_id}")
return alerts
Rebalancing Techniques
Circular Rebalance
Send a self-payment through your channels:
# Find circular route
routes = lnd.query_routes(
pub_key=my_pubkey, # Pay yourself
amt=100000,
outgoing_chan_id=depleted_channel,
last_hop_pubkey=refill_channel_peer
)
# Execute rebalance
lnd.send_to_route(
payment_hash=random_hash,
route=routes.routes[0]
)
Using Rebalancing Tools
Balance of Satoshis (BOS):
bos rebalance --amount 100000 --out-through DEPLETED_CHAN
Rebalance-LND:
rebalance-lnd --amount 100000 -o CHAN_FROM -i CHAN_TO
Liquidity Markets
Lightning Service Providers (LSPs)
Buy inbound liquidity from LSPs:
| Provider | Min Channel | Fee |
|---|---|---|
| Voltage | 100k sats | ~1% |
| LNBIG | 500k sats | ~1-2% |
| Bitrefill | 500k sats | Variable |
Liquidity Ads
Core Lightning supports liquidity advertisements:
Node advertises:
- Will open 1M sat channel
- For 5000 sat fee
- Locked for 2016 blocks
Pool (Lightning Labs)
Auction-based liquidity marketplace:
# Bid for inbound liquidity
pool.bid(
amount=1000000, # 1M sats channel
rate=500, # Premium in ppm
duration=2016 # Blocks
)
Capacity Planning
For Sending Agents
If you primarily send payments:
- Priority: Outbound liquidity
- Strategy: Open channels with your funds
- Rebalance: When outbound < 20%
For Receiving Agents
If you primarily receive payments:
- Priority: Inbound liquidity
- Strategy: Use LSPs, dual-funded channels
- Rebalance: When inbound < 20%
For Routing Agents
If you route payments:
- Priority: Balanced liquidity
- Strategy: Multiple large channels, both directions
- Rebalance: Keep channels 40-60% balanced
Liquidity Metrics
| Metric | Formula | Target |
|---|---|---|
| Outbound ratio | local / capacity | > 0.2 for sending |
| Inbound ratio | remote / capacity | > 0.2 for receiving |
| Balance score | 1 - abs(0.5 - local/capacity) | > 0.3 |
Aggregate Liquidity
def calculate_total_liquidity(channels):
total_outbound = sum(ch.local_balance for ch in channels)
total_inbound = sum(ch.remote_balance for ch in channels)
total_capacity = sum(ch.capacity for ch in channels)
return {
"outbound": total_outbound,
"inbound": total_inbound,
"capacity": total_capacity,
"outbound_pct": total_outbound / total_capacity * 100,
"inbound_pct": total_inbound / total_capacity * 100
}
Common Liquidity Issues
| Issue | Symptom | Solution |
|---|---|---|
| Can’t receive | All outbound depleted | Buy inbound, Loop Out |
| Can’t send | All inbound (rare) | Open new channel |
| Large payments fail | Insufficient single-channel capacity | MPP, larger channels |
| High rebalance cost | Unbalanced network position | Better connected peers |
Related Topics
- Payment Channels - Channel fundamentals
- LSPs - Liquidity providers
- Submarine Swaps - Loop In/Out
- Fees - Cost of rebalancing
Machine-Readable Summary
{
"topic": "channel-liquidity",
"key_concepts": [
"inbound-liquidity",
"outbound-liquidity",
"rebalancing",
"capacity-management"
],
"strategies": [
"dual-funded-channels",
"circular-rebalance",
"submarine-swaps",
"lsp-channels"
],
"metrics": {
"min_outbound_ratio": 0.2,
"min_inbound_ratio": 0.2,
"balanced_target": 0.5
}
}