
While the Lightning Network is mostly known as a way to make Bitcoin payments instant and practically free, another often-touted aspect of the layer-two protocol has been its ability to enable a sort of decentralized exchange as a side effect of its original goals. However, the viability of this functionality has come under fire recently as developers have uncovered a potential exploit of this system.[1]
Lightning Network will be the ultimate decentralized exchange. Users that are running LN on both BTC and LTC can advertise an exchange price and act as a maker earning a spread. Other users can act as a taker and atomically swap LTC/BTC with the maker node via lightning. ⚡🚀🌕
— Charlie Lee [LTC⚡] (@SatoshiLite) July 11, 2018[2]
How the Lightning Network Functions as a Decentralized Exchange
Although the Lightning Network is usually associated with Bitcoin, the payments-focused layer can be built on top of any other blockchain that has the proper underlying features. For example, Lightning transactions have been successfully tested on the Litecoin and Vertcoin networks.
When Lightning Network functionality is available on more than one blockchain, it becomes possible to instantly swap the native tokens of those blockchains in a decentralized, low-trust manner. This works by routing payments through Lightning Network users who are operating on multiple blockchains. If Alice wants to send some litecoin to Bob but she only has bitcoin available, she can route through a third party who is holding both bitcoin and litecoin on the Lightning Network.
The Issue with This Setup
While this decentralized exchange sounds amazing in theory, multiple developers have poked holes in the logic behind the feature.
As pointed out in the most recent issue of Bitcoin Optech Newsletter, Lightning Network developer Corné Plooy created a thread