<p>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.". </p>

<p>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. </p>

<p>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.</p>

CC BY-SA 4.0
2019-07-17T10:12:20.460Z
thanks for idea. american option is not problem, it can be resolved with dex access fees
user5613003
CC BY-SA 4.0
2019-07-17T08:12:11.307Z
2019-07-17T08:12:11.307Z
stefanwouldgo
<p>Do you know the way to freeze funds in lightning tx to implement atomic swap between two independent lightning networks?</p>

CC BY-SA 4.0
2019-07-15T17:36:50.057Z
Can you provide more clarity as to what exactly you are looking for?
Ugam Kamat
CC BY-SA 4.0
2019-07-15T18:07:27.247Z
lightning networks from different blockchains*. i mean non custody atomic swaps from one network to another, based on htlc
user5613003
<lightning-network><atomic-swap><hash-time-locked-contract>
lightning to lightning non custodial swaps
user5613003
# lightning to lightning non custodial swaps

(Asked by: username_0 on 2019-07-15)

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

**Tags:** lightning-network, atomic-swap, hash-time-locked-contract

> **Comments:**
> **username_1**: Can you provide more clarity as to what exactly you are looking for?  
> **username_0**: lightning networks from different blockchains*. i mean non custody atomic swaps from one network to another, based on htlc  

---

## 1 answers

### Answer by username_2 on 2019-07-17. Score: 1

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.

> **Comments:**
> **username_0**: thanks for idea. american option is not problem, it can be resolved with dex access fees  

---

