Although still in testing phase, the lightning network can now be used to send transactions across different blockchains. The Lightning Labs development team successfully swapped testnet bitcoin for testnet litecoin through a lightning channel this week: ownership of the coins changed hands, while no transaction was recorded on either blockchain.
“Previous atomic swaps that I have done were on-chain, and had the on-chain limitations of slow [transactions] and high transaction fees,” Litecoin creator Charlie Lee told Bitcoin Magazine, referring to an older trick to exchange different types of coins trustlessly. “Off-chain atomic swaps are significantly better. They are instant, [have] low fees, and better protect one’s privacy.”
The successful test paves the way for trustless cryptocurrency exchanges, near-seamless multi-coin payment processors and more.
Bitcoin and Litecoin
The lightning network is the highly anticipated second-layer payment network to be deployed on top of Bitcoin. And as an open protocol, it’s relatively easy to deploy lightning network support for other cryptocurrencies that are forked from Bitcoin’s codebase — like Litecoin.
Interestingly, if the lightning network runs on different blockchains, these chains can effectively be linked together. If one or several peers on the network are willing to take one type of coin and forward another, it’s possible to send bitcoins on one end of a channel that will end up as the equivalent in litecoin on the other end.
In a Medium post published in the first week of 2017, Lee explained that this potential to create these kinds of “bridges” between cryptocurrencies made him throw his weight behind the Segregated Witness (SegWit) soft forks on both Litecoin and Bitcoin.
When SegWit activated on Litecoin last spring, Lee’s vision came one step closer to reality. Because the soft fork had not yet activated on Bitcoin at that time, Lightning Labs decided to add Litecoin support to their LND lightning network implementation. Thus, by the time SegWit activated on Bitcoin last summer, LND was already compatible with both chains.
The testnet versions of these two blockchains are now made interoperable through the lightning network for the first time, allowing users to swap one type of coin for the other.
“The primary advantages over previous solutions are speed, cost and privacy,” Lightning Labs developer Conner Fromknecht told Bitcoin Magazine. “Transfers are more or less instant, and don’t require the cost of an on-chain transaction. Additionally, in the cooperative case, the transactions are never broadcast, and leave no trace on the blockchain, offering privacy benefits. And with any luck, these privacy benefits will only continue to improve.”
The Test (and the Potential)
This week’s specific test was done on a local machine, on which Fromknecht himself created two nodes: “Alice” and “Bob.” These two nodes were modified to be able to monitor both the Bitcoin and Litecoin testnets. Fromknecht then created a single lightning channel that sent testnet litecoin from Alice to Bob and testnet bitcoin back from Bob to Alice at a fixed exchange rate. While still all in an experimental setting, the test was successful; Lightning Labs today published a blog post and a video detailing the results.
In addition to offering a faster, cheaper and more private solution to exchanging coins, the successful test paves the way toward a whole new range of possibilities in the context of the lightning network. For example, peers on the network could eventually act as cryptocurrency exchanges, competing with one another to offer the best exchange rates.
“Arguably the most important benefit of Lightning swaps is the ability to efficiently exchange different currencies without a custodian,” Fromknecht said. “Our ecosystem heavily depends on exchanges to fulfill this role today, but Lightning swaps offer users a choice to get the best of both worlds — instant exchanges without relinquishing control of your money.”
Similarly, such exchangers could act as payment processors: it would be much easier for users to spend litecoin at merchants that only accept bitcoin (or vice versa). And it’s even conceivable that bitcoin-to-bitcoin payments over the lightning network will route via Litecoin hubs, if that’s the cheapest way to get funds from A to B.
For Lee, at least, this is not as unlikely as it sounds, and the successful tests mark another step toward his vision for the lightning network on Litecoin and Bitcoin.
“The Litecoin team is excited to work with Lightning Labs to explore the true potential of instant cross-chain atomic swaps,” he concluded.
For a more in-depth technical explanation of these kinds of atomic swaps, see our previous article “Atomic Scaps: How the Lightning Network Extends to Altcoins” or the blog post and video published by Lightning Labs today.