1

I have been running a few full Bitcoin nodes for a long while now and I've decided to start learning how to interact with a node to get different information. Recently, Elon Musk's two messages were added to the Bitcoin blockchain. I wondered if as a starting pointI could directly interact with my BTC node and extract information like reading these two messages?

1

I saw this tweet in which it was mentioned that F2Pool included a message in coinbase transaction related to Elon Musk's tweet: https://twitter.com/zackvoell/status/1355152428903985157

Block: 668197

Use the below commands to get the message:

getblockhash 668197
getblock 000000000000000000023c31edf49adb2306d0db74e6f1f032ef76deaa7a464a 2

The first tx that you see in the JSON results will have a coinbase value which can be converted from hex to ascii using https://www.rapidtables.com/convert/number/hex-to-ascii.html

Or you can use this command on Linux which uses jq and xxd to make it easier:

bitcoin-cli getblock `bitcoin-cli getblockhash 668197` 2 | jq -r '.tx[0].vin[0].coinbase' | xxd -r -p

It was mentioned by Sjors Provoost in https://twitter.com/provoost/status/1345726239676489728

Can be verified by comparing with the things that you see for block 668197 on a block explorer: https://bitaps.com/668197

2
  • Excellent, That worked very well. Thank you. A quick question though: Why did we added the "2" after the blockhash when we called the block? – Pishi Feb 2 at 21:24
  • It's the second argument in getblock to define the verbosity. 2 returns an Object with information about block <hash> and information about each transaction. – Prayank Feb 2 at 22:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.