ZmnSCPxj / clboss

Automated Core Lightning Node Manager
MIT License
210 stars 32 forks source link

configure clboss rebalance #136

Closed RemoRitzmann closed 2 years ago

RemoRitzmann commented 2 years ago

I have trouble balancing my channels and I want to configure clboss better to my needs. Because my problem is that I lose more sats rebalancing than getting with transaction fees. So I have a few questions, but I'm not sure whether they belong here. Any help with some hints or resources to read is welcome.

In Raspiblitz menu -> SYSTEM -> CLCONF /home/bitcoin/.lightning/config I added the line plugin=/home/bitcoin/cl-plugins-available/plugins/rebalance/rebalance.py

First question: is rebalance.py part of clboss?

I saw that it rebalances with too hight fees, so I stop automatic rebalancing all my channels: lightning-cli clboss-unmanage 023f585f039f6fa11bf7d5c963054ba22423dcc3ef47f729b4839ec760c54fa19d lnfee, open, close, balance #flashlouwie lightning-cli clboss-unmanage 0254bb156ecd0eac318844415a91a377bc6947ea4c9fbe5d248e563c29a1662835 lnfee, open, close, balance #sendNodes.space lightning-cli clboss-unmanage 0251fff168b58b74e9b476af5a515b91fe0540a3681bc97fbb65379a807aea5f66 lnfee, open, close, balance #zlnd0 lightning-cli clboss-unmanage 026165850492521f4ac8abd9bd8088123446d126f648ca35e60f88177dc149ceb2 lnfee, open, close, balance #Boltz

I want to set base fees to 1000 msat and fee rate to 500 milli msat minimum. I want to allow clboss to change them higher when appropriate but never lower. Can I do this? In what file?

For now I balance my channels on my own with lightning-cli rebalance -k outgoing_scid=728093x2259x1 incoming_scid=735727x826x0 msatoshi=45005sat maxfeepercent=0.01 retry_for=60 In my lnd node I can set a maximum allowed fee including all base fees and fee rates. Can I do this with manual rebalance in cl-core with clboss rebalance.py too?

Today I saw that clboss moves funds to on-chain, why? I saw in sudo tail -n 30 -f /home/bitcoin/.lightning/bitcoin/cl.log 2022-06-06T09:48:01.439Z INFO plugin-clboss: SwapManager: Swap 816edc26b0ad39ebfbe1e261a2f4cf82 completed with 122014000msat onchain. Provider: Boltz::Service(\"https://boltz.exchange/api\") 2022-06-06T09:48:01.439Z INFO plugin-clboss: NeedsOnchainFundsSwapper: Done, got 122014000msat onchain. 2022-06-06T09:48:01.464Z INFO plugin-clboss: SwapManager: Sent 124650689msat on Lightning, got 122014000msat onchain. It does not make sense, because this reduces remote balance, but I want to balance my channels 50:50. how can I stop it from doing this?

My manual rebalance succeeded with 2022-06-06T10:08:39.762Z INFO plugin-rebalance.py: 6 hops and 13.636sat fees for 45005sat along route: SwissCore -> flashlouwie -> 038bfe5054cd71656095 -> MalleInvestmentfonds -> Cochinorrea -> ???? Cheese -> SwissCore

admin@192.168.178.2:~ ₿ lightning-cli rebalance -k outgoing_scid=728093x2259x1 incoming_scid=735727x826x0 msatoshi=45005sat maxfeepercent=0.04 retry_for=900 { "sent": "45018636msat", "received": "45005000msat", "fee": "13636msat", "hops": 6, "outgoing_scid": "728093x2259x1", "incoming_scid": "735727x826x0", "status": "complete", "message": "45018636msat sent over 6 hops to rebalance 45005000msat", "stats": "running_for:694 count_getroute:62 time_getroute:40.50756359100342 time_getroute_avg:0.6533477998548939 count_sendpay:43 time_sendpay:609.1968762874603 time_sendpay_avg:14.16736921598745"

But there was a cheaper option found before: 2022-06-06T09:58:52.032Z INFO plugin-rebalance.py: 6 hops and 2.543sat fees for 45005sat along route: SwissCore -> flashlouwie -> sendNodes.space -> zero fee routing | CLN -> RaspiFefo -> ???? Cheese -> SwissCore

Has this happened because it does not take into account base fees?

Best regards, Remo

ZmnSCPxj commented 2 years ago

First question: is rebalance.py part of clboss?

No, clboss does not use it and has its own rebalance implementation.

I want to set base fees to 1000 msat and fee rate to 500 milli msat minimum. I want to allow clboss to change them higher when appropriate but never lower. Can I do this? In what file?

This seems to point to a plan to use a "wall" strategy, i.e. charge high for forwardings, and opportunistically steal liquidity from nodes charging low fees (base=1, proportional=1, or even base=0 proportional=0) by rebalancing at low feerates.

While some node operators swear by the wall strategy, another competing strategy, passive rebalance, also exists which other node operators swear by. I am now planning to evaluate which strategy works better on the current network, which will take some time (I need to code them up and then evaluate them). After that there would be no need to configure as CLBOSS would use whichever strategy is evaluated to have been better. CLBOSS really wants to not have to configure anything at all.

In my lnd node I can set a maximum allowed fee including all base fees and fee rates. Can I do this with manual rebalance in cl-core with clboss rebalance.py too?

With current CLBOSS, no. You have to use clboss-unmanage to release the control of clboss, then use setchannelfee/setchannel on the Core Lightning node.

Today I saw that clboss moves funds to on-chain, why?

https://zmnscpxj.github.io/clboss/01-inbound.html

For your specific case:

2022-06-06T09:48:01.439Z INFO plugin-clboss: NeedsOnchainFundsSwapper: Done, got 122014000msat onchain.

It is because of this:

Boss::Mod::NeedsOnchainFundsSwapper: triggers when a small amount of onchain funds is detected, but the amount is too small for a feasible practical channel. This will typically occur if for example a channel needs to get closed, and only a small amount of money happens to be on our side of the channel-to-close. Rather than HODL this money onchain, CLBOSS will try to make an offchain-to-onchain swap to get more onchain funds, and form a new, larger channel. This only triggers if onchain fees are low.

-

But there was a cheaper option found before:

Low-fee forwarding nodes are notoriously flaky because all the "Wall" strategy nodes keep stealing their liquidity, so it is unlikely that the cheaper option remains viable. Basically all the "wall" strategy nodes compete on stealing the liquidity from low-feerate nodes, like "zero fee routing" and then resell the liquidity later at higher feerates.

RemoRitzmann commented 2 years ago

Amazing! I love your statement: "After that there would be no need to configure as CLBOSS would use whichever strategy is evaluated to have been better." So you want clboss to choose between "wall strategy" and "passive rebalance" on its own!

I want to learn more about passive rebalancing, can you explain it a bit or do you have a reference?

Thanks and keep doing your great work! Let me know when I can help here in Switzerland or when I can test something for you.