Skip to content

Instantly share code, notes, and snippets.

@buzztiaan
Last active December 10, 2024 15:15
Show Gist options
  • Save buzztiaan/a56cf4f5c3f9fc880ae63272d31ff9ed to your computer and use it in GitHub Desktop.
Save buzztiaan/a56cf4f5c3f9fc880ae63272d31ff9ed to your computer and use it in GitHub Desktop.
Dogecoin BIP32 derivative address display with incoming transaction notification (for use on Twitch)
#!/bin/bash
# bip32 derived address display thingy with transaction notification
# buZz github.com/buzztiaan
# democlip on https://www.youtube.com/watch?v=e_V9V7n2p_I
# depends on:
# - pycoin (with small patch for DOGE : https://github.com/richardkiss/pycoin/issues/332)
# - jq
# - qrencode
# - wget
# - bc
# does not depend on:
# - own running coin daemon
# key.sh just contains key=dgpv5xxxxxxx from a walletdump, you could also put key=dgpv5xxxxx in this script
. ./key.sh
derived="1"
maxderived="1000"
# to get all 1000 keys into a dogecoin 1.14, set keypool=1000 in dogecoin.conf and do the rpc call keypoolrefill
sessiontotal="0.00000000"
while [ 1 ]
do
address="$(ku -a -n DOGE -s 0H/0H/"$derived"H $key)"
balance="$(wget -q -O- https://chain.so/api/v2/get_address_balance/DOGE/$address | jq -r '.data .unconfirmed_balance')"
balforcomp="$(echo "($balance+0.5)/1"|bc)"
clear
echo
echo " Send Dogecoin donations to this address"
echo -n " [ Sessiontotal : "
echo -n $sessiontotal
echo "DOGE ]"
echo
qrencode -t ANSIUTF8 $address
echo
echo -n " "
echo $address
echo
while [ $balforcomp -eq 0 ]
do
sleep 10
balance="$(wget -q -O- https://chain.so/api/v2/get_address_balance/DOGE/$address | jq -r '.data .unconfirmed_balance')"
balforcomp="$(echo "($balance+0.5)/1"|bc)"
done
echo -n " OMG Thanks for that "
echo -n $balance
echo "DOGE"
echo " (waiting for 1 confirm)"
while [ $balforcomp -gt 0 ]
do
sleep 10
oldbalance=$balance
balance="$(wget -q -O- https://chain.so/api/v2/get_address_balance/DOGE/$address | jq -r '.data .unconfirmed_balance')"
balforcomp="$(echo "($balance+0.5)/1"|bc)"
done
echo " YAY CONFIRMED! THANKS FOR THE DONATION"
sessiontotal="$(echo "($sessiontotal+$oldbalance)"|bc -l)"
sleep 2
# if you dont want a changing address all the time, comment out the next line
derived=$[$derived+1]
if [ $derived -gt $maxderived ] ; then
derived="1"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment