Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

lightning-channels

БесплатноБез исполняемых скриптовНе проверен

Lightning channel mechanics: funding tx, commitment tx, anchor outputs, zero-fee commitments (v3/TRUC), to_local / to_remote outputs, dual-funded (v2)…

claude-dev-suiteот claude-dev-suite★ 51 звезда на GitHub

Об этом скилле

Lightning Channels

Quick refs: state-machine.md, commitment-tx.md, force-close.md

A Lightning channel is a 2-of-2 multisig output on chain that two parties update off-chain via signed commitment transactions. Each commitment is a fully-signed tx that, if broadcast, settles the channel in one party's favour at the latest committed state.

Channel lifecycle

  1. Open — open_channel → accept_channel → on-chain funding tx → funding_locked (after min_depth).
  2. Update — exchange update_add_htlc / commitment_signed / revoke_and_ack to flow funds.
  3. Close — cooperative (shutdown + closing_complete / closing_sig, or legacy closing_signed) or unilateral (broadcast latest commitment).

Funding tx

Two-party 2-of-2 multisig (legacy):

P2WSH(redeem = MULTI 2 <pk_init> <pk_resp> 2 CHECKMULTISIG)

Or Taproot key-aggregated (taproot channels):

P2TR(MuSig2(pk_init, pk_resp))

Funding tx flow:

  • Initiator constructs funding tx, sends funding_created with outpoint.
  • Responder signs initial commitment tx.
  • Initiator broadcasts funding tx.
  • Both wait min_depth confirmations, then channel_ready.

Commitment tx (current state)

Each side holds the latest commitment they can broadcast. Outputs:

to_local      (this party's balance, with revocation OP_CSV delay)
to_remote     (other party's balance)
htlc_offered  (one per outgoing HTLC)
htlc_received (one per incoming HTLC)
to_local_anchor    (330 sats, `option_anchors` only)
to_remote_anchor   (330 sats, `option_anchors` only)
shared_anchor      (0-240 sats, `zero_fee_commitments` only)

Asymmetric: each party's commitment has its own to_local (with revocation key) — the other side has the revocation secret.

Static remote key (BOLT 9 bit 12)

Pre-BOLT static_remotekey: to_remote was rotated each commitment update, requiring constant pubkey derivation. Post-BOLT:

  • to_remote is a fixed pubkey for the lifetime of the channel.
  • Simplifies on-chain recovery (always know your to_remote key).

Anchor outputs — option_anchors (BOLT 9 bits 22/23)

The commitment type in general use as of September 2026 (it is what LND and CLN open; neither source tree references the zero-fee type below):

  • Each party has a 330-sat to_local_anchor output spendable immediately by themselves and after 16 blocks by anyone.
  • Allows CPFP fee bumping by spending the anchor.
  • Channel-cost: 660 sats committed to anchors, recovered on close (or claimed by anyone after 16 blocks via the public path).
  • Non-anchor outputs are CSV-locked: to_remote and both HTLC output types by 1 block, to_local by to_self_delay — so the anchor is the only output you can CPFP from. Funding the child needs an external on-chain UTXO.

Defeats some pre-anchor pinning attacks but introduced new vulnerabilities (replacement cycling) addressed by TRUC v3.

Zero-fee commitments — zero_fee_commitments (BOLT 9 bits 40/41)

Merged into the BOLT spec on 2026-05-04 (lightning/bolts PR #1228). This channel type replaces the anchor + update_fee model rather than tuning it:

  • Commitment tx version is 3 (TRUC), so commitment + one child form a v3 package under TRUC's topology limits.
  • feerate_per_kw is fixed at 0. The base fee of the commitment tx, the HTLC-timeout tx and the HTLC-success tx MUST be 0. Fees come from the CPFP child (commitment) or from added inputs (HTLC txs).
  • update_fee is never sent on such a channel. That removes feerate disagreement, the funder's fee reserve, and the force-closes caused by mempool feerate spikes.
  • A single shared_anchor output replaces the two keyed anchors: the standard P2A script OP_1 <0x4e73>, spendable by anyone with an empty witness. Its amount is the sum of trimmed outputs plus rounded-down msat; below the 240-sat P2A dust limit that is allowed under Bitcoin Core's ephemeral-dust rule precisely because the parent pays no fee, and it may legitimately be 0 sat. Above 240 sats the anchor caps at 240 and the remainder becomes a real mining fee — so "zero fee" is the common case, not an invariant.
  • The 1-block CSV is scoped to option_anchors, so here to_remote is a plain P2WPKH. You can CPFP a remote commitment by spending your own main-balance or HTLC output — no external wallet UTXO.

Needs a relay path accepting v3/TRUC (standard since Bitcoin Core v28.0) and ephemeral dust (standard since v29.0). Eclair v0.14.0 (2026-05-21) shipped the final form and bumped its Bitcoin Core dependency to v30.x for exactly those policies; as of September 2026 zero_fee_commitments does not appear in the LND or CLN source trees, so assume option_anchors when interoperating with them.

Dual-funded (BOLT 2 v2)

Both parties contribute inputs to the funding tx → can have non-zero balance for both sides at open time.

Messages:

Полный SKILL.md на GitHub

Установить lightning-channels в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Grep
Glob

Вложенные файлы

quick-ref/commitment-tx.mdquick-ref/force-close.mdquick-ref/state-machine.md

FAQ

Что делает скилл lightning-channels?

Lightning channel mechanics: funding tx, commitment tx, anchor outputs, zero-fee commitments (v3/TRUC), to_local / to_remote outputs, dual-funded (v2), zero-conf, wumbo, taproot channels, splicing. Quick refs: state machine, commitment tx structure, force-close flow. USE WHEN: opening/closing channels, debugging force-closes, designing channel UX, evaluating anchor vs static-remote-key tradeoffs.

Как установить скилл lightning-channels?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл lightning-channels запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить lightning-channels с