Author: Joe Miyamoto Philips 2022-10-12 10:39:56
Published on: 2022-10-12T10:39:56+00:00
The offchain-to-onchain swap protocol is designed for end-users to pay onchain when their funds are in a Lightning channel. However, there is a catch-22 situation where the end-user may have no onchain funds to payjoin into the onchain HTLC, only Lightning funds. To solve this issue, the initiator must have a small on-chain prepayment contingent before the first swap transaction. To implement this, Alice can request Bob for an offchain-to-onchain swap, which Bob forwards to Carol. After agreeing to the swap, Carol sends Alice the tweak T, transaction for onchain PTLC for the swap, and adaptor signature for the tx tweaked by T. Alice validates and creates a PTLC multi-hop payment for a small amount to Carol as prepayment for the swap. Upon receiving payment, Carol must reveal 't' to get paid. After untweaking the adaptor signature, Alice broadcasts the onchain PTLC, and the swap goes on.While there are potential issues such as Alice learning Carol's UTXO with no cost, overall, the system appears to work well. The prepayment is only for a fee for a single tx in the first place, so there is not much point in invalidating the PTLC tx by using one of its inputs.
Updated on: 2023-06-03T10:15:59.948029+00:00