At the December 7, 2018, TenX Summit, a group of developers showcased an industry first: an atomic swap 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 proprietary 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 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.