Do I need to rebalance channels?
In looking at active channels, we reviewed inbound and outbound liquidity for the one channel we opened on our new node.
![Does this channel need rebalancing?](/img/lndg-inbound-and-outbound-liquidity.webp)
Let's review our liquidity situation with this channel.
- We can send an outbound payment of up to 4,994,446 Satoshis.
- We can receive an inbound payment of up to 1,521 Satoshis.
This channel is currently useless for inbound payments.
This is an "unbalanced" channel.
Should we therefore "rebalance" this channel?
It depends on our needs.
What kind of liquidity do I need?
We can only answer this question with our node purpose in mind.
If your node purpose is "mostly send"
You only need outbound liquidity.
As you send payments, more balance will accrue on the "inbound" side, so you will gradually and naturally accumulate inbound liquidity, also.
If your node purpose is "Mostly receive"
You need inbound liquidity.
If your node purpose is "Routing node"
You will need both inbound and outbound liquidity.
How to get outbound liquidity
To get outbound liquidity, just open a channel.
When you've used up all the outbound liquidity on a channel, just open another channel.
Resist the temptation to do complicated "rebalancing". Just wait until fees are low and open a new channel.
How to get inbound liquidity
Getting inbound liquidity -- so you can receive payments -- is not as straightforward.
When you are still new to this, I recommend that you consider these four simple ways to get inbound liquidity:
- If you are expecting significant inbound payment flow, you likely qualify for a free inbound channel from the Megalith Node. Go to this link to learn more.
- Use the "send to external wallet" strategy, detailed below.
- Participate in a liquidity swap. But note -- if you swap with a node which itself does not have great inbound liquidity, that won't help you very much.
- Buy an inbound channel. To do this, you'll send a lightning payment to a node that is selling channels, and they will open a channel to your node. Any of the sellers who are highly ranked on the Amboss Magma Marketplace should work.
Getting inbound liquidity: The "send to external wallet" strategy
This simple strategy I believe is the simplest and (usually) cheapest way to convert an outbound-only channel to a channel with both outbound and inbound liquidity.
The process is very similar to what we followed to make a test payment. The only difference is that you'll be sending an external wallet that you control, instead of an external wallet controlled by somebody else.
Let's try it now.
- We start with a newly opened channel. It's best if this channel is with a big, well-established routing node like The Megalith Node.
![Our channel, before trying the "Send To External Wallet" strategy](/img/lndg-inbound-and-outbound-liquidity.webp)
-
Determine how much inbound liquidity you want. In this case, I am going to try to equally balance this channel, so I can end up with about 2,500,000 inbound and 2,500,000 outbound. So this means I need to send a 2,500,000 outbound payment through this channel.
-
Identify a mobile or website-based wallet that you control. The wallet must support both on-chain and Lightning payments. In this case, I am going to use a hosted wallet with Kraken.
-
Make a deposit request and copy the invoice string.
![Kraken deposit form](/img/kraken-deposit.webp)
![Copy Kraken deposit invoice string](/img/kraken-copy-deposit-request.webp)
In this case, I copied this string:
lnbc25m1pnp9kcapp5rphdzs6dmle9n2nntafazgwga5xmxzmwpw0y6v5cvyv7cffsaw4qdqhfdexz6m9dcsygetsdaekjaqcqzysxqrrsssp5msu40zkpw3f5zu4wz8e8wfkxcjgzryenj60ryl8dlx3ys29wx5ks9qyyssqkvr0gsld9lr8rtfhx3fhza7uza2f6v7axg5ep8cunu0qzjkg25p3cvajkqxlpkvxpxlj22dpw023v8e97xzpevqtek7edtnsf20rjscpjcl64z
- Pay the invoice with lncli
$ lncli payinvoice --pay_req [paste deposit string here]
Payment hash: 186ed1434ddff259aa735f53d121c8ed0db30b6e0b9e4d32986119ec2530ebaa
Description: Kraken Deposit
Amount (in satoshis): 2500000
Fee limit (in satoshis): 125000
Destination: 02f1a8c87607f415c8f22c00593002775941dea48869ce23096af27b0cfdcc0b69
Confirm payment (yes/no):
Payment was successful.
--+--------------------+----------------------------+
| HTLC_STATE | ATTEMPT_TIME | RESOLVE_TIME | RECEIVER_AMT | FEE | TIMELOCK | CHAN_OUT | ROUTE |
+------------+--------------+--------------+--------------+--------+----------+--------------------+----------------------------+
| SUCCEEDED | 0.083 | 2.279 | 2500000 | 3307.5 | 838460 | 920761823520686081 | Megalithic.me->Kraken 🐙⚡ |
+------------+--------------+--------------+--------------+--------+----------+--------------------+----------------------------+
Amount + fee: 2500000 + 3307.5 sat
Payment hash: 186ed1434ddff259aa735f53d121c8ed0db30b6e0b9e4d32986119ec2530ebaa
Payment status: SUCCEEDED, preimage: 4b4530d00b931ae28c459c1abd83152d941da6c192f87773e7abc73e8b27d977
-
See that the channel balances has changed
Our channel after the outgoing payment
Our channel is now balanced.
- Don't leave large balances on website or mobile wallets. As soon as is convenient, generate a new onchain address with
lncli
, so you can deposit the funds back in the LND wallet.
$ lncli newaddress p2tr
{
"address": "bc1p9xm64pztzt25sqs58lvdrc77upfarqyfkn2t0w6yyp4gavk20eeqc53s85"
}
- Use this address to Make a BTC withdrawal from the hosted wallet (in this case, Kraken), to the new address. After the payment has confirmed, you should see the funds back in the LND wallet.
$ lncli walletbalance
{
"total_balance": "3478460",
"confirmed_balance": "3478460",
"unconfirmed_balance": "0",
"locked_balance": "0",
"reserved_balance_anchor_chan": "10000",
"account_balance": {
"default": {
"confirmed_balance": "3478460",
Other ways you can rebalance
The above steps are my recommended ways for new node runners to manage channel balances. But there are also ways that you could experiment with.
Rebalance between multiple lightning channels
There are tools for LND that allow ou to send payments to yourself through intermediary nodes, which will result in modified balances. Well-known examples include Balance of Satoshis and Rebalance-LND, but you can also use LNDG.
You will find many node runners who spend considerable time and energy running and tweaking these scripts, and whose nodes are constantly attempting to rebalance profitably.
The Lighting Network actually benefits from different nodes trying different approaches to rebalancing, so if this is something you are interested in, by all means, dig in. Given that we already have LNDG set up, you might want to start with LNDG for this.
But: I never rebalance using scripts like this, and I do not recommend this strategy for new node runners.
Why? The most basic problem is: cost.
When you rebalance directly using other nodes on the Lightning Network, you need to pay fees. And to get your channel balances "right", you often need to throw off the channel balances of other nodes.
Other nodes will therefore tend to set their fees in such a way as to discourage rebalancing. For this reason, it's very, very difficult to "profitably" rebalance in this way.
Boltz or Loop
The Boltz and Loop services aren't cheap, but they do allow you to move funds from the Lighting Network to "on-chain", and vice-versa, adjusting your channel balances in the process. These services are also considerably more private than, for example, using a centralized and hosted wallet like in the example with Kraken, above.
There are some downsides, however.
- You need to run extra software on your node
- These services have fees, in addition to the routing fees you'll pay sending over the network
Peerswap
Not for new node runners, but recently Peerswap has become more popular. It also requires running custom software on your node.