How it works
Your app creates a secret and pays a hold invoice locked to it. The maker then locks the funds on chain to the same secret. Your app claims them, which reveals the secret and lets the maker settle your payment. Until your app claims, the Lightning payment is held, not settled. If the maker never locks, the payment is released back.Setup
The code on this page assumes this setup. It connects to the signet maker and loads your swap mnemonic. See Installation and Keys and recovery if you have neither yet.Receive funds
1
Create the swap
2
Pay the invoice
Pay
swap.invoice from any Lightning wallet. Check your payout address first: the claim is the first step that would reject a wrong-network address, and by then the invoice is paid.3
Wait for the maker's lockup
The swap reaches
transaction.mempool, then transaction.confirmed.4
Claim
invoice.settled.Python
Python
If something goes wrong
- The maker never locks, or its lockup fails (
transaction.failed,transaction.refunded): your Lightning payment is released automatically. Nothing to do. - Your app was offline: claim as soon as it comes back. A claim must confirm before the swap’s
timeoutBlockHeight.claimReverseSwapchecks the remaining margin and your chain evidence before revealing the secret; see Claims and refunds. - The broadcast response was lost: rebroadcast the saved transaction. Never sign a second claim.