Skip to content

Zero-fee commitments using v3 transactions (feature 40/41) - #1228

Merged
t-bast merged 2 commits into
lightning:masterfrom
t-bast:zero-fee-commitments
May 4, 2026
Merged

t-bast merged 2 commits into
lightning:masterfrom
t-bast:zero-fee-commitments

Conversation

@t-bast

@t-bast t-bast commented Feb 14, 2025 •

Copy link
Copy Markdown
Collaborator

We introduce a new channel_type that leverages v3 (TRUC) transactions, pay-to-anchor outputs and ephemeral dust. With this change, commitment transactions don't pay any mining fee (in most cases), which gets rid of update_fee and all of the related channel reserve issues. It also gets rid of the undesired channel force-closes that happen when the mempool feerate spikes and channel participants disagree on what feerate to use, which has been a major source of wasted on-chain space.

It also offers better protection against pinning attacks (thanks to package relay) and reduces the on-chain footprint compared to anchor output channels.

We use a single anchor output whose amount is the sum of all trimmed outputs (outputs below the dust_limit, which are thus not included in the commitment transaction) and all millisatoshi amounts that have been rounded down to satoshis, capped at 240 sats (and may thus be 0 sat when there are no trimmed outputs or rounded down millisatoshi amounts). Note that when the sum of trimmed outputs and millisatoshi rounding exceeds 240 sats, the commitment transaction won't by 0-fees anymore: but the fees aren't deduced from any of the commitment transaction's outputs.

This anchor output is unkeyed: it simply uses the standard P2A output introduced in bitcoin/bitcoin#30352.

We remove the 1-block relative delay used by anchor output channels: this allows using our channel outputs (main balance or pending HTLCs) to CPFP a remote commitment transaction (no need to add external inputs, which simplifies wallet management and liquidity requirements).

Note that v3 transactions and pay-to-anchor outputs have been standard since the release of Bitcoin Core v28.0. Ephemeral dust has become standard in the Bitcoin Core v29.0 release. All of this is thus ready to use on the network now!

Comment thread 05-onchain.md Resolved
@saubyk

saubyk commented Feb 17, 2025

Copy link
Copy Markdown

We use a single anchor output whose amount is the sum of all trimmed outputs (and may thus be 0 sat).

Hi @t-bast can you elaborate this a bit?

@saubyk

saubyk commented Feb 17, 2025

Copy link
Copy Markdown

We use a single anchor output whose amount is the sum of all trimmed outputs (and may thus be 0 sat).

Hi @t-bast can you elaborate this a bit?

Never mind. This delving post has the details, makes for a good supplemental reading:
https://delvingbitcoin.org/t/which-ephemeral-anchor-script-should-lightning-use/1412

Comment thread 03-transactions.md Resolved
@t-bast

t-bast commented Feb 19, 2025

Copy link
Copy Markdown
Collaborator Author

Hi @t-bast can you elaborate this a bit?

This will become more obvious when I add the test vectors! It is also already defined in Bolt 3, if the paragraph for this is unclear please put a comment on it with a suggestion on how I could make it clearer.

@morehouse morehouse left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approach ACK.

Really eager to see this get implemented and used across the network. Also hope we can follow up soon with the changes needed to fix HTLC pinning.

Comment thread 02-peer-protocol.md Resolved
Comment thread 03-transactions.md Resolved
Comment thread 05-onchain.md Resolved
Comment thread 05-onchain.md Resolved
Comment thread 05-onchain.md Resolved
Comment thread 05-onchain.md Resolved

@TheBlueMatt TheBlueMatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was actually a good bit easier to implement than I thought.

Comment thread 09-features.md Resolved
Comment thread 03-transactions.md Resolved
@t-bast t-bast mentioned this pull request Mar 6, 2025
10 of 19 tasks
@t-bast t-bast mentioned this pull request Mar 20, 2025
15 of 20 tasks
@t-bast t-bast mentioned this pull request Apr 3, 2025
8 of 24 tasks
@t-bast t-bast mentioned this pull request Apr 16, 2025
9 of 23 tasks
@t-bast t-bast mentioned this pull request Apr 30, 2025
12 of 22 tasks
@tnull

tnull commented May 6, 2025

Copy link
Copy Markdown
Contributor

Just want to node that it was discussed in yesterday's spec call that as part of this work we'll probably also want to make option_simple_close transactions (optionally) v3, i.e., require v3 close transactions for v3 channels.

@Roasbeef

Roasbeef commented May 7, 2025 •

Copy link
Copy Markdown
Collaborator

Just want to node that it was discussed in yesterday's spec call that as part of this work we'll probably also want to make option_simple_close transactions (optionally) v3, i.e., require v3 close transactions for v3 channels.

Compared to the HTLC case, are there any pinning concerns when it comes to coop close? The channel is no longer active, and the only outputs on the coop close transaction send funds directly to either party.

I point this out as the TRUC constraints are passed on to all unconfirmed children:

Any TRUC transaction's unconfirmed ancestors must all be TRUC

As a result, if the coop close transaction is v3, then a user wouldn't be able to CPFP with a non-v3 transaction to bump the fee (imagine the peer is just no longer offline). Another scenario that would be prevented is a non-v3 aware wallet spending that unconfirmed change to create a normal transaction, or fund a new channel.

@t-bast

t-bast commented May 12, 2025

Copy link
Copy Markdown
Collaborator Author

Compared to the HTLC case, are there any pinning concerns when it comes to coop close?

I don't think there are any, once we start using v3 for the commit tx and mutual close tx, the mutual close tx should be protected against pinning.

@t-bast t-bast mentioned this pull request May 15, 2025
7 of 24 tasks
Comment thread 02-peer-protocol.md Resolved
Comment thread 03-transactions.md Resolved
Comment thread 02-peer-protocol.md Resolved
Comment thread 03-transactions.md Resolved
@t-bast t-bast mentioned this pull request May 28, 2025
3 of 26 tasks
@t-bast t-bast mentioned this pull request Jun 11, 2025
9 of 25 tasks
@t-bast t-bast mentioned this pull request Jun 26, 2025
10 of 25 tasks
@t-bast t-bast mentioned this pull request Jul 8, 2025
19 of 25 tasks
@t-bast t-bast mentioned this pull request Jul 25, 2025
10 of 24 tasks
@t-bast t-bast mentioned this pull request Jan 26, 2026
11 of 25 tasks
t-bast added a commit to ACINQ/eclair that referenced this pull request Feb 13, 2026
We add support for the zero-fee commitment format specified in
lightning/bolts#1228.

Channels using this commitment format benefit from better protection
against pinning attacks (thanks to TRUC/v3 transactions), don't need
the `update_fee` mechanism, have less dust exposure risk, and use an
overall simpler state machine.

In this commit, we simply introduce the commitment format and create
the corresponding transactions.
t-bast added a commit to ACINQ/eclair that referenced this pull request Feb 27, 2026
We add support for the zero-fee commitment format specified in
lightning/bolts#1228.

Channels using this commitment format benefit from better protection
against pinning attacks (thanks to TRUC/v3 transactions), don't need
the `update_fee` mechanism, have less dust exposure risk, and use an
overall simpler state machine.

In this commit, we simply introduce the commitment format and create
the corresponding transactions.
@t-bast t-bast mentioned this pull request Feb 27, 2026
12 of 22 tasks
@t-bast t-bast mentioned this pull request Mar 23, 2026
9 of 20 tasks
t-bast added a commit to ACINQ/eclair that referenced this pull request Apr 3, 2026
We add support for the zero-fee commitment format specified in
lightning/bolts#1228.

Channels using this commitment format benefit from better protection
against pinning attacks (thanks to TRUC/v3 transactions), don't need
the `update_fee` mechanism, have less dust exposure risk, and use an
overall simpler state machine.

In this commit, we simply introduce the commitment format and create
the corresponding transactions.
We introduce a new `channel_type` that leverages v3 transactions,
pay-to-anchor outputs and ephemeral dust. With this change, commitment
transactions don't pay any mining fee, which gets rid of `update_fee`
and all of the related channel reserve issues. It also gets rid of the
undesired channel force-closes that happen when the mempool feerate
spikes and channel participants disagree on what feerate to use, which
has been a major source of wasted on-chain space.

It also offers better protection against pinning attacks and reduces the
on-chain footprint compared to anchor output channels. We use a single
anchor output whose amount is the sum of all trimmed outputs and rounded
down millisatoshi amounts (and may thus be `0 sat`), capped at 240 sats.
When the sum of trimmed outputs and rounded down millisatoshi amounts
exceeds 240 sats, the remaining amount directly goes to on-chain fees
(and in that case, the commitment transactions does pay some on-chain
fees on its own). We do this to ensure that only miners can collect
the excess from trimmed outputs, while respecting standardness rules.

We remove the 1-block relative delay used by anchor output channels,
because we don't need the CPFP carve-out rule when using v3 txs. This
allows using our channel outputs (main balance or pending HTLCs) to
CPFP a remote commitment transaction (no need to add external wallet
inputs, which greatly simplifies liquidity management).

v3 transactions and pay-to-anchor outputs have been standard since the
release of Bitcoin Core v28.0. Ephemeral dust has been standard since
the Bitcoin Core v29.0 release.
@t-bast
t-bast force-pushed the zero-fee-commitments branch from b982ae7 to b3d9bed Compare April 7, 2026 09:57
@t-bast

t-bast commented Apr 7, 2026

Copy link
Copy Markdown
Collaborator Author

As discussed during yesterday's spec meeting, rebased to fix minor conflicts with splicing. This is ready to integrate as we have cross-compatibility between LDK and eclair. @tankyleo @TheBlueMatt, can you give a final ACK before I merge?

Comment thread 02-peer-protocol.md Resolved
Comment thread 02-peer-protocol.md Resolved
@t-bast

t-bast commented Apr 14, 2026

Copy link
Copy Markdown
Collaborator Author

@tankyleo @TheBlueMatt, shall we? 😇

@t-bast t-bast mentioned this pull request Apr 20, 2026
10 of 23 tasks
t-bast added a commit to ACINQ/eclair that referenced this pull request Apr 30, 2026
We add support for the zero-fee commitment format specified in
lightning/bolts#1228.

Channels using this commitment format benefit from better protection
against pinning attacks (thanks to TRUC/v3 transactions), don't need
the `update_fee` mechanism, have less dust exposure risk, and use an
overall simpler state machine.

In this commit, we simply introduce the commitment format and create
the corresponding transactions.
@t-bast
t-bast merged commit 444805d into lightning:master May 4, 2026
@t-bast
t-bast deleted the zero-fee-commitments branch May 4, 2026 20:43
t-bast added a commit to ACINQ/eclair that referenced this pull request May 11, 2026
We add support for the zero-fee commitment format specified in
lightning/bolts#1228.

Channels using this commitment format benefit from better protection
against pinning attacks (thanks to TRUC/v3 transactions), don't need
the `update_fee` mechanism, have less dust exposure risk, and use an
overall simpler state machine.

In this commit, we simply introduce the commitment format and create
the corresponding transactions.
t-bast added a commit to ACINQ/eclair that referenced this pull request May 13, 2026
We add support for the zero-fee commitment format specified in
lightning/bolts#1228.

Channels using this commitment format benefit from better protection
against pinning attacks (thanks to TRUC/v3 transactions), don't need
the `update_fee` mechanism, have less dust exposure risk, and use an
overall simpler state machine.

In this commit, we simply introduce the commitment format and create
the corresponding transactions.
t-bast added a commit to ACINQ/eclair that referenced this pull request May 19, 2026
We add support for the zero-fee commitment format specified in
lightning/bolts#1228.

Channels using this commitment format benefit from better protection
against pinning attacks (thanks to TRUC/v3 transactions), don't need
the `update_fee` mechanism, have less dust exposure risk, and use an
overall simpler state machine.

In this commit, we simply introduce the commitment format and create
the corresponding transactions.
t-bast added a commit to ACINQ/eclair that referenced this pull request May 20, 2026
* Add support for zero-fee commitment format

We add support for the zero-fee commitment format specified in
lightning/bolts#1228.

Channels using this commitment format benefit from better protection
against pinning attacks (thanks to TRUC/v3 transactions), don't need
the `update_fee` mechanism, have less dust exposure risk, and use an
overall simpler state machine.

In this commit, we simply introduce the commitment format and create
the corresponding transactions.

* Rename `ClaimRemoteDelayedOutputTx`

It isn't delayed anymore for v3 transactions. We could use static wallet
public key, but in most cases it wouldn't work and adds extra complexity
so we don't do it. We add a comment in the documentation of this class
to explain why we're always making a 2nd-stage transaction.

* Validate channel parameters

We apply slightly different validation for zero-fee commitments:

- the commit feerate must be `0 sat/byte`
- the max number of accepted HTLCs must be at most 114
- `update_fee` cannot be used

We verify those requirements during channel creation and add tests
for normal channel operation.

* Handle force-closing zero-fee channels

We add support for force-close zero-fee channels. When publishing the
local commit, this works mostly the same way as other channel types.
The only difference is that we don't even attempt to publish the commit
tx individually: we always bundle it with the anchor transaction.

When we detect the remote commit though, we're able to introduce some
new behavior:

- if we have a large enough main output, we use that to pay the fees
  of the remote commit tx (unless it is already confirmed), which avoids
  using a wallet input
- otherwise, we spend the anchor output, which competes with the remote
  peer package

Since we're only using the anchor transaction or our main output to
spend the ephemeral anchor, we cannot publish HTLC txs until the
commit tx is confirmed. We will in the future make *all* transactions
go through the `ReplaceableTxPublisher`, and at the point we'll be able
to simplify this, but it's too early for this refactoring, so for now
we simply wait for the commit tx to be confirmed before publishing
HTLC txs.

* Don't force-close on remote `error`

When using zero-fee commitments, we don't force-close when receiving an
`error` from our peer: if they want to force-close the channel, they can
publish their commitment instead of forcing us to publish ours. It is
especially true when the commit tx doesn't pay any fees, because the
publisher will pay the entire fees for the force-close.

Note that for wallet peers, we could introduce a mechanism where they
send us their signed commit tx in the error message if they don't have
any wallet input to pay the fees, and we could be nice and publish it
while paying the fees from our main output (which isn't delayed since
it is the remote commit from our point of view).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.