Skip to content

Instantly share code, notes, and snippets.

@fiatjaf
Last active Dec 18, 2020
Embed
What would you like to do?
list all relative locktime usage across an interval of blocks
for (( b=661000; b<=661884; b++ )) do
x=`bitcoin-cli getblock $(bitcoin-cli getblockhash $b) 2 | jq -c '.tx | map(select(.version > 1)) | map(.vin | map(.sequence | select((. < 2147483648) and (. > 0)))) | reduce .[] as $ns ([]; . + $ns) | reduce .[] as $n ({}; .["\($n)"] = (.["\($n)"] // 0) + 1)'`
if [ "$x" != '{}' ]
then echo $b: $x
fi
done
661003: {"1":1}
661005: {"144":1}
661013: {"144":1,"765":1}
661014: {"144":1}
661018: {"150":1,"144":1}
661021: {"144":1,"520":1,"1091":1}
661024: {"1":1}
661026: {"144":3}
661028: {"144":1,"2016":1}
661029: {"144":2}
661030: {"144":1}
661033: {"1":2}
661035: {"1":1}
661036: {"1":3}
661040: {"1":1}
661043: {"1":2}
661044: {"1008":1}
661045: {"1":9}
661047: {"1":3}
661048: {"1":1}
661050: {"1":2}
661051: {"720":3}
661053: {"1":7}
661055: {"1":4}
661059: {"1":5,"144":1}
661061: {"1":2,"144":1}
661064: {"1":1}
661065: {"216":1}
661066: {"216":1,"1":2}
661067: {"726":1}
661069: {"144":1}
661070: {"2016":3,"1":14}
661076: {"144":2}
661077: {"1":13}
661079: {"1":1}
661080: {"1":4}
661081: {"1":1}
661087: {"600":3}
661089: {"864":1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment