Skip to content

Instantly share code, notes, and snippets.

@kirkins
Created February 14, 2019 16:32
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 kirkins/fb0c09d51d812a8ba751612020560423 to your computer and use it in GitHub Desktop.
Save kirkins/fb0c09d51d812a8ba751612020560423 to your computer and use it in GitHub Desktop.
For checking the balance of several bitcoin addresses in a text file
#!/usr/bin/env bash
# For format of 64 chars without 0x at the start
# Source script from: https://github.com/grondilu/bitcoin-bash-tools.git
source ./bitcoin.sh
while read k; do
PUBLIC=$(newBitcoinKey 0x$k \
| grep bitcoin\ address \
| head -1 \
| cut -f 2 -d ":" \
| tr -d " ")
BALANCE=$(wget -qO- blockchain.info/rawaddr/$PUBLIC 2>&1 \
| grep -Po '"final_balance":\K[0-9]+')
if [ -n "$BALANCE" ]; then
echo $k,$PUBLIC,$BALANCE
fi
done < keys.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment