What is Nostr?
Joe Miyamoto Philips [ARCHIVE] /
npub1rxe…dmna
2023-06-09 13:07:05
in reply to nevent1q…0v62

Joe Miyamoto Philips [ARCHIVE] on Nostr: 📅 Original date posted:2022-10-12 📝 Original message: > The offchain-to-onchain ...

📅 Original date posted:2022-10-12
📝 Original message:
> 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
Author Public Key
npub1rxe6xx0tvp69u4ah8q7rl2v8yryawr9wv4zc2z2p59jupsdnnffslrdmna