Categories
bitcoin

Cool things to see and do on a bitcoin node

Here is a list of cool things you can see, do and find out on a bitcoin node. Specifically for full nodes running in CLI or daemon mode – not GUI client.

Get Block Count

Get the total number of blocks in your version of the blockchain – the one on your local node. If it is up to date then this will be the number of blocks in total verified on the bitcoin blockchain.

bitcoin-cli getblockcount
685608

Get the total amount of bitcoin that has been mined

To check the total amount of bitcoin that has been mined execute:

ubuntu@btc:~$ bitcoin-cli gettxoutsetinfo
{
  "height": 713513,
  "bestblock": "00000000000000000000e786c548255af5b4509c16d909b03c65568dc4ab998a",
  "transactions": 46621408,
  "txouts": 77012436,
  "bogosize": 5761235215,
  "hash_serialized_2": "4edfcd9e471794a587ac32dd26d2285829b89d0999ab4740391593bc7358a63c",
  "disk_size": 4705170290,
  "total_amount": 18896756.29158394
}

The "total_amount": 18896756.29158394 is the total from the max of 21000000

Get the time (in UTC not blockheight) a block was mined

Get the hash, get the block verbosely and convert the unix epoch time into human readable. Use the mediantime.

Mediantime is the median time of the past 11 block timestamps

bitcoin-cli getblockhash 100000
bitcoin-cli getblock 000000000003ba27aa200b1cecaad478d2b00432346c3f1f3986da1afd33e506 2
date -d @1293622620
Wed 29 Dec 2010 11:37:00 AM UTC

Some dates:

  • block 100,000: Wed 29 Dec 2010 11:37:00 AM UTC
  • block 200,000: Sat 22 Sep 2012 09:57:08 AM UTC
  • block 300,000: Sat 10 May 2014 05:54:38 AM UTC
  • block 400,000: Thu 25 Feb 2016 03:52:57 PM UTC
  • block 500,000: Mon 18 Dec 2017 06:14:46 PM UTC
  • block 600,000: Fri 18 Oct 2019 11:09:37 PM UTC
  • block 700,000: Sat 11 Sep 2021 04:14:32 AM UTC
  • block 800,000: Mon 24 Jul 2023 03:17:09 AM UTC

The number of blocks per gregorean year:

365 days * 24 hours * 6 blocks an hour
52560

Get the Genesis Block

Get the block hash at height 0:

ubuntu@btc:~$ bitcoin-cli getblockhash 0
000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f

Verbosely get the block by the hash:

ubuntu@btc:~$ bitcoin-cli getblock 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f 2
{
  "hash": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
  "confirmations": 695440,
  "strippedsize": 285,
  "size": 285,
  "weight": 1140,
  "height": 0,
  "version": 1,
  "versionHex": "00000001",
  "merkleroot": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
  "tx": [
    {
      "txid": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
      "hash": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
      "version": 1,
      "size": 204,
      "vsize": 204,
      "weight": 816,
      "locktime": 0,
      "vin": [
        {
          "coinbase": "04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73",
          "sequence": 4294967295
        }
      ],
      "vout": [
        {
          "value": 50.00000000,
          "n": 0,
          "scriptPubKey": {
            "asm": "04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f OP_CHECKSIG",
            "hex": "4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac",
            "type": "pubkey"
          }
        }
      ],
      "hex": "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000"
    }
  ],
  "time": 1231006505,
  "mediantime": 1231006505,
  "nonce": 2083236893,
  "bits": "1d00ffff",
  "difficulty": 1,
  "chainwork": "0000000000000000000000000000000000000000000000000000000100010001",
  "nTx": 1,
  "nextblockhash": "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048"
}

Decode the hex field – with the iconic Chancellor on brink evidence

ubuntu@btc:~$ echo “01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000” | xxd -r -p
????M??EThe Times 03/Jan/2009 Chancellor on brink of second bailout for banks?????*CAg????UH'g?q0?\֨(?9 ?yb??a޶I???L?8??U???\8M??
                                                 ?W?Lp+k?_?

You can also get this by going to your blocks folder in your bitcoin folder and running:

ubuntu@btc:/mnt/btc/bitcoin/blocks$ hexdump -C -s 8 -n 285 blk00000.dat
00000008  01 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000018  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000028  00 00 00 00 3b a3 ed fd  7a 7b 12 b2 7a c7 2c 3e  |....;...z{..z.,>|
00000038  67 76 8f 61 7f c8 1b c3  88 8a 51 32 3a 9f b8 aa  |gv.a......Q2:...|
00000048  4b 1e 5e 4a 29 ab 5f 49  ff ff 00 1d 1d ac 2b 7c  |K.^J)._I......+||
00000058  01 01 00 00 00 01 00 00  00 00 00 00 00 00 00 00  |................|
00000068  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000078  00 00 00 00 00 00 ff ff  ff ff 4d 04 ff ff 00 1d  |..........M.....|
00000088  01 04 45 54 68 65 20 54  69 6d 65 73 20 30 33 2f  |..EThe Times 03/|
00000098  4a 61 6e 2f 32 30 30 39  20 43 68 61 6e 63 65 6c  |Jan/2009 Chancel|
000000a8  6c 6f 72 20 6f 6e 20 62  72 69 6e 6b 20 6f 66 20  |lor on brink of |
000000b8  73 65 63 6f 6e 64 20 62  61 69 6c 6f 75 74 20 66  |second bailout f|
000000c8  6f 72 20 62 61 6e 6b 73  ff ff ff ff 01 00 f2 05  |or banks........|
000000d8  2a 01 00 00 00 43 41 04  67 8a fd b0 fe 55 48 27  |*....CA.g....UH'|
000000e8  19 67 f1 a6 71 30 b7 10  5c d6 a8 28 e0 39 09 a6  |.g..q0..\..(.9..|
000000f8  79 62 e0 ea 1f 61 de b6  49 f6 bc 3f 4c ef 38 c4  |yb...a..I..?L.8.|
00000108  f3 55 04 e5 1e c1 12 de  5c 38 4d f7 ba 0b 8d 57  |.U......\8M....W|
00000118  8a 4c 70 2b 6b f1 1d 5f  ac 00 00 00 00           |.Lp+k.._.....|

Source: Plan B tweet

Get Info

There are a few ways to get information

bitcoin-cli help | grep info
getblockchaininfo
getmempoolinfo
gettxoutsetinfo ( "hash_type" )
getmemoryinfo ( "mode" )
getrpcinfo
getmininginfo
getaddednodeinfo ( "node" )
getnetworkinfo
getpeerinfo
getdescriptorinfo "descriptor"
getindexinfo ( "index_name" )
getaddressinfo "address"
getwalletinfo

Get the Pizza Day Traction by Laszlo

bitcoin-cli getrawtransaction a1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d 2

Get Block Stats

bitcoin-cli getblockstats <hash_or_height>

Example:

bitcoin-cli getblockstats 821595
{
  "avgfee": 149184,
  "avgfeerate": 637,
  "avgtxsize": 390,
  "blockhash": "0000000000000000000428204fbb6c41d5b1ea5da2d108b0e3ed1dfc783f99b4",
  "feerate_percentiles": [
    558,
    571,
    590,
    618,
    659
  ],
  "height": 821595,
  "ins": 5399,
  "maxfee": 25877000,
  "maxfeerate": 63795,
  "maxtxsize": 43152,
  "medianfee": 89090,
  "mediantime": 1702801119,
  "mediantxsize": 321,
  "minfee": 33880,
  "minfeerate": 180,
  "mintxsize": 151,
  "outs": 12171,
  "subsidy": 625000000,
  "swtotal_size": 1649376,
  "swtotal_weight": 3924735,
  "swtxs": 4216,
  "time": 1702804998,
  "total_out": 206749061584,
  "total_size": 1666152,
  "total_weight": 3991839,
  "totalfee": 635823245,
  "txs": 4263,
  "utxo_increase": 6772,
  "utxo_size_inc": 549895,
  "utxo_increase_actual": 6766,
  "utxo_size_inc_actual": 549338
}