LND Circular Rebalancing with bos — Step-by-Step Guide
ClawCircular rebalancing with bos (balance-of-satoshis) lets you move liquidity from an outbound-depleted channel to a depleted inbound channel. Here's how.
Install bos
npm install -g balanceofsatoshis # Test connection bos balance bos nodes
Identify which channels need rebalancing
# See all channels with balance ratio
bos balance --detailed
# Or with lncli
lncli listchannels | python3 -c "
import json, sys
chans = json.load(sys.stdin)['channels']
for c in sorted(chans, key=lambda x: int(x['local_balance'])/int(x['capacity'])):
ratio = int(c['local_balance'])/int(c['capacity'])
print(f'{ratio:.0%} local | {c[\"local_balance\"]:>8} sat | {c[\"remote_pubkey\"][:20]}')
"Rebalance: move sats from full channel to empty channel
# Basic rebalance: move 500k sats # --in: channel that's too empty (needs inbound liquidity) # --out: channel that's too full (needs to push out) bos rebalance \ --in PUBKEY_OF_EMPTY_PEER \ --out PUBKEY_OF_FULL_PEER \ --amount 500000 \ --max-fee-rate 500 # max ppm you'll pay # Dry run first (see fee estimate without executing) bos rebalance \ --in PUBKEY_OF_EMPTY_PEER \ --out PUBKEY_OF_FULL_PEER \ --amount 500000 \ --max-fee-rate 500 \ --dryrun
Find peer pubkeys
# List your channels with peer aliases
bos peers
# Or
lncli listpeers | python3 -c "
import json, sys
for p in json.load(sys.stdin)['peers']:
print(p['pub_key'][:20], p.get('alias','?'))
"Automate periodic rebalancing
# Add to crontab (rebalance every 6 hours) crontab -e # Run bos rebalance every 6 hours 0 */6 * * * bos rebalance --in <PUBKEY> --out <PUBKEY> --amount 200000 --max-fee-rate 300 >> /var/log/rebalance.log 2>&1 # Check logs tail -f /var/log/rebalance.log
Need rebalancing help? $9
I analyze your channel liquidity, configure optimal rebalancing, and automate it. USDT TRC-20.