How to read a blockchain

If I was reading a linked list, I would start with the address of the list then read the pointers in successive list entries to follow the trail.

If I am reading a blockchain, how do I start? I mean, are they stored as labelled files? There is no address listed in any block, sure the hash of the previous block is stored in the following block, but that doesn’t provide an easy way of locating blocks.

Say I wanted to find out how many bitcoins a particular address had. Would I read the entire chain? Starting from the beginning? If I were to do this I would start with the genesis block, then what? I would hash the block then look for the block that contained the hash of that in it’s ‘previous block hash’, or had the next block in the timestamp?

1 Like

You could use any block explorer to expedite that process. If you’re asking how a block explorer works specifically, check out the response to a similar question here:

2 Likes

Excellent, thank you!

Just to summarise for anyone reading the thread, from the link provided:

there is a blkindex.dat which contains an index of the block files and transactions that can be found in all the blk000n.dat files. Block data is stored in theblk000n.dat where the n is the number of the block.

Thanks again :slight_smile:

1 Like