I'm currently gathering data for a historical stale-blocks dataset. Will be pubilshed for anyone to use as open-source (probably under a CC0 license). I'm still missing a lot of stale-block data before block 540801.
If you setup your node a while before block #540801 (2018-09-10), you can probably help. One way would be to post the output of the
getchaintips
RPC. This provides the height and stale block hash. However, it would be nice to have the corresponding headers to these stale-block hashes too (to e.g. prove that you didn't just make up some hash).I've used this shell script in the past to export the hashes and headers of my stale blocks on my node. Please make sure you understand random shell scripts that you run on your machine first.
#!/bin/bash # A script to extract stale blocks (height, hash, header) from a # Bitcoin Core node. Output is in CSV format. # This assumes .cookie-file authentication to the Bitcoin Core node. TIPS=$(bitcoin-cli getchaintips) STALE_TIP_PER_LINE=$(echo $TIPS | jq -c '.[] | select( .status == "valid-fork" or .status == "headers-only" or .status == "valid-headers" )') for tip in $STALE_TIP_PER_LINE do height=$(echo $tip | jq .height) hash=$(echo $tip | jq -r .hash) header=$(bitcoin-cli getblockheader $hash false) echo "$height,$hash,$header" done
Appreciate any help, thanks!
#!/bin/sh
since you are not using any Bash-specific features in the script. Also you can usejq -c '.[] | select (.status != "active")'
for brevity.bitcoin-cli getchaintips
is shorter than yours.invalid
status ingetchaintips
when you've usedinvalidateblock
.