skip to Main Content
bitcoin
Bitcoin (BTC) $ 98,578.41 0.43%
ethereum
Ethereum (ETH) $ 3,359.34 0.39%
tether
Tether (USDT) $ 1.00 0.03%
solana
Solana (SOL) $ 256.50 1.10%
bnb
BNB (BNB) $ 663.79 6.08%
xrp
XRP (XRP) $ 1.55 6.33%
dogecoin
Dogecoin (DOGE) $ 0.470116 19.06%
usd-coin
USDC (USDC) $ 1.00 0.01%
cardano
Cardano (ADA) $ 1.09 20.27%
staked-ether
Lido Staked Ether (STETH) $ 3,357.87 0.48%

The Lightning Network’s First ERC-20 to Bitcoin Atomic Swap Has Taken Place

ERC-20 Bitcoin atomic swap

At the December 7, 2018, TenX Summit, a group of developers showcased an industry first: an atomic swap on the Lightning Network between a non-native asset, TenX’s PAY token, and a native asset, bitcoin.

By non-native, the team is referring to an asset/coin that is not the base currency for the network. For Ethereum, for example, the native asset is ether, while any token that is built on the protocol is considered a non-native asset.

CoBloX, a TenX research and development lab, is responsible for the achievement. Demonstrating their work to a tightly packed audience of summit goers, the team used the Lightning Network and their open-source software COMIT to swap 10 PAY for 71,240 satoshis. The team published a blog post on December 12, 2018, to confirm the news and satify what it calls “the gossip factory” of he-said-she-said following the summit.

In the post, the team delves into their process, explaining outright that this swap was not as simple as the first-ever ether and bitcoin atomic swap on the Lightning Network, which they tested nearly six months ago. Whereas this swap’s hashed time lock contract (HTLC) only required a single use smart contract, the PAY to bitcoin swap took an extra step.

Reason being, the PAY token itself is managed with an additional smart contract known as the transfer ownership function. Because of this, the HTLC had to be separated into two transactions: one to deploy the swap contract and another as a transfer call for the PAY tokens.

“Unfortunately, we couldn’t figure out how to combine these two steps. The ERC20 transfer function uses msg.sender for authentication. However, calling transfer from a contract deployment sets msg.sender to the address of the yet-to-be-deployed contract which obviously has no tokens,” the blog post reads.

Having used the Lightning Network Daemon (LND) implementation for the swap, the team continues to explain in the blog post that the swap is a one-way ticket. They could only execute the trade by starting with the ERC-20 token and going through Lightning — not the other way around.

“An atomic swap cannot always be expressed through this model of invoices and payments. In LND, which is what we used for our PoC, receiving a payment requires an invoice which requires knowledge of the secret. As a result, we were only able to do ERC20 to Lightning and not the other way around.”

The technical milestone is the latest in CoBloX’s technical successes. As mentioned previously, the team also completed the world’s first ether and bitcoin swap. The young lab’s GitHub also features a couple of Rust clients for a Bitcoin Core interface and a JsonRPC API plug-in, as well as a tool for testing blockchain applications.

COMIT, the software used in the ERC-20 swap, is also open-source. With a focus on blockchain interoperability, COMIT is meant to act as a bridge between networks to facilitate cross-chain asset swaps. In addition to the work that has been done with Ethereum and its ERC-20 tokens, the team plans to expand its use with additional features and currencies down the road.

An earlier version of this article misrepresented the swap as the first of its kind, failing to specify that it was the first on the Lightning Network. The Komodo platform performed the industry’s first successful ether to bitcoin and ERC-20 to bitcoin atomic swaps earlier in 2018.

This article originally appeared on Bitcoin Magazine.

Loading data ...
Comparison
View chart compare
View table compare
Back To Top