Skip to content

Instantly share code, notes, and snippets.

@evildido evildido/
Last active Aug 18, 2019

What would you like to do?
# lnd location (usually $HOME/.lnd on linux)
# You backup directory
# Password used to unlock lnd wallet (base64 format)
# On unix system, run this command to convert your password to base64 > printf '%s' "MyPassword" | base64
# Don't modify this one
MACAROON_HEADER="Grpc-Metadata-macaroon: $(xxd -ps -u -c 1000 ${LND_DIR}/data/chain/bitcoin/mainnet/admin.macaroon)"
lncli --lnddir=$LND_DIR stop
# wait until lnd stop
while pgrep -x lnd > /dev/null; do
echo "LND has not yet stopped. Waiting 3 more seconds"
sleep 3
rsync --progress -aAXz -v $LND_DIR $BACKUP_DIR
echo "Backup done"
echo "start lnd"
screen -S lnd1 -d -m bash -c "lnd --lnddir=$LND_DIR"
sleep 2
screen -ls
echo "lnd started... unlock wallet"
sleep 1
curl --cacert $LND_DIR/tls.cert --header "$MACAROON_HEADER" https://localhost:8080/v1/unlockwallet -d '{ "wallet_password":'\"$LND_PASS_WALLET\"' }' -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.