Skip to content

Instantly share code, notes, and snippets.

@mutatrum
Created January 30, 2021 15:01
Show Gist options
  • Save mutatrum/e8e7d891fc8e6c9ab957fa48e6871c66 to your computer and use it in GitHub Desktop.
Save mutatrum/e8e7d891fc8e6c9ab957fa48e6871c66 to your computer and use it in GitHub Desktop.
#!/bin/bash
HEIGHT=$(bitcoin-cli getblockcount)
echo "$HEIGHT"
for ((i=1; i<=$HEIGHT; i++ ))
do
COINBASE=$(bitcoin-cli decoderawtransaction $(bitcoin-cli getrawtransaction $(bitcoin-cli getblock $(bitcoin-cli getblockhash $i) | jq -r '.tx[0]')) | jq -r '.vin[0].coinbase' | xxd -r -p | tr -cd '[:print:]')
echo "$COINBASE"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment