1

I am wondering how hash pointers are implemented in reality. Currently, I am reading this article about hash pointers. According to this website a hash pointer allows both to request data and to verify its integrity. The following picture is supposed to illustrate the basic structure of a blockchainenter image description here

Obviously, the input of the hash function is the pointer to some data in memory. At the same time the hash is supposed to be the hash of the stored data. How is this possible? I can't imagine to interpret hashes of data as addresses.

  • I'm not sure you are asking the exact same thing, but I think this question is close: bitcoin.stackexchange.com/questions/44213/… – Jestin Nov 20 '17 at 14:50
  • I've already read this question, but unfortunately it does not answer my question. There is no hint how pointers, hashes and data correlate. How can the hash of arbitrary data used as pointers? – null Nov 20 '17 at 14:52
1

The hashes are not of addresses, they are of blocks. The "hash pointers" (in the blockchain, those are just hashes written into the header of a block, it doesn't actually point to anything) are the hash of the block that precedes the block that the hash is in.

1

The term "pointer" may not be the best in this case, since people tend to think that means "pointer to memory address". It does not. Here, the term "pointer" is being used in the data structure sense, not the variable primitive.

A better term might be key, such as a unique identifier in a database. That actually is what is meant when people refer to a hash pointer. The hash is an identifier that can be used to uniquely select a transaction in a database.

1

Obviously, the input of the hash function is the pointer to some data in memory.

No.

Each block consists of header (80 bytes) and body (transactions).

Hash function hashes 80 bytes input giving 32 bytes output.

The input of the hash function of block N is the entire header of block N-1 (80 bytes). These 80 bytes are hashed and the resulting hash (of size 32 bytes) is stored in the block N header (filling the part of its 80bytes).

The hash of N-1 header in block N header proves (provides integrity) the position of block N: that it comes behind block N-1 in the blockchain.


Note there is another hashing process happening in each block, hashing of block's transactions producing so called Merkle root that is also placed in the header and provides integrity of block's transactions.

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.