Submarine Swaps

From lightningwiki.net
Jump to navigation Jump to search

Submarine Swaps allow you to trade on-chain tokens for Lightning invoice payments.

In essence, Alice sends Bob an LN payment secured by a secret she knows, preventing Bob from claiming it. Bob then creates an onchain payment that Alice can spend by revealing the secret. Alice waits for the payment to receive a suitable number of confirmations and then spends it onchain to any address she chooses—revealing the secret in the process. Bob sees Alice's onchain transaction and uses its revealed secret to claim the LN payment Alice sent him earlier. If Alice doesn't reveal the secret, the onchain payment contains a refund condition that allows Bob to spend it back to himself after a timelock expires. [1]

Most of the process is trustless, so neither party has an opportunity to steal from the other (provided the software operates (and is operated) correctly). The exception is the creation of the initial onchain transaction and the possible need for Bob to create a refund transaction: if the trustless exchange doesn't happen, Bob will receive no compensation for the onchain transaction fees required for both of those transactions. According to the Loop documentation, their implementation has Alice send Bob a small trusted payment via LN in advance of the trustless exchange as an act of good faith and an assurance that the operation won't end up costing Bob money. [2]

Services