When I start up my Bitcoin core, it says "loading block index". Does this indexing occur on my local machine or does this mean my wallet fetches the latest block info, more specifically the block height? What is the purpose of this block indexing? Thanks
When I start up my Bitcoin core, it says "loading block index".
The Bitcoin Core node software maintains several pieces of data on disk (excluding the wallet):
- The actual blocks in append-only data files.
- The block index (which block headers exist, how they interconnect, and where on disk they are stored)
- The chain state (the set of unspent outputs with amount, txid and address) at the current best block in the index.
Because this information about what blocks are known and where they are on disk is so frequently needed, it is loaded entirely into memory.
During the "loading block index", the full block index is loaded into memory (it's pretty small, 60 MB at the time of writing), and several consistency checks are done (including verifying all difficulties and proof of work).
Does this indexing occur on my local machine
or does this mean my wallet fetches the latest block info, more specifically the block height?
No, fetching information about new blocks always occurs in the background while your node is active, but during the "Loading block index" phase it is not yet active.
What is the purpose of this block indexing?
By index you perhaps are thinking of something more fancy than it is. It's simply a table that allows you to look a block's information based on its hash.
Bitcoin Core internally has dozens of indexes for various pieces of data. This is just one that is relatively big, and stored on disk.