From joemphilips at gmail.com Wed Oct 12 10:39:56 2022 From: joemphilips at gmail.com (Joe Miyamoto Philips) Date: Wed, 12 Oct 2022 19:39:56 +0900 Subject: [Lightning-dev] Forwardable Peerswaps: Improving Network Health Via Pressure Release Valve In-Reply-To: References: <37V1o81JznM66DmRBgIp8Z1fQf5se2WoDScuKghkEmyfQ5-oKWpEdBkJMEEqPOHX3dx82eIXVl-6PaJ1vydrTGBDYWlnj4YyzbrMXNgVKe4=@protonmail.com> Message-ID: > The offchain-to-onchain swap protocol is intended to be used by end- users to pay onchain when all their funds are in a Lightning channel. > Thus, there is the possibility that the end-user has no onchain funds to payjoin into the onchain HTLC, only Lightning funds, and the only way > to get it out is to swap it out to onchain, hence, catch-22. I don't think that the fact the initiator must have a small on-chain funds before swap-out is not a showstopper, but my point is to make a first swap tx and pre-payment contingent. So it does not really have to be a payjoin, in fact, you can do it with off-chain prepayment like this. It's simple, assuming PTLC.... 1. Alice asks Bob for offchain-to-onchain swap, 2. Bob forwards it to Carol 3. Carol agrees, and sends Alice the following items * tweak T (:= t * G) * Transaction for onchain PTLC for the swap. * Adaptor signature for the tx tweaked by T 4. Alice validates, and creates a PTLC multi-hop payment for a small amount to Carol, this is a prepayment for the swap. And Carol must reveal `t` to get paid. 5. After Carol receives payment, Alice un-tweak the Adaptor sig and broadcast the onchain PTLC. 6. swap goes on... Carol can disturb the protocol by invaliding the PTLC tx by using one of its inputs. But there is not much point in doing so because prepayment is only for a fee for a single tx in the first place. There are many things we must consider here (e.g. Alice can learn Carol's UTXO with no cost, etc...), but overall I think it works fine. Best, Joe