One secret, two locks
Every swap except pay-through and atomic RGB swaps works the same way. One side generates a random secret, the preimage, and shares only its hash. Both legs of the swap are locked to that hash:- the Lightning payment, as a hold invoice that settles only when someone reveals the preimage, and
- the on-chain funds, in a lockup output that can be spent in two ways: with the preimage (the claim), or by the original sender after a deadline (the refund).
Who does what on each route
The technical names in parentheses (submarine, reverse, chain) come from the Boltz protocol the SDK speaks. The SDK methods use them:
createSubmarineSwap, createReverseSwap, createChainSwap.