Bitcoin CLI tooltips and hacks
@BitcoinToolTips
Bitcoin tooltips and hacks
You might like
bitcoin-cli getblock $(bitcoin-cli getblockhash 666666) 0 | xxd -r -p | fq -d bitcoin_block '.transactions[] | .outputs[] | select(.scriptpub[0].op == "return") | .scriptpub[1].arg'
$ bitcoin-cli getblock $(bitcoin-cli getblockhash 0) 2 | jq .tx[0].hex | xxd -r -p | strings | head -n 1 EThe Times 03/Jan/2009 Chancellor on brink of second bailout for banks Happy Birthday #Bitcoin 🥳
bitcoin-cli getblock $(bitcoin-cli getblockhash 0) 0 | xxd -r -p | xxd
I want to check if my genesis block is the same as yours. How do I output the raw hex version of it with bitcoin-cli?
bitcoin-cli getblockhash 0 | xargs -I{} bitcoin-cli getblock {} 0
$ bitcoin-cli getblockchaininfo | jq .softforks.taproot.bip9.status "active"
$ date -d "+$(bitcoin-cli getblockchaininfo | jq '.softforks.taproot.bip9.min_activation_height - .blocks')0 minutes" -uR Wed, 17 Nov 2021 13:31:05 +0000
Finding missed opportunities in lnd.log: zgrep "insufficient bandwidth to route htlc" ~/.lnd/logs/bitcoin/mainnet/lnd.log* | grep "ChannelLink" | cut -d' ' -f5,11 | awk 'BEGIN { FS=OFS=SUBSEP=" "}{arr[$1]+=$2 }END {for (i in arr) print i,arr[i]}' | sort -n -t' ' -k2 -r
if you’re on linux, use it with “watch” for the live experience watch -t bitcoin-cli -netinfo 4 and for more info, run bitcoin-cli -netinfo help
# aggragate mempool fees bitcoin-cli getrawmempool true | fx "Object.keys(this).map( (e,i,a)=>this[e].fee) .reduce((a, v)=> a+v)"
list of all the config options ./src/bitcoind -help or ./src/bitcoind -? list of all the RPCs ./src/bitcoin-cli help detailed help for an RPC ./src/bitcoin-cli help (rpc call name) ./src/bitcoin-cli help getaddressinfo
Bashified the coarse difficulty adjustment estimation. I'm still not sure if this is a reasonable correct way of estimating an upcoming difficulty adjustment.
Estimation of next difficulty adjust, am I doing this correctly? Start: 687456 (mediantime 1623613511) Now: 688792 (mediantime 1624626380) 1336 blocks, average ~758 sec/block. Ratio: 600 / 758 = 0.79 Change estimate: -21%? Or is this oversimplified? (Ignoring first block bug)
# % sync'd prog() { local w=80 p=$1; shift printf -v dots "%*s" "$(( $p*$w/100 ))" ""; dots=${dots// /.} printf "\r\e[K|%-*s| %3d %% %s" "$w" "$dots" "$p" "$*" } while : ; do prog $(bitcoin-cli getblockchaininfo | jq '.verificationprogress * 100|floor') sleep 10 done ; echo
bitcoin-cli -netinfo 4 | grep -E "(bitnodes|nodes.multiven.io|https://t.co/0f4cfWkYZM|btc_node_scanner)" | awk '{ print $10 }' | awk -F: '{print $1}' | xargs -I {} sh -c 'echo "$(date) # banning {} ..."; bitcoin-cli setban "{}" "add" 999999999' on a cron
Oh, commands to get this data: $ ./bitcoin-cli getpeerinfo | grep subver | sort | uniq -c | sort -n $ tail -n5000000 ~/.bitcoin/debug.log | sed -n 's/.*receive version message: //p;' | sed 's/ version [0-9]*, blocks=.*//' | sort | uniq -c | sort -n (2nd requires -debug=net)
admin@mynode:~$ bitcoin-cli getnetworkinfo { "version": 210100, "subversion": "/Satoshi:0.21.1/" Upgrade your #bitcoin node Pass it on.
bitcoin-cli getpeerinfo | jq -r .[].subver | sort
d=1; for ((i=0; i < $(bitcoin-cli getblockchaininfo | jq .blocks); i += 2016)) do n=$(bitcoin-cli getblock $(bitcoin-cli getblockhash $i) | jq .difficulty); c=$(echo "($n/$d * 100) - 100" | bc -l); echo $i: $c; d=$n; done
echo $(bitcoin-cli decoderawtransaction $(bitcoin-cli getrawtransaction $(bitcoin-cli getblock $(bitcoin-cli getblockhash 681629) | jq -r '.tx[0]')) | jq -r '.vin[0].coinbase' | xxd -r -p)
$ bitcoin-cli getblockchaininfo | jq .softforks.taproot.bip9.statistics.count 69 Nice.
More stupid bitcoin-cli and bash fun. Should be easy enough to change colours.
United States Trends
- 1. Good Thursday 22.3K posts
- 2. Happy Friday Eve N/A
- 3. #Talus_Labs N/A
- 4. Lakers 80.9K posts
- 5. Luka 71.8K posts
- 6. Marcus Smart 6,380 posts
- 7. Wemby 27.6K posts
- 8. #LakeShow 5,828 posts
- 9. #AmphoreusStamp 7,505 posts
- 10. Russ 11.5K posts
- 11. Blazers 9,191 posts
- 12. Unplanned 5,885 posts
- 13. Richard 46.6K posts
- 14. Ayton 17.1K posts
- 15. #dispatch 66.5K posts
- 16. Podz 2,456 posts
- 17. #ONEPIECE1165 11.2K posts
- 18. Shroud 5,846 posts
- 19. Nico Harrison 2,094 posts
- 20. Fire Nico 1,129 posts
Something went wrong.
Something went wrong.