- seller generates secret A
- seller asks hodlhodl to generate a hold invoice with payment hash = hash(A), notice that hodlhodl doesn’t have the preimage A
- seller sends a lightning payment to settle the invoice
- once hodlhodl receives the payment, it remains on hold since it doesn’t have the preimage A to settle it
- hodlhodl lets the seller know it received the payment, so that it can proceed
- the seller gives the preimage A to the buyer
- the buyer sends hash(A) to hodlhodl, and hodlhodl confirms whether the hash matches, so that the seller cannot trick the buyer
- the buyer creates an invoice with payment hash = hash(A), and sends it to hodlhodl, which will store it for later use
- the buyer sends the fiat payment to the seller
- once the seller confirms that it received the fiat payment, hodlhodl will make a lightning payment to fulfill the invoice from the buyer
- once the payment is settled, hodlhodl will receive in exchange the payment preimage A, which it can use to finally un-hold the first payment from the seller
- The CLTVs of the first payment should be higher than the second payment’s, so that hodlhodl doesn’t have any risk of losing funds
- The CLTV of the first payment should be high enough to have time to resolve disputes. Maybe a couple of days?
- Hodlhodl will need to use it’s own funds to make the second payment. Although it cannot loose money, there’s a financial cost associated in being an intermediate node is lightning payments
- Hodlhodl can’t take or freeze the money at any point, it can only hold it until the first payment expires
- After making a payment, and giving the preimage to the buyer, if the seller doesn’t collaborate, hodlhodl can confirm that the fiat payment was made, and conclude the transaction with the buyer
- If the buyer doesn’t collaborate after the seller made the first payment, hodlhodl can fail the payment on hold, and the seller will get all its money back
- If hodlhodl doesn’t collaborate after the first payment was done, but before the fiat payment was made, the lightning payment will eventually expire, and the seller will get its money back
- If hodlhodl doesn’t collaborate after the fiat payment was done, the lightning payment will eventually expire, and the seller will get both the fiat and the bitcoins. Not sure how big a problem this is 🤔