高級
Trampoline Routing 蹦床路由
了解蹦床路由如何讓輕量級閃電網路客戶端委託路徑計算給更強大的節點,同時保持隱私。
12 分鐘
什麼是 Trampoline Routing?
Trampoline Routing(蹦床路由)是一種路由委託機制。輕量級客戶端(如手機錢包) 不需要維護完整的網路圖譜,而是將支付發送給一個或多個「蹦床節點」, 由它們負責計算到目的地的路徑。這大幅降低了移動設備的資源需求。
核心價值: 完整的閃電網路圖譜需要數十 MB 的存儲空間和持續的同步。蹦床路由讓手機錢包 可以在不知道完整網路拓撲的情況下發送支付。
傳統路由的問題
Traditional Source Routing: Sender requirements: 1. Complete network graph (~50-100 MB) 2. Continuously sync gossip messages 3. Calculate optimal path to destination 4. Build complete onion packet Impact on mobile wallets: • Storage: need large space for graph • Bandwidth: constantly downloading channel_update • Battery: path calculation consumes CPU • Time: initial sync takes long time • Staleness: graph may be outdated after offline Problem example: User opens App -> needs sync -> waits minutes -> finally can pay This is disastrous for user experience!
Trampoline 解決方案
Trampoline 路由架構:
┌──────────┐ ┌───────────┐ ┌───────────┐ ┌──────────┐
│ Alice │───>│Trampoline │───>│Trampoline │───>│ Bob │
│ (手機) │ │ Node 1 │ │ Node 2 │ │ (接收方) │
└──────────┘ └───────────┘ └───────────┘ └──────────┘
│ │ │ │
│ 只知道 │ 計算路徑 │ 計算路徑 │
│ T1 的位置 │ 到 T2 │ 到 Bob │
└───────────────┴────────────────┴────────────────┘
Alice 只需要知道:
1. 自己的直接連接節點
2. 一些知名的 Trampoline 節點
3. Bob 的節點 ID(不需要知道 Bob 的位置)
Trampoline 節點負責:
1. 維護完整的網路圖譜
2. 計算到下一跳的路徑
3. 轉發支付 洋蔥結構
Trampoline 使用嵌套的洋蔥結構來保護隱私:
Nested Onion Structure:
Outer onion (traditional BOLT 4):
Hop 1: Alice -> direct peer Node A
payload: forward to Node B
Hop 2: Node A -> Node B
payload: forward to Trampoline T1
Hop 3: Node B -> Trampoline T1
payload: [inner Trampoline onion]
Inner onion (Trampoline):
T-Hop 1: T1 -> T2
payload: amount, expiry, next trampoline
T-Hop 2: T2 -> Bob
payload: final payment details
When T1 receives:
1. Decrypt outer onion, discover Trampoline payment
2. Decrypt first layer of inner onion
3. Find need to forward to T2
4. Calculate path to T2
5. Build new outer onion to T2
6. Keep inner onion (peel one layer) 隱私保護
發送方隱私
- • T1 不知道 Alice 是發送方還是中間節點
- • 可以使用多個 Trampoline 節點增加混淆
- • 洋蔥路由保護路徑隱私
接收方隱私
- • Trampoline 節點只知道下一個 Trampoline
- • 最終目的地隱藏在內層洋蔥中
- • 可結合 Route Blinding 進一步保護
費用計算
Trampoline Fee Structure: Traditional routing: Total fee = sum of each hop's routing fee Sender knows exact fee for each hop Trampoline routing: Total fee = Alice->T1 fee + T1 budget + T2 budget + ... Alice specifies: • T1 budget: 1000 sats (max allowed) • T2 budget: 800 sats T1 actually routes to T2 for 500 sats -> T1 keeps 500 sats as service fee Challenges: • Budget too low: payment fails • Budget too high: overpay fees • Need experience to set reasonable budget Optimizations: • Trampoline nodes can return fee estimates • Clients can gradually adjust budget • Use historical data to optimize
TLV 格式
Trampoline Onion TLV 欄位: 在 hop_payload 中添加: trampoline_onion_packet (type 66100) ├── version: 0 ├── public_key: 33 bytes ├── hop_payloads: encrypted └── hmac: 32 bytes trampoline_hop_payload: ├── amt_to_forward (type 2) ├── outgoing_cltv_value (type 4) ├── outgoing_node_id (type 14) // 下一個 Trampoline ├── invoice_features (type 66102) └── invoice_routing_info (type 66103) 功能位: - trampoline_routing_optional: bit 56 - trampoline_routing_required: bit 57
使用場景
移動錢包
手機錢包不需要同步完整圖譜,只需知道幾個 Trampoline 節點即可發送支付。 Phoenix、Breez 等錢包使用此技術。
瀏覽器擴展
WebLN 錢包如 Alby 可以使用 Trampoline 來減少資源佔用。
非同步支付
Trampoline 節點可以持有支付直到接收方上線,實現非同步支付。
實現狀態
Eclair 已支援
ACINQ 的 Eclair 是 Trampoline 的主要推動者,Phoenix 錢包使用 ACINQ 節點作為 Trampoline。
LND 部分支援
LND 可以轉發 Trampoline 支付,但不能作為 Trampoline 節點主動路由。
CLN 計劃中
Core Lightning 計劃支援 Trampoline,但尚未正式實現。
與其他技術的關係
Route Blinding
可以結合使用,接收方使用 blinded path,Trampoline 節點負責路由到 blinded 入口點。
BOLT 12 Offers
Offers 可以包含 Trampoline 節點資訊,讓輕量級客戶端知道如何路由。
相關資源
下一步: 了解 Route Blinding 如何保護接收方的隱私。
已複製連結