0

I'm thinking (probably erroneously) along the lines of a linked list and C pointers, but how would one follow the block chain from some block all the way back to the genesis block? The previous block's hash is the "pointer", but in a C program (say), given any block how would the previous block be accessed?

1

The "blockchain" is a conceptual structure that is not directly represented in a program. If you were writing a program to work with the blockchain, you get to choose how you would implement it in a data structure.

  • If your data structure is a linked list, you would follow the back link pointer to the previous block
  • If your data structure is a hash table, you would look up the previous block hash in your table to find the previous block
  • If your data structure is an array, you would look in the previous array slot to find the previous block

As you can see, there are many possible choices one could make when representing the blockchain in memory. This is further complicated by the fact that the blockchain is probably too big to load into memory all at once, so you would probably need to involve some kind of on-disk storage too (a database perhaps).

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.