BOS - Rebalancing Channels
You'll recall in the Thunderhub guide series, that we went over how to do channel rebalancing. For a refresher, a channel rebalance is when you pay yourself out one channel and back into another one of your channels, thus evening out liquidity of your node. You will also recall that in Thunderhub you cannot know how much you can rebalance without trial and error. You do not know how much you can rebalance before you run the rebalance. This can be a bit annoying. What if you could find out what the max you could rebalance was before you actually triggered the rebalance? That's exactly what we can do with BOS.
For this guide, we will be working with the BOS command
rebalance. First we need a bit of information about our channels. The easiest way to do this is to go into Thunderhub and look at your channels and find one that needs some inbound liquidity. This sort of channel will look heavy on the blue side like this:
Let's click the channel in Thunderhub and find the Node Public Key. We will need this in BOS.
Now that we have the pubkey of the channel that we wish to rebalance, let's run the rebalance command and define that we want to spend OUT of the channel. The command will then go through your other channels and find the most optimal one to rebalance
$ bos reblance --out PUBKEYOFOUTBOUNDHEAVYCHANNEL
After you trigger this command you will begin seeing a real-time feed of all the paths your node is attempting to do. Just let it run. It shouldn't take more than a few minutes to finish.
We can rebalance about 3,385,652 sats. This takes the guesswork out of it that we would have to deal with if we just used Thunderhub. We got some extra data as well. It is telling us the path and it's also saying that we need to confirm that we want to pay the fee, which is about 1500 sats. You may also see a
needed-max-fee-rateoutput. You can define this with
--max-fee-rate. Let's say that we find that a good deal for this example, and we want to do it. So now we will run the same command as above with a little extra tag:
$ bos reblance --out PUBKEYOFOUTBOUNDHEAVYCHANNEL --in PUBKEYOFINBOUND CHANNEL --max-fee 1600 --max-fee-rate 600
Success! Here is the final result:
The rebalance succeeded as expected. You have to carefully decide if the results BOS gives you is one you actually want. In this example, although SwissNode-Bank became more balanced, the other channel became less balanced. This is a great example of why it's best to check both channels before initiating the rebalance.