Anchor Outputs
Small outputs attached to Lightning commitment transactions that let the broadcaster add fees at close time.
Basically
Anchor outputs are small outputs in Lightning commitment transactions that let either party add fees later if needed. They prevent stuck transactions during force closes by letting both sides bump fees independently.
Key Takeaways
- Anchor outputs let both channel parties fee-bump commitment transactions after broadcast, avoiding stuck transactions during high-fee periods.
- Each commitment transaction includes two anchor outputs, one controlled by each party, ensuring neither can hold the other hostage during a fee spike.
- The 16-block anyone-can-spend rule cleans up anchor outputs after a short time, preventing UTXO bloat while keeping the mechanism simple.
What Are Anchor Outputs?
Anchor outputs are small outputs in Lightning commitment transactions that let either party add fees later if needed. They prevent stuck transactions during force closes by letting both sides bump fees independently.
The name "anchor" reflects their purpose: these outputs anchor the commitment transaction to the blockchain by providing a mechanism to pay whatever fee is necessary for timely confirmation. Without anchors, commitment transactions are broadcast with pre-signed fees that may be insufficient during fee spikes.
Anchor outputs were introduced in BOLT 3 as an optional commitment format and have become the recommended standard for new Lightning channels. They represent a fundamental improvement in channel security, particularly for the force close scenario where time-sensitive transactions must confirm within specific windows.
The Fee Volatility Problem
To understand why anchor outputs matter, consider how Lightning commitment transactions originally worked. When two parties open a channel, they pre-sign commitment transactions that can close the channel unilaterally. These transactions must include a fee, but that fee is locked in at signing time.
Bitcoin fees are volatile. A fee that seemed reasonable when the commitment was signed might be far too low weeks or months later during a fee spike. This creates a dangerous scenario:
The original solution was fee negotiation: channel parties would periodically update commitment transaction fees. But this required both parties to be online and cooperative, precisely the conditions that might not exist when you need to force close.
How Anchor Outputs Work
Anchor outputs solve the fee problem by separating fee payment from the commitment transaction itself. The commitment transaction is broadcast with a minimal fee (or zero fee in newer implementations), and fees are added through a child transaction that spends the anchor output.
The CPFP Mechanism
Child Pays for Parent is a Bitcoin mempool policy where miners consider the combined fee rate of a parent transaction and its children. If a parent has low fees but a child spends one of its outputs with high fees, miners are incentivized to include both transactions to collect the total fee.
With anchor outputs, the flow works like this:
Two Anchors, Two Parties
Commitment transactions include two anchor outputs because either party might need to fee bump. If only one anchor existed, controlled by one party, the other party would be helpless during a dispute. With two anchors:
This symmetry ensures neither party can hold the other hostage during a fee spike.
Technical Implementation
Anchor outputs have specific technical requirements that enable CPFP while preventing abuse.
Output Structure
Each anchor output is 330 satoshis (the dust limit for P2WSH outputs) and uses a specific script structure:
This script allows the anchor owner to spend immediately, but after 16 blocks, anyone can spend it. This cleanup mechanism prevents tiny anchor outputs from polluting the UTXO set forever.
Carve-Out Rule
Bitcoin Core includes a special mempool policy called the "CPFP carve-out" that was added specifically for anchor outputs. Normally, transaction packages have strict limits on descendant transactions. The carve-out allows one additional small child transaction beyond these limits, ensuring both channel parties can create fee-bumping children even if one party has already attached descendants.
HTLC Handling
With anchor outputs, HTLC outputs in commitment transactions are modified to use SIGHASH_SINGLE / SIGHASH_ANYONECANPAY signatures. This allows HTLC claims to be fee-bumped independently if needed, providing additional flexibility beyond just the anchor outputs.
Original Anchor Outputs
The first anchor output specification added two 330-sat outputs to each commitment transaction. While effective, this added 660 satoshis of overhead per commitment, which accumulated across many channel updates.
Zero-Fee Anchor Outputs
The current standard, sometimes called "zero-fee anchors" or "simplified anchors," sets the commitment transaction fee to zero and relies entirely on CPFP for fee payment. This approach:
Future: Ephemeral Anchors
Proposed improvements like ephemeral anchors would allow zero-value anchor outputs that must be spent in the same block. This eliminates the 330-sat dust overhead while maintaining CPFP capability. Ephemeral anchors require Bitcoin consensus changes and are part of ongoing protocol development discussions.
Reserve Requirements
Anchor outputs shift fee responsibility to the time of broadcast. This means nodes must maintain confirmed UTXOs specifically for fee bumping. A node without available UTXOs cannot effectively fee bump, potentially recreating the stuck transaction problem. Wallet implementations should maintain fee-bumping reserves and alert operators when reserves are low.
Pinning Attacks
Transaction pinning is an attack where a malicious party attaches large, low-fee descendants to a transaction, making it expensive to fee bump. The CPFP carve-out mitigates this for anchor outputs, but operators should understand that sophisticated attackers might attempt pinning strategies. Package relay improvements in Bitcoin Core continue to address these attack vectors.
Anchor Cleanup
The 16-block anyone-can-spend mechanism prevents UTXO bloat but means small amounts in anchors could theoretically be claimed by third parties. In practice, this is not a security concern since anchor values are at dust level, but implementations should not rely on recovering anchor funds.
Channel Type Negotiation
Lightning nodes negotiate channel types during opening. Not all nodes support anchor outputs, and channels may fall back to legacy commitment formats when connecting to older implementations. For maximum security, operators should prefer peers that support anchor outputs and monitor their channel types.