Last active
August 25, 2021 22:33
-
-
Save mutatrum/c66b835b529a45d2605d193b8c5617df to your computer and use it in GitHub Desktop.
Estimate taproot activation date
This file contains 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 | |
CURRENT_BLOCK="$(bitcoin-cli getblockcount)" | |
CURRENT_BLOCK_HASH="$(bitcoin-cli getblockhash $CURRENT_BLOCK)" | |
CURRENT_BLOCK_TIME="$(bitcoin-cli getblock $CURRENT_BLOCK_HASH | jq '.mediantime')" | |
TAPROOT_BLOCK="$(bitcoin-cli getblockchaininfo | jq '.softforks.taproot.bip9.min_activation_height')" | |
BLOCK_DELTA="$(($TAPROOT_BLOCK-$CURRENT_BLOCK))" | |
PREVIOUS_BLOCK="$(($CURRENT_BLOCK-$BLOCK_DELTA))" | |
PREVIOUS_BLOCK_HASH="$(bitcoin-cli getblockhash $PREVIOUS_BLOCK)" | |
PREVIOUS_BLOCK_TIME="$(bitcoin-cli getblock $PREVIOUS_BLOCK_HASH | jq '.mediantime')" | |
DELTA_TIME="$(($CURRENT_BLOCK_TIME-$PREVIOUS_BLOCK_TIME))" | |
TAPROOT_TIME="$(($CURRENT_BLOCK_TIME+$DELTA_TIME))" | |
echo "$(date -d @$TAPROOT_TIME +'%F %R')" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment