<p>You can "loop out" using <a href="https://github.com/lightninglabs/loop" rel="nofollow noreferrer">loop</a> by lightning labs. It allows you to convert offchain funds into onchain funds by doing a reverse submarine swap. You can check the fees beforehand and specify which channel you want to drain.</p>

CC BY-SA 4.0
2019-03-27T14:18:11.270Z
2019-03-27T14:18:11.270Z
pseudozach
<p>This will get easier in the future as exchanges will be implementing deposits and withdrawals via LN.</p>

<p>At this time, if you need to deposit BTC and the exchange does not support LN deposits, I'm afraid you are stuck with closing channels for now.</p>

<p>Perhaps there will be a way soon to rebalance the channels to minimize the number of closures required.  Basically, push back funds on channels from customers 1-4, to pull the funds onto the customer 5 channel, and close only the one customer 5 channel.</p>

CC BY-SA 4.0
2019-02-14T19:28:09.473Z
2019-02-14T19:28:09.473Z
Zelgada
<p>Closing channels alone is not an adequate solution to rebalancing because all it does is shift the problem around.</p>

<p>Consider the following scenario: You have a node <code>A</code>, which is a store-front, and a personal node <code>B</code>, which is private. You have private channels <code>i</code> and <code>j</code> between the two nodes. There are some channels you have open on your store front, <code>1</code>, <code>2</code>, and <code>3</code>, each of which has channels open with <code>x</code>, <code>y</code>, <code>z</code> respectively. Also, your personal node has channels open with <code>w</code> and <code>v</code>.</p>

<p>I'll use <code>=</code> to indicate the outbound capacity your merchant node has, and <code>-</code> to indicate the inbound capacity.</p>

<pre><code>(x)----|====(1)----|====     ====|----     ====|----(w)
                        \   /    i    \   /
(y)----|====(2)----|==== (A)           (B) ====|----(v)
                        /   \    j    /
(z)----|====(3)----|====     ====|----
</code></pre>

<p>Assuming all channels have a capacity of 8ksat above, and are all evenly balanced, lets see what happens if <code>z</code> makes a payment of 4ksat.</p>

<pre><code>(x)----|====(1)----|====     ====|----     ====|----(w)
                        \   /    i    \   /
(y)----|====(2)----|==== (A)           (B) ====|----(v)
                        /   \    j    / 
(z)|========(3)|========     ====|----                     
</code></pre>

<p>The inbound capacities of the channels between <code>z</code>, <code>3</code> and your merchant node <code>A</code> are now exhausted and you will not be able to receive payments through it. To rebalance this, you need to make a payment through <code>3</code> and <code>z</code>, to be received via <code>w</code> or <code>v</code>. Lets say we split this into two payments via both <code>w</code> and <code>v</code>.</p>

<pre><code>2ksat: A -&gt; 3 -&gt; z -&gt; ... -&gt; w -&gt; B(i)-&gt; A
2ksat: A -&gt; 3 -&gt; z -&gt; ... -&gt; v -&gt; B(i)-&gt; A

(x)----|====(1)----|====     ========|     ======|--(w)
                        \   /    i    \   /
(y)----|====(2)----|==== (A)           (B) ======|--(v)
                        /   \    j    /
(z)----|====(3)----|====     ====|----                     
</code></pre>

<p>Channel <code>i</code> is now exhausted, so we can close it to cash out on chain. However, we need something to replace it. We need a new channel <code>k</code>, with the same capacity of 8ksat.</p>

<pre><code>(x)----|====(1)----|====     |--------     ======|--(w)
                        \   /    k    \   /
(y)----|====(2)----|==== (A)           (B) ======|--(v)
                        /   \    j    /
(z)----|====(3)----|====     ====|----                             
</code></pre>

<p>Notice that <strong>We've not actually gained anything "on-chain"</strong>, because we've had to reuse those funds to establish the replacement channel, although we still own the money, it is tied up in the channel.</p>

<p>Assume that now <code>x</code> makes a payment of 4ksat, and we repeat the process above, but using <code>j</code> instead of <code>i</code> as the channel we're going to cash out with.</p>

<pre><code>(x)|========(1)|========     |--------     ======|--(w)
                        \   /    k    \   /
(y)----|====(2)----|==== (A)           (B) ======|--(v)
                        /   \    j    / 
(z)----|====(3)----|====     ====|----                     

2ksat: A -&gt; 1 -&gt; x -&gt; ... -&gt; w -&gt; B(j)-&gt; A
2ksat: A -&gt; 1 -&gt; x -&gt; ... -&gt; v -&gt; B(j)-&gt; A

(x)----|====(1)----|====     |--------     ========|(w)
                        \   /    k    \   /
(y)----|====(2)----|==== (A)           (B) ========|(v)
                        /   \    j    /
(z)----|====(3)----|====     ========|                     
</code></pre>

<p>We can cash out <code>j</code> and create <code>l</code> in its place, but we have the issue that the channels <code>B</code> had with <code>w</code> and <code>v</code> are now completely exhausted of incoming capacity. We won't be able to rebalance anything else if <code>y</code> makes the same payment.</p>

<pre><code>(x)----|====(1)----|====     |--------     ========|(w)
                        \   /    k    \   /
(y)|========(2)|======== (A)           (B) ========|(v)
                        /   \    l    /
(z)----|====(3)----|====     |--------                    
</code></pre>

<p>So <em>unless <code>B</code> is actively spending</em> <strong>on the lightning network</strong>, through <code>w</code> and <code>v</code>, those channels are not going to be reusable for rebalancing. It isn't possible to spend from <code>B</code> back to <code>A</code> via these channels, as that would exhaust the inbound capacities of its other channels it has open to customers.</p>

<p>In practice, you will probably have more channels open, and each node will be routing payments for other people, so you may have some other rebalancing going on. You might discover that certain paths are used more frequently one direction than another, which would make it ideal for use as a rebalancing path.</p>

<p>However, the end goal is eventually to not need to cash out - but to make your purchases directly on the network. Likewise, you should be able to get paid over the network, and rebalancing will become less of an issue as the number of channels increases, and liquidity increases.</p>

<p>There are a number of services which can be used to "refill" channels, in return for direct on-chain payments. I guess there is a market for the opposite of such service too - to offload payment channels in return for the on-chain payment. There have been some proposals for liquidity markets to be developed directly on the Lightning Network layer so that some of this can be automated in future.</p>

<p>Perhaps the correct thing to do, is not to attempt to rebalance unless absolutely necessary for yourself though. In the above scenario, when <code>z</code> first paid, instead of trying to rebalance the channel <code>A</code> has open with <code>3</code>, you could just close this channel and cash out. If <code>z</code> wants to make another payment to you, they must either do it through <code>1</code> or <code>2</code>, or some other channel which might be created with incoming capacity in your direction. The problem then is not your's, but <code>z</code>'s. If you are a useful routing node, then people will probably want to open more channels with you with inbound capacity to you also.</p>

<p><code>1</code>, <code>2</code>, and <code>3</code> are not necessarily your customers. Your customers are <code>x</code>, <code>y</code> and <code>z</code>, and the direct channels you have open just facilitate those payments.</p>

CC BY-SA 4.0
2019-02-15T00:24:20.267Z
2019-02-15T01:18:32.450Z
2019-02-15T01:18:32.450Z
Mark H
<p>You can use a lightning-enabled exchange to "exchange" your BTC locked in lightning channels to on-chain BTC. Afterwards you can use any usual exchange to sell your on-chain BTC for a preferred fiat currency.</p>

<p>A couple of lightning-enabled exchanges from <a href="https://medium.com/lightningto-me/60224aa13393" rel="nofollow noreferrer">this post</a> are zigzag.io, sideshift.ai, southxchange.com, btcduke.com and coinplaza.it.</p>

<p>However please do your own research before using these: the services are all new and require your trust for the time they hold your funds. Also beware that the fees can be relatively high.</p>

CC BY-SA 4.0
2019-02-15T14:41:05.250Z
2019-02-15T14:41:05.250Z
Dmitry Laptev
<p>I am working on an ecommerce site that accepts lightning payments and was curious about how to "cash out" to pay vendors without closing channels to customers. I was planning to run two LN LND nodes and have two channels between them. One node for personal use highly connected and one running on BTCPay Server. Since not all my vendors accept bitcoin, I was working through the best way to be able to "cash out" my bitcoin to fiat (by closing one of my channels between my personal node and my BTCPay Server business node) to pay my vendors while still having an open channel to the world through which individuals who did not have an open channel with me could route payment. Rather than having my store (BTCPay Server business node) close channels to customers to "cash out" to pay vendors, I thought I would send LN payments from my store node to my personal node and close one of the two channels between my store node and my personal node. My thoughts may be convoluted and unnecessary and I would welcome any suggestions.</p>

<lightning-network><payment><ecommerce><cash><ln-closing-channels>
How to "cash out" of the Lightning Network without closing channels?
Frank Lybord
# How to "cash out" of the Lightning Network without closing channels?

(Asked by: username_0 on 2019-02-14)

I am working on an ecommerce site that accepts lightning payments and was curious about how to "cash out" to pay vendors without closing channels to customers. I was planning to run two LN LND nodes and have two channels between them. One node for personal use highly connected and one running on BTCPay Server. Since not all my vendors accept bitcoin, I was working through the best way to be able to "cash out" my bitcoin to fiat (by closing one of my channels between my personal node and my BTCPay Server business node) to pay my vendors while still having an open channel to the world through which individuals who did not have an open channel with me could route payment. Rather than having my store (BTCPay Server business node) close channels to customers to "cash out" to pay vendors, I thought I would send LN payments from my store node to my personal node and close one of the two channels between my store node and my personal node. My thoughts may be convoluted and unnecessary and I would welcome any suggestions.

**Tags:** lightning-network, payment, ecommerce, cash, ln-closing-channels


---

## 4 answers

### Answer by username_1 on 2019-03-27. Score: 1

You can "loop out" using [loop](https://github.com/lightninglabs/loop) by lightning labs. It allows you to convert offchain funds into onchain funds by doing a reverse submarine swap. You can check the fees beforehand and specify which channel you want to drain.


---

### Answer by username_2 on 2019-02-14. Score: 1

This will get easier in the future as exchanges will be implementing deposits and withdrawals via LN.

At this time, if you need to deposit BTC and the exchange does not support LN deposits, I'm afraid you are stuck with closing channels for now.

Perhaps there will be a way soon to rebalance the channels to minimize the number of closures required. Basically, push back funds on channels from customers 1-4, to pull the funds onto the customer 5 channel, and close only the one customer 5 channel.


---

### Answer by username_3 on 2019-02-15. Score: 0

Closing channels alone is not an adequate solution to rebalancing because all it does is shift the problem around.

Consider the following scenario: You have a node `A`, which is a store-front, and a personal node `B`, which is private. You have private channels `i` and `j` between the two nodes. There are some channels you have open on your store front, `1`, `2`, and `3`, each of which has channels open with `x`, `y`, `z` respectively. Also, your personal node has channels open with `w` and `v`.

I'll use `=` to indicate the outbound capacity your merchant node has, and `-` to indicate the inbound capacity.

```
(x)----|====(1)----|====     ====|----     ====|----(w)
                        \   /    i    \   /
(y)----|====(2)----|==== (A)           (B) ====|----(v)
                        /   \    j    /
(z)----|====(3)----|====     ====|----

```

Assuming all channels have a capacity of 8ksat above, and are all evenly balanced, lets see what happens if `z` makes a payment of 4ksat.

```
(x)----|====(1)----|====     ====|----     ====|----(w)
                        \   /    i    \   /
(y)----|====(2)----|==== (A)           (B) ====|----(v)
                        /   \    j    / 
(z)|========(3)|========     ====|----                     

```

The inbound capacities of the channels between `z`, `3` and your merchant node `A` are now exhausted and you will not be able to receive payments through it. To rebalance this, you need to make a payment through `3` and `z`, to be received via `w` or `v`. Lets say we split this into two payments via both `w` and `v`.

```
2ksat: A -> 3 -> z -> ... -> w -> B(i)-> A
2ksat: A -> 3 -> z -> ... -> v -> B(i)-> A

(x)----|====(1)----|====     ========|     ======|--(w)
                        \   /    i    \   /
(y)----|====(2)----|==== (A)           (B) ======|--(v)
                        /   \    j    /
(z)----|====(3)----|====     ====|----                     

```

Channel `i` is now exhausted, so we can close it to cash out on chain. However, we need something to replace it. We need a new channel `k`, with the same capacity of 8ksat.

```
(x)----|====(1)----|====     |--------     ======|--(w)
                        \   /    k    \   /
(y)----|====(2)----|==== (A)           (B) ======|--(v)
                        /   \    j    /
(z)----|====(3)----|====     ====|----                             

```

Notice that **We've not actually gained anything "on-chain"**, because we've had to reuse those funds to establish the replacement channel, although we still own the money, it is tied up in the channel.

Assume that now `x` makes a payment of 4ksat, and we repeat the process above, but using `j` instead of `i` as the channel we're going to cash out with.

```
(x)|========(1)|========     |--------     ======|--(w)
                        \   /    k    \   /
(y)----|====(2)----|==== (A)           (B) ======|--(v)
                        /   \    j    / 
(z)----|====(3)----|====     ====|----                     

2ksat: A -> 1 -> x -> ... -> w -> B(j)-> A
2ksat: A -> 1 -> x -> ... -> v -> B(j)-> A

(x)----|====(1)----|====     |--------     ========|(w)
                        \   /    k    \   /
(y)----|====(2)----|==== (A)           (B) ========|(v)
                        /   \    j    /
(z)----|====(3)----|====     ========|                     

```

We can cash out `j` and create `l` in its place, but we have the issue that the channels `B` had with `w` and `v` are now completely exhausted of incoming capacity. We won't be able to rebalance anything else if `y` makes the same payment.

```
(x)----|====(1)----|====     |--------     ========|(w)
                        \   /    k    \   /
(y)|========(2)|======== (A)           (B) ========|(v)
                        /   \    l    /
(z)----|====(3)----|====     |--------                    

```

So *unless `B` is actively spending* **on the lightning network**, through `w` and `v`, those channels are not going to be reusable for rebalancing. It isn't possible to spend from `B` back to `A` via these channels, as that would exhaust the inbound capacities of its other channels it has open to customers.

In practice, you will probably have more channels open, and each node will be routing payments for other people, so you may have some other rebalancing going on. You might discover that certain paths are used more frequently one direction than another, which would make it ideal for use as a rebalancing path.

However, the end goal is eventually to not need to cash out - but to make your purchases directly on the network. Likewise, you should be able to get paid over the network, and rebalancing will become less of an issue as the number of channels increases, and liquidity increases.

There are a number of services which can be used to "refill" channels, in return for direct on-chain payments. I guess there is a market for the opposite of such service too - to offload payment channels in return for the on-chain payment. There have been some proposals for liquidity markets to be developed directly on the Lightning Network layer so that some of this can be automated in future.

Perhaps the correct thing to do, is not to attempt to rebalance unless absolutely necessary for yourself though. In the above scenario, when `z` first paid, instead of trying to rebalance the channel `A` has open with `3`, you could just close this channel and cash out. If `z` wants to make another payment to you, they must either do it through `1` or `2`, or some other channel which might be created with incoming capacity in your direction. The problem then is not your's, but `z`'s. If you are a useful routing node, then people will probably want to open more channels with you with inbound capacity to you also.

`1`, `2`, and `3` are not necessarily your customers. Your customers are `x`, `y` and `z`, and the direct channels you have open just facilitate those payments.


---

### Answer by username_4 on 2019-02-15. Score: 0

You can use a lightning-enabled exchange to "exchange" your BTC locked in lightning channels to on-chain BTC. Afterwards you can use any usual exchange to sell your on-chain BTC for a preferred fiat currency.

A couple of lightning-enabled exchanges from [this post](https://medium.com/lightningto-me/60224aa13393) are zigzag.io, sideshift.ai, southxchange.com, btcduke.com and coinplaza.it.

However please do your own research before using these: the services are all new and require your trust for the time they hold your funds. Also beware that the fees can be relatively high.


---

