Last active
May 27, 2022 10:52
-
-
Save jasny/3cdf73e96badd77211712d0193529253 to your computer and use it in GitHub Desktop.
Transfer full LTO node balance to own wallet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo "USAGE: $0 RECIPIENT" >&2 | |
exit 1 | |
fi | |
RECIPIENT="$1" | |
WALLET_ADDRESS=$(curl -sS http://localhost:6869/wallet/addresses | jq -r '[0]') | |
BALANCE=$(curl -sS http://localhost:6869/addresses/balance/$WALLET_ADDRESS | jq -r '.balance') | |
AMOUNT=$((BALANCE - 100000000)) | |
curl -sS http://localhost:6869/transactions/submit/transfer --header "X-Api-Key: $LTO_API_KEY" --header "Content-Type: application/json" --data "{\"sender\": \"$WALLET_ADDRESS\", \"recipient\": \"$RECIPIENT\", \"amount\": $AMOUNT, \"fee\": 100000000}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Transfer full LTO node balance to own wallet
Install
Download
lto-transfer-all
and store it in~/.bin
or/usr/local/bin
.Make the file executable
Cron
Add a cronjob to transfer the full balance of your node to your cold wallet once a week.
Change
MY_COLD_WALLET
to your cold wallet address