跳至主要內容
高級

Eltoo / LN-Symmetry

了解 Eltoo(也稱為 LN-Symmetry)如何通過對稱狀態更新簡化閃電網路通道機制,消除懲罰交易的需求。

15 分鐘

什麼是 Eltoo?

Eltoo(發音類似 "L2")是一種新的閃電網路通道更新機制,由 Christian Decker 等人於 2018 年提出。它使用「對稱」的狀態更新取代了當前的「LN-Penalty」機制, 大幅簡化了通道設計,並消除了對懲罰交易的需求。

前置條件: Eltoo 需要 Bitcoin 添加 SIGHASH_ANYPREVOUT(APO)操作碼,這是一個尚未激活的軟分叉提案。 因此 Eltoo 目前只是理論設計,無法在主網使用。

當前機制的問題

LN-Penalty (Current Mechanism) Problems:

1. Asymmetric State
   Alice's commitment tx != Bob's commitment tx
   Each update produces two different transactions
   Increases complexity and potential errors

2. State Storage Burden
   Each channel update requires storing:
   • New commitment tx
   • Peer's revocation key
   • All HTLC timeout/success transactions

   10,000 updates ~ several GB of data!

3. Penalty Mechanism Risks
   • Must store all old states
   • Lost old states = cannot penalize cheater
   • Watchtower needs massive storage

4. Toxic State
   • Accidentally broadcasting old state may cause total loss
   • Hardware failure can cause disaster
   • Complex backup requirements

Eltoo 設計

Eltoo Core Concept:

Symmetric State:
Alice and Bob use the same update tx and settle tx

         Funding TX
         (2-of-2 multisig)
              |
              v
         Update TX (state n)
         Can be overwritten by state n+1
              |
              v
         Settlement TX
         Final balance distribution to Alice and Bob

Key Features:
• Anyone can "overwrite" old state with newer state
• No penalty mechanism needed
• Only need to store latest state

SIGHASH_ANYPREVOUT

Eltoo 的關鍵是 SIGHASH_ANYPREVOUT(APO),一種新的簽名哈希標誌:

SIGHASH_ANYPREVOUT Explained:

Traditional signature (SIGHASH_ALL):
  Signature commits to = Hash(
    all inputs (including txid and vout) +
    all outputs
  )
  -> Signature bound to specific input UTXO

ANYPREVOUT:
  Signature commits to = Hash(
    input's scriptPubKey (not txid/vout) +
    all outputs
  )
  -> Signature not bound to specific UTXO, can attach to any compatible output

This means:
  Update TX n+1 signature can spend:
  • Funding TX output
  • Or Update TX n output
  • Or any earlier Update TX output

  As long as output script is compatible!

狀態更新流程

Eltoo State Transitions:

Initial state:
Funding TX --[state 0]--> Update TX 0 --> Settlement TX 0
                          Alice: 5 BTC
                          Bob:   5 BTC

Alice pays 1 BTC to Bob:
Funding TX --[state 1]--> Update TX 1 --> Settlement TX 1
                          Alice: 4 BTC
                          Bob:   6 BTC

Bob pays 2 BTC to Alice:
Funding TX --[state 2]--> Update TX 2 --> Settlement TX 2
                          Alice: 6 BTC
                          Bob:   4 BTC

Close channel (normal):
1. Both parties agree to use latest state
2. Broadcast Update TX 2
3. Wait for timelock
4. Broadcast Settlement TX 2

Close channel (someone cheats):
1. Alice broadcasts old Update TX 0
2. Bob notices, broadcasts Update TX 2
3. Update TX 2 "overwrites" Update TX 0
4. Settlement uses Settlement TX 2

No penalty! Just restores to correct state.

交易結構

Eltoo Transaction Structure:

Funding TX:
  Output:
    2-of-2 MuSig (Alice + Bob)
    or Taproot output

Update TX (state n):
  Input:
    Signed with SIGHASH_ANYPREVOUT
    Can spend Funding TX or any earlier Update TX

  Output:
    <state_n+1 pubkey> CHECKSIG
    or after CSV timelock:
    <settlement pubkey> CHECKSIG

  nLockTime: state number (ensures ordering)

Settlement TX:
  Input:
    Spends Update TX output (after CSV)

  Outputs:
    Alice: X BTC
    Bob:   Y BTC
    (distributed according to latest state)

Eltoo vs LN-Penalty

特性 LN-Penalty(當前) Eltoo
狀態對稱性 非對稱 對稱
存儲需求 O(n) - 所有舊狀態 O(1) - 只需最新
作惡懲罰 全額沒收 只是更正狀態
有毒備份 是(舊備份危險) 否(任何備份安全)
Watchtower 存儲 每次更新都要存 只存最新
多方通道 極其複雜 自然支持
Bitcoin 要求 當前已支援 需要 APO 軟分叉

Channel Factories

Eltoo 的一個重要應用是實現 Channel Factories(通道工廠):

Channel Factory Concept:

Traditional mode: Each channel needs one on-chain tx
  Alice--Bob: 1 tx
  Alice--Carol: 1 tx
  Bob--Carol: 1 tx
  Total 3 on-chain transactions

Channel Factory:

      Factory Funding TX
      (N-of-N multisig)
      Alice + Bob + Carol + ...
              |
      +-------+-------+
      |               |
  Alice-Bob      Bob-Carol
   Channel        Channel

  Only 1 on-chain tx to open multiple channels!

Eltoo advantages:
• Multi-party coordination simpler (symmetric state)
• Anyone going offline doesn't cause penalty risk
• Can dynamically adjust channels within Factory

APO 軟分叉進展

BIP 118: SIGHASH_ANYPREVOUT

原名 SIGHASH_NOINPUT,由 Christian Decker 提出。定義了新的簽名哈希模式。

社群討論中

APO 提案已存在多年,但尚未進入激活流程。一些開發者擔心潛在的安全風險。

替代方案

OP_CHECKTEMPLATEVERIFY (CTV) 和 OP_CAT 也可能實現類似功能,但設計不同。

相關資源

下一步: 了解 多路徑支付 如何提高大額支付的成功率。

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