Submarine Swap is a trustless swap between Bitcoin (L1) and Lighning (L2).
I perceive the method of trustless swap from BTC to LN (aka. Swap In, Loop in, or ahead swap), however I would wish assist with the opposite route.
The BTC->LN case appears to be like like this:
- Actors: Payer, who desires to pay a LN bill utilizing BTC, and Supplier of the swap service
- Given: a LN bill, created by a third get together, which the Payer wished to pay
- Steps:
- Payer initiates a request to the Supplier, with the main points of the bill (quantity, cost hash, timeouts, and so on.) and its personal pubkey
- Supplier units up a ‘vault’ BTC handle, managed by a script, permitting to be spent by somebody who can show that the LN bill has been paid (regular department), or by the Payer after a while (timeout refund department). Supplier communicated the vault handle and the BTC quantity it expects to Payer.
- Payer verifies the script, and performs on-chain BTC cost to the vault handle
- Supplier observes the cost, waits for affirmation, verifies it. Then it proceeds to pay the LN bill (from its LN funds).
- As soon as the bill is paid, Supplier transfers the BTC from the vault to an handle of its management.
- Finish end result: LN bill is paid, Payer has much less BTC, Supplier has much less LN-BTC however extra BTC.
I am on the lookout for an analogous answer for the reverse state of affairs: Payer desires to pay a recipient in BTC (LN), however it desires to pay over LN.
Within the ‘ahead’ case the LN cost preimage can be utilized to show that the LN cost has been accomplished, and it may be used as a spend situation within the vault. What secret can be utilized within the ‘reverse’ case? How can refund be applied?
A lot of the Submarince Swap descriptions point out that reverse route additionally works, however I’ve not discovered an in depth description. Some wallets use reverse swap to have the ability to pay out LN to on-chain BTC.
Some references:
