跳至主要內容
高級

Channel Factories 通道工廠

了解 Channel Factories 如何讓多個參與者共享一筆鏈上交易來開設多個閃電通道,大幅降低成本。

15 分鐘

什麼是 Channel Factory?

Channel Factory(通道工廠)是一種讓多個參與者共享一筆鏈上交易來創建多個閃電通道的技術。 傳統上,每個通道需要單獨的鏈上交易。通道工廠可以讓 N 個參與者用一筆交易創建 最多 N×(N-1)/2 個通道,大幅降低鏈上成本。

研究階段: Channel Factories 目前仍是研究提案,尚未在主網實現。 需要 SIGHASH_ANYPREVOUT 或類似的軟分叉來實現最佳版本。

擴展性問題

Problem with Traditional Channel Opening:

Assume 10 people want to open channels with each other:

  Channels needed: 10 x 9 / 2 = 45 channels
  On-chain TXs needed: 45
  Assume fee per TX: 10,000 sats
  Total cost: 450,000 sats

As participants increase:
  - 20 people: 190 channels -> 1,900,000 sats
  - 100 people: 4,950 channels -> 49,500,000 sats
  - Scalability is very poor!

Channel Factory Solution:

  10 people share one Factory
  On-chain TXs needed: 1 (open) + 1 (close)
  Total cost: ~20,000 sats (huge savings!)

  Factory can create any channel configuration internally
  No additional on-chain transactions needed

基本結構

Channel Factory Layer Structure:

Layer 1: Funding Transaction

  Inputs: Each participant's UTXO
  Output: N-of-N multisig address

  Alice: 1 BTC --+
  Bob: 1 BTC ----+--> [3-of-3 multisig] = 3 BTC
  Carol: 1 BTC --+

Layer 2: Allocation Transaction

  Spends Layer 1 multisig output
  Creates multiple channel outputs

  3 BTC --> Alice-Bob channel: 1 BTC
        --> Bob-Carol channel: 1 BTC
        --> Alice-Carol channel: 1 BTC

  These channels are "virtual" - not on-chain!

Layer 3: Commitment Transactions

  Each channel has its own commitment TX
  Normal Lightning channel mechanics

Key Points:
  - Only Layer 1 TX goes on-chain
  - Layers 2 and 3 are off-chain state
  - Can force any layer on-chain if needed
  - State updates require all participants' signatures

狀態更新

Factory State Updates:

Scenario: Alice wants to open new channel with Dave

Current State:
  Factory: Alice, Bob, Carol, Dave
  Channels: Alice-Bob, Bob-Carol, Carol-Dave
  Balance allocation: 1 BTC each

Update Flow:
  1. Alice proposes new allocation state
  2. All 4 people sign new allocation TX
  3. Old state is revoked
  4. New state takes effect

New State:
  Channels: Alice-Bob, Bob-Carol, Carol-Dave, Alice-Dave
  Each channel allocated 0.8 BTC (total unchanged)

Challenges:
  - All participants must be online and agree
  - Anyone refuses -> cannot update
  - Coordination cost increases with more participants
  - This is Factory's main limitation

Eltoo 的重要性

沒有 Eltoo 的問題

使用 LN-Penalty 機制時,每個狀態更新需要存儲撤銷密鑰。 多方參與時,撤銷密鑰數量爆炸性增長,實際不可行。

有 Eltoo 的優勢

Eltoo 使用狀態編號機制, 新狀態可以直接覆蓋舊狀態。無需存儲撤銷信息,完美適合多方協議。

Eltoo + Channel Factory:

Using SIGHASH_ANYPREVOUT:

Update TX #1 --+
Update TX #2 --+--> Any can spend Funding TX
Update TX #3 --+
   ...
Update TX #N ----> Latest state

Settlement TX ----> Final settlement

Flow:
  1. Anyone broadcasts any old Update TX
  2. Others can broadcast newer Update TX
  3. Only latest state takes effect
  4. Settlement TX completes settlement

Benefits:
  - No need to store revocation keys
  - State can update infinitely
  - Offline participants won't be punished
  - Perfect for multi-party protocols

使用場景

企業內部網路

公司內部的多個部門或子公司可以共享一個 Factory, 在內部進行頻繁的資金流轉而幾乎無需鏈上交易。

交易所聯盟

多個交易所可以創建 Factory 進行清結算,大幅減少鏈上交易需求。

LSP 聯盟

多個 LSP 可以共享 Factory,為用戶提供更好的連通性和更低的成本。

社群/DAO

去中心化組織的成員可以使用 Factory 進行內部資金流轉, 治理決策可以調整通道配置。

挑戰與限制

Channel Factory Challenges:

1. Coordination Problem
   - All participants must be online to update
   - One offline -> everyone stuck
   - Malicious participant can block updates
   - Need incentive mechanism for cooperation

2. Exit Cost
   - Single exit requires closing entire Factory
   - Or expensive on-chain split
   - May need "virtual" exit mechanism

3. Capital Efficiency
   - Funds locked in Factory
   - Cannot use for channels outside Factory
   - Need to balance internal/external liquidity

4. Soft Fork Dependency
   - Best implementation needs SIGHASH_ANYPREVOUT
   - Or similar covenant support
   - Not yet activated on Bitcoin

5. Complexity
   - Multi-layer transaction structure
   - Complex state management
   - High implementation and audit difficulty

Possible Mitigations:
  - Small-scale Factory (5-10 people)
  - Trust assumptions (e.g., within enterprise)
  - Incentive mechanisms (deposit/reputation)
  - Backup exit paths

相關概念

Ark

Ark 是另一種多方協議設計,使用不同的方法解決擴展性問題。 它允許用戶無需與其他參與者協調就能發送支付。

Statechains

Statechains 允許 UTXO 所有權的鏈下轉移,是另一種 Layer 2 擴展方案。

Virtual Channels

虛擬通道是在現有通道之上創建的「虛擬」通道,不需要額外的鏈上交易。 Channel Factory 可以看作是虛擬通道概念的擴展。

實現狀態

研究階段

Channel Factories 目前處於研究和提案階段。需要等待 SIGHASH_ANYPREVOUT 軟分叉激活後才能實現最佳版本。 部分簡化版本可以在現有 Bitcoin 上實現,但有更多限制。

相關資源

下一步: 了解 Eltoo 如何簡化狀態更新並啟用 Channel Factories。

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