Developer Creates Atomic On-Chain ETH to Off-Chain BTC Swaps System


Software engineer Jason Wong recently posted a proposal online showing how atomic on-chain ETH to off-chain BTC swaps would be possible.

Wong had previously made headlines for making submarineswaps to support Litecoin. Next, he turned his attention to submarineswaps on Ethereum, which is currently available on testnet.

Wong’s proposal uses the Lightning Network, a second layer micro-payment protocol running on top of bitcoin (BTC) and Litecoin, similar to the Raiden network on Ethereum. Lightning Network swaps take place off-chain – unlike a traditional bitcoin transaction.

Here’s how Wong’s proposal works:

Step 1) User creates an order with a Lightning invoice

Step 2) The user sends the ETH together with the invoice and payment hash to the swap contract (an Ethereum smart contract) to fund the order

Step 3) Upon confirmation of the funding transaction, the swap service provider pays the invoice for you; if the payment is completed, they will fund from the swap contract by submitting payment proof (also known as preimage)

Step 4) If the invoice payment fails, then the swap service provider will not get the payment proof and cannot claim the fund. After a certain period of time (4 hours), the user can send a refund request to the swap contract and get refunded

Because it’s an atomic transaction, the funds are transferred instantly with no need for a middleman; the smart contract is essentially the middleman. Here’s how Wong explains it:

“The atomicity means that if your invoice is not paid you will get your ether back. The guarantee is enforced by the smart contract on Ethereum network. The smart contract take the payment hash(output of SHA-256 hash) from the user, the swap service provider must submit the correct payment proof(input of SHA-256 hash function) in order to claim the fund.”

In any case, Wong’s proposal is more than just a theory: he has a working testnet running here: https://ethswap.hcwong.me/

The swap contract, meanwhile, is deployed on the Rinkeby testnet at https://rinkeby.etherscan.io/address/0x3427f002e69500189b4c6c11dca68b9447f98ad3

You’ll need MetaMask in order to make a swap. Meanwhile, the source code of the smart contract is available on Etherscan, and the source code of the swap service can be found at Wong’s Github page: https://github.com/Jasonhcwong/lnswaps

Get Daily Headlines

Enter Best Email to Get Trending Crypto News & Bitcoin Market Updates

What to Know More?

Join Our Telegram Group to Receive Live Updates on The Latest Blockchain & Crypto News From Your Favorite Projects

Join Our Telegram

Stay Up to Date!

Join us on Twitter to Get The Latest Trading Signals, Blockchain News, and Daily Communication with Crypto Users!

Join Our Twitter

Add comment

E-mail is already registered on the site. Please use the Login form or enter another.

You entered an incorrect username or password

Sorry, you must be logged in to post a comment.
Bitcoin Exchange Guide