Do you know the way to freeze funds in lightning tx to implement atomic swap between two independent lightning networks?

  • Can you provide more clarity as to what exactly you are looking for? – Ugam Kamat Jul 15 at 17:36
  • lightning networks from different blockchains*. i mean non custody atomic swaps from one network to another, based on htlc – user5613003 Jul 15 at 18:07

An HTLC always "freezes" funds. It is a smart contract that says "here is the balance and a hash. If you give me the preimage of that hash within time T, the balance is yours. Otherwise I can take it back.".

You can then use this functionality to achieve an atomic swap by going through a service node that is active in both networks and offers to swap currencies. Just route a payment from yourself to yourself via the swap service node, starting with currency X and ending with currency Y, switching currencies at the service node using the offered exchange rate.

Like every LN payment, this is trustless because it is atomic: Either all transfers take place or none. However, note that there is a free american option given to the service node here: For the time T, it can stall and observe the spot market and only do the trade if the exchange rate moves favorably for him, or otherwise just let it time out. This is why using LN for currency exchange might not be economically wise.

  • thanks for idea. american option is not problem, it can be resolved with dex access fees – user5613003 Jul 17 at 10:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.