Created
April 21, 2025 13:35
-
-
Save Sjors/e748615ac38bbebf959544fea74e3121 to your computer and use it in GitHub Desktop.
Find block containing the biggest OP_RETURN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# First OP_RETURN is expected in March 2014 (~290,000) | |
# https://arxiv.org/pdf/1702.01024 | |
n=`bitcoin-cli getblockcount` | |
record=0 | |
for height in $(seq 0 $n) | |
do | |
if (( $height % 1000 == 0 )); then | |
echo "Checking block $height..." | |
fi | |
hash=`bitcoin-cli getblockhash $height` | |
biggest=`bitcoin-cli getblock $hash 2 | jq '[.tx[].vout[] | select(.scriptPubKey.type == "nulldata") | .scriptPubKey.hex | length / 2] | max'` | |
if (( biggest > record )); then | |
record=$biggest | |
echo "Block $height: ~$record" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment