Skip to content

Instantly share code, notes, and snippets.

@mutatrum
Last active October 6, 2022 08:13
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 mutatrum/f43517d919ed749fbc78244cb5514f28 to your computer and use it in GitHub Desktop.
Save mutatrum/f43517d919ed749fbc78244cb5514f28 to your computer and use it in GitHub Desktop.
Find transactions which put value on nulldata
#!/bin/bash
BLOCK=$(bitcoin-cli getblockcount)
for ((i=BLOCK; i>=1; i--))
do
echo $i
bitcoin-cli getblock $(bitcoin-cli getblockhash $i) 3 | jq -L $HOME -r 'include ".jq/decode_hex";
.tx[] | select(any(.vout[]; .scriptPubKey.type == "nulldata" and .value != 0)) | .txid + " " + (.vout[0].value * 1e8 | tostring) + " " + (.vout[0].scriptPubKey.hex[4:] | decode_hex)'
done
@mutatrum
Copy link
Author

mutatrum commented Oct 6, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment