Bug freezes bitcoin inside Lightning Network for hours
Late Sunday, researchers discovered a critical validation flaw on LND, a popular implementation of Bitcoin’s Lightning Network championed by Lightning Labs.
Specifically, LND’s Bitcoin full node implementation, BTCD, had a flaw in its implementation of Taproot. (BTCD is a full node implementation for Bitcoin that is popular with Lightning Network users.)
The bug affects LND versions 0.15.1 and older. LND encourages all users to upgrade to v0.15.2.
The LND bug affected how Lightning nodes worked and prevented LND users from exiting the layer 2 Lightning Network to mainnet, layer 1 Bitcoin for a few hours. While the bug was unresolved, LND users could not create or close new Lightning channels.
Massive multi-sig Taproot transaction exposed the flaw
Scientists discovered the LND error while testing the limits of Bitcoin Scripting Language, a programming language for Bitcoin. They wanted to test an extremely advanced smart contract that required co-authentication by a number of parties.
To conduct this test, a researcher, Burak, created a large 998-of-999 multi-sig Taproot transaction. This required 998 private key signatures to authenticate the sending of bitcoin – an extraordinary number of co-signatories.
To put that 998 number in context, consider that Lightning Network users typically open channels using only 2-of-2 multi-sig transactions.
998-of-999 multi-sig Taproot transaction was accepted by manufacturers of test grid blocks. The transaction was later mined in a mainnet Bitcoin block. Then the transaction broke LND.
That transaction confused the method used by LND to calculate what the last Bitcoin block was. Specifically, LND failed to parse a new block due to its error library. The following message will appear in error logs: “Unable to complete chain again: readScript: script witness element is larger than the maximum size allowed.”
Lightning Labs immediately began work on an LND error fixis updating BTCD’s wire-parsing library, and planned to release version 0.15.2
Read more: Offline Bitcoin Lightning payments will soon be possible
Highlights the need for cross-implementation of watchtower services
After the error resolution process, researchers began to express a need for watchtower services that are implementation agnostic.
This bug only affected LND. LND is one popular implementation of Lightning Network. Other implementations include Éclair and Core Lightning.
Watchtowers are third-party services that monitor the publicly visible Bitcoin Lightning Network and allow users to seek redress for bad behavior. Watchtower can monitor all implementations of Lightning to protect users during the failure of a particular implementation.
For example, because most users join Lightning as a 2-of-2 multi-sig transaction, they usually trust that a counterparty is not lying about the final balance of bitcoin in each other’s possession when they close the channel and exit the network of mainnet Bitcoin.
If someone lies about the bitcoins in their possession when trying to close a Lightning channel, a user who can prove this lie can publish another one, called Justice transactionand take 100% of the bitcoin in their channel as a reward for catching the lie.
A watchtower monitoring all implementations (LND, Core Lightning, Éclair, etc.) can protect a user during failures or hacks, allowing them to publish Justice Transactions if someone tries to steal your money during service interruption. There are some small, cross-implemented watchtowers that Eye of Satoshibut they are not widely used.
For more informed news, follow us further Twitter and Google News or listen to our investigative podcast Newly created: Blockchain City.