After making submarineswaps to support Litecoin, I started to make Ethereum to work with submarineswaps. It is available on testnet now !

For Ethereum users who have never heard of lightning network: The lightning network is a second layer micro-payment protocol running on top of Bitcoin and Litecoin, similar to Raiden network of Ethereum. For more information of lightning network: http://lightning.network.

The swap works the following:

User create an order with a lightning invoice User send the ether together with the invoice and payment hash to the swap contract(a Ethereum smart contract) to fund the order Upon confirmation of the funding transaction, swap service provider pay the invoice for you, if the payment is completed, they will claim the fund from the swap contract by submit payment proof(aka. preimage). If invoice payment failed, swap service provider will not get the payment proof and cannot claim the fund. After a specific period of time(4 hours), the user can send refund request to the swap contract and get refunded.

How the swap works

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.

The swap service is currently running on https://ethswap.hcwong.me/ and swap contract is deployed on Rinkeby testnet at https://rinkeby.etherscan.io/address/0x3427f002e69500189b4c6c11dca68b9447f98ad3.

Metamask is required to make a swap.

Source code of the smart contract is available on Etherscan.

Source code of the swap service: https://github.com/Jasonhcwong/lnswaps

Tutorial: How to make a swap

Tutorial: How to refund