Anchor Output channels

Recap: Channel states

  • Each transaction is a new channel state
  • Each new channel state is an unpublished L1 TX
  • L1 TXs can be broadcasted at any time, unilateraly
  • ... this closes a channel

The problem

The problem

  • Fees need to be set when L1 TX is crafted
  • L1 TX is crafted when upgrading to channel state ...
  • ... NOT when actually publishing the TX (= channel closing)
  • These two events can happen at a completely different time

Conclusion

  • Fees need to be estimated for an unknown time in the future
  • It won't be accurate
  • Overpaying is real ...
  • ... underpaying as well

The good news

  • Only affects unilateral closes
  • Does not affect collaborative closes!
  • We don't really want the user to close the channel anyways
    • Bugs
    • Self-Sovereignity

Solution

  • Use a low fee in Commitment TX
  • CPFP the Commitment TX
  • CPFP = Child Pays For Parent
  • That's the basic idea behind anchor channels
  • Unfortunately it cannot be done than that simple

Imposed limits for CPFP

  • There are SPAM-protection measures in place for spending unconfirmed UTXOs
  • Max 24 descendants of unconfirmed TX
  • ... and other measures

Transaction pinning

Malicious channel counterparty can:

  • Create 24 descendants
  • with low feerate
  • such that no TX ever gets confirmed
  • That means you cannot CPFP!
  • Channel closing stays in limbo (potentially forever)

CPFP carve out

A new L1 policy has been deployed

  • 25th descendant is allowed, if it:
  • has no more than one unconfirmed parent
  • is of size no greater than 1K in virtual size

Now the scheme works, right?

  • You can CPFP your output from the channel
  • Your counterparty can CPFP their output
  • They can at most create 24 descendants ...
  • ... which leaves room for your 25th descendant spending your output

There's another problem ....

  • Your counterparty may have multiple outputs (because of unresolved HTLC)
  • So he can add 24 descentants on one output and the 25th on another
  • ... which again prevents you from CPFPing

Anchor Output channels

  • All channel outputs can only be spent 1 block after TX confirmation
  • Consequently, you cannot create any descendants for them, while TX is still unconfirmed
  • Two new outputs are added, with the only goal of being used for CPFPing
  • ... one for you, one for your counterparty

TADAAAAA!!

Anchor Output channels

  • All channel outputs can only be spent 1 block after TX confirmation
  • Consequently, you cannot create any descendants for them, while TX is still unconfirmed
  • Two new outputs are added, with the only goal of being used for CPFPing
  • ... one for you, one for your counterparty

Hunting on the Blockchain

Let's look at this anchor output channel in the wild ...

Visualization

Advantages

  • Define L1 fees in-time

Indispensable for LSPs (Breez)

Disadvantages

  • You need additional funds outside the channel to CPFP
  • Construct needs more block space, not less