lightning-dev

Scaling Lightning Safely With Feerate-Dependent Timelocks

Scaling Lightning Safely With Feerate-Dependent Timelocks

Posted on: December 14, 2023 17:07 UTC

The blog post addresses the vulnerability of the Lightning Network and channel factories to forced expiration spam attacks due to their reliance on timelocks.

It notes that attackers can flood the blockchain with transactions, preventing legitimate users from executing their timelocked transactions in time. The original Lightning paper recognizes this problem, suggesting the potential for multiple channels to expire at once, aiding attackers.

Existing solutions, such as longer timelocks or penalty systems, have been found insufficient in fully mitigating these risks or preserving capital efficiency. Unpredictable blockchain congestion further exacerbates the issue, creating a risk of self-amplifying congestion spikes.

A proposed solution to enhance security is the introduction of Feerate-Dependent Timelocks (FDTs), which would require a change to Bitcoin's consensus rules. FDTs automatically extend the duration of timelocks when transaction fees are high, deterring attackers by prolonging the unavailability of their capital. This system does not rely on explicit penalties and can be adjusted for resistance against dishonest miner strategies.

The technical implementation of FDTs would utilize the nSequence and nLocktime fields of a transaction, allowing for conditions that depend on transaction fees. Minimal additional resources are needed for nodes to verify FDTs, requiring only slight increases in memory and computation.

Beyond protecting against spam attacks, FDTs offer several other benefits, such as shielding users from high fees during congestion, refining fee-penalty calculations, and reducing risks for one-shot receives. Additionally, an analysis of FDTs corrects a mistake in the original Bitcoin whitepaper regarding the risk of double spend attacks, showing a decreased risk with more confirmations, particularly when facing dishonest miners. For further details, a separate paper and GitHub implementations are available.

In conclusion, FDTs present a multi-faceted solution, improving security for cryptocurrency transactions without compromising capital efficiency. They act as a deterrent to attackers while maintaining usability during normal conditions. The minimal cost of their implementation makes the case for their adoption into Bitcoin consensus rules compelling.