C-Otto / rebalance-lnd

A script that can be used to balance lightning channels of a lnd node
MIT License
343 stars 82 forks source link

Require fewer permissions #94

Open C-Otto opened 4 years ago

C-Otto commented 4 years ago

Currently the documentation states we need admin access. With lnd 0.9.0 it is possible to create macaroons with fewer permissions. See https://github.com/lightningnetwork/lnd/tree/master/macaroons#bakery

C-Otto commented 2 years ago

Looks like BTCpay doesn't even offer the (required) admin.macaroon :/

Goro2030 commented 2 years ago

Looks like BTCpay doesn't even offer the (required) admin.macaroon :/

BTCPay's admin.macaroon is at the root folder of the container, not where the script is looking for it. You can do:

cd /var/lib/docker/volumes/generated_lnd_bitcoin_datadir/_data cp admin.macaroon data/chain/bitcoin/mainnet/

But then I've run into the issue with the docker script that LN is not running at the port where it should. Anyone used the script with BTCPayServer?

Bit2Cash commented 1 year ago

Is there some info on how to run it on the BTCPayServer? I would like to try the tool but couldn't figure how with explanation on the Readme. This is what I get when trying to run it.

docker run --rm --network=generated_default -it -v /var/lib/docker/volumes/generated_lnd_bitcoin_datadir/_data:/root/.lnd rebalancelnd/rebalance-lnd -l --grpc lnd_bitcoin:10009
Traceback (most recent call last):
  File "/rebalance-lnd/rebalance.py", line 540, in <module>
    success = main()
  File "/rebalance-lnd/rebalance.py", line 326, in main
    return Rebalance(arguments).start()
  File "/rebalance-lnd/rebalance.py", line 21, in __init__
    self.lnd = Lnd(arguments.lnddir, arguments.grpc, arguments.network)
  File "/rebalance-lnd/lnd.py", line 32, in __init__
    combined_credentials = self.get_credentials(lnd_dir, network)
  File "/rebalance-lnd/lnd.py", line 49, in get_credentials
    with open(f"{lnd_dir}/data/chain/bitcoin/{network}/admin.macaroon", "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/root/.lnd/data/chain/bitcoin/mainnet/admin.macaroon'