跳至主要內容
進階

Fees & Economics 費用與經濟

深入了解閃電網路的費用結構、路由經濟學和節點盈利模式。

15 分鐘

閃電網路費用結構

閃電網路的費用遠低於鏈上交易,但理解其結構對於用戶優化成本和節點運營者盈利都很重要。 費用主要由兩部分組成:基礎費用和比例費用,每個路由節點都可以自由設定。

費用組成

Lightning Network Routing Fee Formula:

Total fee = base_fee + (amount * fee_rate)

Parameters:

base_fee:
  - Fixed fee charged per forward
  - Unit: millisatoshi (msat)
  - Typical: 0 - 1000 msat (0 - 1 sat)
  - Charged regardless of amount

fee_rate:
  - Proportional to forwarded amount
  - Unit: ppm (parts per million)
  - Typical: 1 - 5000 ppm (0.0001% - 0.5%)
  - 1 ppm = 1 sat per 1,000,000 sats forwarded

Calculation Example:
  base_fee = 1000 msat (1 sat)
  fee_rate = 100 ppm
  payment amount = 100,000 sats

  fee = 1000 + (100,000 * 100 / 1,000,000) msat
      = 1000 + 10,000 msat
      = 11,000 msat = 11 sats

Multi-hop Payment:
  A -> B -> C -> D
  Fee = fee(A->B) + fee(B->C) + fee(C->D)

channel_update 訊息

Fee-related fields in channel_update message:

{
  "channel_flags": 0,
  "message_flags": 1,
  "cltv_expiry_delta": 40,
  "htlc_minimum_msat": 1000,
  "htlc_maximum_msat": 990000000,
  "fee_base_msat": 1000,
  "fee_proportional_millionths": 100
}

Important Parameters:

cltv_expiry_delta:
  - Timelock blocks added per hop
  - Affects payment's total timelock
  - Longer values safer but may be rejected

htlc_minimum_msat / htlc_maximum_msat:
  - Limits forwardable HTLC size
  - Protects channel from dust attacks
  - Controls liquidity usage

費用策略

低費用策略

吸引更多流量,薄利多銷。適合新節點建立路由歷史, 或流動性充足的大節點。風險是可能被濫用。

高費用策略

最大化每筆交易收益。適合稀缺流動性方向或獨特的連接位置。 可能減少總體交易量。

動態費用

根據通道餘額動態調整。流動性稀缺方向收更高費用, 引導流量自然平衡通道。

零費用

有些節點選擇零費用以促進網路發展或作為公共服務。 需要其他收入來源支撐運營成本。

流動性方向與費用

Liquidity-Based Fee Strategy:

Channel State:
  You <--[0.3 BTC]--+--[0.7 BTC]--> Counterparty

  Local balance: 0.3 BTC (30%)
  Remote balance: 0.7 BTC (70%)

Fee Adjustment Logic:

Outbound direction (You -> Counterparty):
  - Local balance low (30%)
  - Outbound capacity scarce
  - Set high fee to protect liquidity
  - Example: base=1000, rate=500ppm

Inbound direction (Counterparty -> You):
  - Remote balance high (70%)
  - Inbound capacity abundant
  - Set low fee to attract traffic
  - Example: base=0, rate=10ppm

Automated Fee Management Tools:
  - charge-lnd (LND)
  - clboss (CLN)
  - Various automation scripts

Dynamic Fee Formula Example:
fee_rate = base_rate * (1 + sensitivity * (0.5 - local_ratio))

  local_ratio = 0.3 -> fee rate increases
  local_ratio = 0.7 -> fee rate decreases
  local_ratio = 0.5 -> use base rate

路由經濟學

Routing Node Profitability Analysis:

Revenue Source - Routing Fee Income:

  Assumptions:
    - Daily routing volume: 10 BTC
    - Average fee rate: 50 ppm
    - Average base fee: 1 sat
    - Daily payments: 1000

  Daily income = 10 * 1,000,000 * 50/1,000,000 + 1000
               = 500 + 1000 = 1500 sats/day
               = ~45,000 sats/month

Cost Structure:

  1. Channel Opening Cost
     - On-chain TX fee (~2000-10000 sats per channel)
     - Need multiple channels for effective routing

  2. Channel Closing Cost
     - On-chain fee for cooperative or force close

  3. Rebalancing Cost
     - Routing fees for circular payments
     - Submarine Swap fees

  4. Capital Opportunity Cost
     - Locked BTC cannot be used elsewhere
     - ~1-5% annualized (depending on risk preference)

  5. Operating Cost
     - Server/hardware
     - Time and effort

Profitability Condition:
  Routing income > Rebalancing + Capital + Operating costs

Most small routing nodes are actually operating at a loss!

用戶費用優化

選擇好的 LSP/節點

與大型、連接良好的節點建立通道。它們通常有更低的費率和更好的路由成功率。

使用 MPP

多路徑支付 可以找到更便宜的路徑組合, 尤其是大額支付時。

設定費用上限

大多數錢包允許設定最大可接受費用。避免支付過高的路由費。

避開擁堵時段

網路繁忙時費用可能更高。非緊急支付可以等待更好的時機。

費用與隱私

Information Revealed by Fees:

Routing nodes can learn from fees:

  1. Payment Amount
     - Can be inferred from proportional fee

  2. Payment Direction
     - Knows fund flow direction

  3. Timing Patterns
     - When payments occur

Privacy Protection Measures:

  1. Onion Routing
     - Node doesn't know full path

  2. PTLCs (future)
     - Eliminates cross-hop correlation

  3. Add Random Fees
     - Obscures real amount (user-side)

  4. Route Blinding
     - Hides receiver location

費用管理工具

charge-lnd

LND 的自動費用管理工具。支持基於餘額、時間、對手方等條件的規則引擎。 github.com/accumulator/charge-lnd

clboss

CLN 的自動化節點管理器。自動調整費用、開關通道、再平衡。 github.com/ZmnSCPxj/clboss

Lightning Terminal

Lightning Labs 的 GUI 工具。提供費用分析、調整建議和自動化選項。

相關資源

下一步: 了解 路徑搜索演算法 如何找到最佳支付路徑。

已複製連結
已複製到剪貼簿