The following is the GNU All-permissive License as recommended in https://www.gnu.org/licenses/license-recommendations.en.html
Copyright (C) 2024 Free Software Foundation sysadmin@fsf.org
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.
Contributions are welcome. See https://savannah.gnu.org/maintenance/fsf/.
get full bitcoin / litecoin transaction history
Litecoin:
su -c "litecoin-cli listtransactions '*' 1000000" litecoin | jq ".[] | select(.confirmations >= 1) | [ .amount, .time, .address, .label, .txid ] | @csv " | sed -e 's/\\"//g; s/"//g' | while read line ; do seconds="$(echo "$line" | awk -F, '{ print $2 }')"; timestamp="$(date -Iseconds -d @$seconds)"; echo "$line" | sed -e "s/$seconds/$timestamp/"; done | tee /tmp/litecoin-history ; echo "amount,time,address,label,trxnid" | cat - /tmp/litecoin-history | sponge /tmp/litecoin-history
su -c "bitcoin-cli listtransactions '*' 1000000" bitcoin | jq ".[] | select(.confirmations >= 1) | [ .amount, .time, .address, .label, .txid ] | @csv " | sed -e 's/\\"//g; s/"//g' | while read line ; do seconds="$(echo "$line" | awk -F, '{ print $2 }')"; timestamp="$(date -Iseconds -d @$seconds)"; echo "$line" | sed -e "s/$seconds/$timestamp/"; done | tee /tmp/bitcoin-history ; echo "amount,time,address,label,trxnid" | cat - /tmp/bitcoin-history | sponge /tmp/bitcoin-history
For bitcoin, change the two mentions of litecoin
to bitcoin
above.
Get just the last $days of donation amounts:
days=60; min=$(( $(date -d "$(date +%F) 0" +%s) - 60*60*24*days))
su -c "bitcoin-cli listtransactions '*' 1000" bitcoin | jq ".[] | select(.confirmations >= 1) | select(.time >= $min) | select(.category == \"receive\")" | tee /tmp/bitcoin-history-range