Skip to content

Instantly share code, notes, and snippets.

@openoms
Last active April 18, 2021 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save openoms/9d0c554f620f4584c17bec268d4519e8 to your computer and use it in GitHub Desktop.
Save openoms/9d0c554f620f4584c17bec268d4519e8 to your computer and use it in GitHub Desktop.
Charge-lnd on the RaspiBlitz

More info at: https://github.com/accumulator/charge-lnd

Install:

sudo su - bitcoin
git clone https://github.com/accumulator/charge-lnd.git
lncli bakemacaroon offchain:read offchain:write onchain:read info:read --save_to=~/.lnd/data/chain/bitcoin/mainnet/charge-lnd.macaroon
cd charge-lnd 
pip install -U setuptools && pip install -r requirements.txt .

Paste to create the config:

echo "
[default]
strategy = static
base_fee_msat = 1000
fee_ppm = 1000
time_lock_delta = 144

[exchanges-drain-sats]
node.id = 033d8656219478701227199cbd6f670335c8d408a92ae88b962c49d4dc0e83e025, 03cde60a6323f7122d5178255766e38114b4722ede08f7c9e0c5df9b912cc201d6,037f990e61acee8a7697966afd29dd88f3b1f8a7b14d625c4f8742bd952003a590,03cde60a6323f7122d5178255766e38114b4722ede08f7c9e0c5df9b912cc201d6,033d8656219478701227199cbd6f670335c8d408a92ae88b962c49d4dc0e83e025, 021c97a90a411ff2b10dc2a8e32de2f29d2fa49d41bfbb52bd416e460db0747d0d
strategy = static
base_fee_msat = 50000
fee_ppm = 2500
time_lock_delta = 144

[discourage-routing]
chan.max_ratio = 0.10
chan.min_capacity = 250000
strategy = static
base_fee_msat = 1000
fee_ppm = 2000
time_lock_delta = 144

[encourage-routing]
chan.min_ratio = 0.90
chan.min_capacity = 250000
strategy = static
base_fee_msat = 1000
fee_ppm = 10
time_lock_delta = 144

" | sudo -u bitcoin tee /home/bitcoin/charge-lnd/charge.config

Set up a cronjob with:
crontab -e
Run every 5 minutes (https://crontab.guru/#*/5__**):

*/5 * * * * sudo -u bitcoin /home/bitcoin/.local/bin/charge-lnd -c /home/bitcoin/charge-lnd/charge.config
[default]
strategy = static
base_fee_msat = 1000
fee_ppm = 150
time_lock_delta = 40
[med-discourage-routing]
chan.max_ratio = 0.20
chan.min_capacity = 250000
strategy = static
base_fee_msat = 2500
fee_ppm = 750
time_lock_delta = 40
[med-encourage-routing]
chan.min_ratio = 0.75
chan.min_capacity = 250000
strategy = static
base_fee_msat = 500
fee_ppm = 50
time_lock_delta = 40
[big-proportional]
chan.min_ratio = 0.25
chan.max_ratio = 0.75
chan.min_capacity = 1000000
strategy = proportional
base_fee_msat = 1000
min_fee_ppm = 50
max_fee_ppm = 500
time_lock_delta = 40
#algorithm is
#let ratio = ratio of local to total capacity
#if ratio <= 0.2, increase fees
#if ratio >= 0.75, decrease fees
#if ratio between 0.25 and 0.75 and capacity >= 1M use proportional fee
#else default
[default]
strategy = static
base_fee_msat = 30
fee_ppm = 120
[bad-routing-partner]
node.max_sats = 200000
strategy = static
base_fee_msat = 50
fee_ppm = 250
[podcasters]
node.id = file://./friends.list
strategy = static
base_fee_msat = 1
fee_ppm = 5
[exchanges]
node.id = 033d8656219478701227199cbd6f670335c8d408a92ae88b962c49d4dc0e83e025,03cde60a6323f7122d5178255766e38114b4722ede08f7c9e0c5df9b912cc201d6,037f990e61acee8a7697966afd29dd88f3b1f8a7b14d625c4f8742bd952003a590
strategy = static
base_fee_msat = 50000
fee_ppm = 1500
# DYNAMIC
[discourage-routing-out-of-balance]
chan.max_ratio = 0.2
strategy = static
base_fee_msat = 10000
fee_ppm = 300
[discourage-routing-very-out-of-balance]
chan.max_ratio = 0.1
strategy = static
base_fee_msat = 9998
fee_ppm = 600
[encourage-routing-to-balance]
chan.min_ratio = 0.9
chan.min_capacity = 250000
strategy = static
base_fee_msat = 0
fee_ppm = 20
[nl]
node.id = file://./nl.list
strategy = static
base_fee_msat = 1
fee_ppm = 85
[default]
strategy = static
base_fee_msat = 30
fee_ppm = 120
[bad-routing-partner]
node.max_sats = 200000
strategy = static
base_fee_msat = 50
fee_ppm = 250
[podcasters]
node.id = file://./friends.list,032f4ffbbafffbe51726ad3c164a3d0d37ec27bc67b29a159b0f49ae8ac21b8508,037c6f76e33c726eacb15ded6b3b10555ee49a9f51bc0cce3f866ce81c4169f581
strategy = static
base_fee_msat = 1
fee_ppm = 5
[exchanges]
node.id = 033d8656219478701227199cbd6f670335c8d408a92ae88b962c49d4dc0e83e025,03cde60a6323f7122d5178255766e38114b4722ede08f7c9e0c5df9b912cc201d6,037f990e61acee8a7697966afd29dd88f3b1f8a7b14d625c4f8742bd952003a590
strategy = static
base_fee_msat = 50000
fee_ppm = 1500
[nlsuperhub]
node.id = 03e85b676b0e8c84088525a1377b075dc4e12197bf2974529a3a5fdbfb47e957a2,02e96b6466c73b617ce4759fdd60bad82f4ebd18ea84343fed95ff5727f2617182,0231eccc6510eb2e1c97c8a190d6ea096784aa7c358355442055aac8b20654f932,03c1a8ccc5c83b37059a3efbb72e633c0897172f2550475b93bdc14b5ca243a0d1,022297edebc55af78f4f472323fa8b827dacddc74bdd786cd90f77a8c845afaa68,0266ad254117f16f16c3457e081e6207e91c5e414477a208cf4d9c633322799038,03271562ad6fbb9b208eafe203216233cd756a3981c77ef1c5afda109df8be5ac2
chan.max_base_fee_msat = 1000
chan.max_fee_ppm = 5
strategy = static
base_fee_msat = 1
fee_ppm = 1
# DYNAMIC NOW:
[discourage-routing-out-of-balance]
chan.max_ratio = 0.2
strategy = static
base_fee_msat = 10000
fee_ppm = 300
[discourage-routing-very-out-of-balance]
chan.max_ratio = 0.1
strategy = static
base_fee_msat = 9998
fee_ppm = 600
[encourage-routing-to-balance]
chan.min_ratio = 0.9
chan.min_capacity = 250000
strategy = static
base_fee_msat = 0
fee_ppm = 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment