A team of developers working for TenX, a crypto payment solutions startup, recently demonstrated the first atomic swap between TenX’s PAY token, a non-native asset, and Bitcoin (BTC), a native asset.
TenX’s demonstration came during the TenX Summit, which was held on December 7th, 2018.
What Is A Non-Native Asset?
A non-native asset is a coin or token that is not the base currency for a blockchain network. For instance, ether (ETH) is the native asset on the Ethereum blockchain, while other tokenized assets that are created according to a protocol (defined by Ethereum) are referred to as non-native assets.
By using a proprietary software application called COMIT, a group of developers at TenX’s research lab, CoBloX, showed how the Lightning Network (a second-layer blockchain payments solution) was able to swap 10 PAY for 71,240 satoshis. After successfully exchanging satoshis for PAY tokens, the research and development (R&D) team published a blog post (on December 12th) to document other details regarding the swap.
Multiple Smart Contracts Needed For Swap
As explained in CoBloX’s post, the latest swap was more complex compared to the first-ever ETH to BTC atomic swap, which the R&D team conducted around six months ago. The ether-to-bitcoin swap required only one smart contract, and it was performed using the hashed time lock contract (HTLC). However, the PAY to BTC atomic swap required an additional step.
Because transactions involving the PAY token have to be carried out using their own smart contract (the transfer ownership function), the HTLC for the swap had to be split into two different transactions. The first transaction was used to initiate the atomic swap contract, while the second was used to make a transfer call for the PAY tokens.
An excerpt from CoBlox’s blog explains:
Unfortunately, we couldn’t figure out how to combine these two steps. The ERC-20 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.
Limited Uni-Directional Transfers
At present, the CoBlox development team is only able to conduct the trade by starting with an ERC-20 token. The swap process works by sending the ERC-20 token through Lightning Network Daemon’s (LND) implementation of the LN protocol, and cannot be done any other way.
Commenting on why the atomic swap has its limitations, the R&D team noted:
An atomic swap cannot always be expressed through this model of invoices and payments. In LND, which is what we used for our proof-of-concept (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.