<p>A hash is the output of a hash function, which is a one-way functions, where knowing the output doesn't help figure out what the input was. They can sometimes serve as short, unique, identifiers for the data that was passed into the function, in order to reference that data. <strong>Hash pointers are just hashes that are used to reference another piece of known information.</strong></p>

<p>In bitcoin's case, one place where hash pointers are used is in the the 80 byte block header. The block header is hashed to produce a block ID. You can see this ID on any block explorer. See <a href="https://blockchain.info/block/0000000000000000005f8a8de1f258c7014952ffbfb4ec09e419fc216133cd4b" rel="nofollow">this</a> for example. In the upper right side of that page there is also a link for the "Previous Block", which is a hash, and it is a hash that points to the block that has that ID. </p>

<p>Bitcoin also uses hashes to reference funds supplied in previous transactions. So, if you want to make a transaction giving some bitcoins to someone, you have to reference (with a hash pointer) the transaction where you were given some funds.</p>

CC BY-SA 3.0
2016-05-20T18:18:21.310Z
2016-05-20T18:26:28.557Z
2016-05-20T18:26:28.557Z
morsecoder
<p>A hash pointer is a pointer that also has a hash of what it points to. You use the pointer to get to the next block, and the hash to check if it has been changed is some way. If you are familiar with C, then think of it as s Structure, that contains two objects, a pointer, and a hash. </p>

<p>Also the block chain is a linked list, but instead of using normal pointers, it uses hash pointer which give you the ability to check if anything has been changed. (a regular pointer does not, since it's only a memory address.)</p>

<p><a href="http://learningspot.altervista.org/hash-pointers-and-data-structures/" rel="nofollow noreferrer">http://learningspot.altervista.org/hash-pointers-and-data-structures/</a></p>

<p><a href="https://www.youtube.com/watch?v=fOMVZXLjKYo" rel="nofollow noreferrer">https://www.youtube.com/watch?v=fOMVZXLjKYo</a></p>

CC BY-SA 3.0
2017-09-29T19:02:57.353Z
2017-09-29T19:10:01.967Z
2017-09-29T19:10:01.967Z
Manny_Mar
<p><a href="https://www.coursera.org/learn/cryptocurrency/lecture/EYEAo/hash-pointers-and-data-structures" rel="nofollow noreferrer">https://www.coursera.org/learn/cryptocurrency/lecture/EYEAo/hash-pointers-and-data-structures</a>
The above link has more info about Hash pointers in cryptocurrency data structures</p>

CC BY-SA 3.0
2017-09-07T14:47:00.470Z
Thanks for the answer, and welcome to Bitcoin SE!  Just so you know, link-only answers are frowned upon here.  Even if the topic is better explained elsewhere, it's best to give a summary of the links you post.  Usually just enough to answer the initial question, and then you can link to a more detailed explanation.  "Click here" answers like this are often downvoted or deleted as "low quality" or "spam".  Adding just a sentence or two could make this a much better answer.
Jestin
CC BY-SA 3.0
2017-09-06T11:45:33.393Z
2017-09-06T11:45:33.393Z
user59366
<p>I believe that the use of the term "pointer" in the this sentence is not referring to the low-level data type, such as <code>int *pointer_to_int;</code> would be in C.  I think it's more referring to a "pointer" as a key into a <a href="https://en.wikipedia.org/wiki/Hash_table" rel="noreferrer">data structure</a> or database table.  In this sense, the hash <em>is</em> a pointer/key used to retrieve the information you are looking for.</p>

<p>For example, in Bitcoin, transaction hashes are used in this way.  The hash of a transaction can both be used to look up the transaction <em>and</em> to verify that the transaction retrieved has not been tampered with since it was stored.</p>

CC BY-SA 3.0
2016-05-20T18:45:05.243Z
Please explain how the hash/key is used to retrieve the information you are looking for. My understanding is that hash can be used to compare the integrity of data like if a given hash matches the computed hash of the data then the data is known to be untampered. Please throw more light on how hash can act as a key? How would you retrieve the value it points to given only the hash? THanks
user2065276
CC BY-SA 3.0
2016-05-20T18:47:26.273Z
@user2065276 you have to have a database built that uses that key already. In bitcoin, the full nodes on the network keep a database of blocks and of transaction (outputs), so they can use the hash pointers in later blocks in transactions to lookup the previous blocks/transactions.
morsecoder
CC BY-SA 3.0
2016-05-20T19:46:20.503Z
This of a table in the database, where each record has an ID field.  Instead of using an integer value like `563`, you use a hash value like `4b58bf2fdc528a32db8c82406958af828a313e162de13fe14a089f2e6a56140f`.  Now they ID you use to look up that record in the database can also verify that the record has not changed.
Jestin
CC BY-SA 3.0
2016-05-20T18:17:07.893Z
2016-05-20T18:17:07.893Z
Jestin
<p>I am doing coursera online course on Bitcoin and Cryptocurrency Technologies. It defines the concept of hash pointer in the first lecture as <code>pointer to where some information is store and cryptographic hash of that information</code>. I am confused on what is the difference between hash and hash pointer. I understand hashing of the information but how can a pointer store both the hash of the information and the address of where the information is? Please correct me if i am wrong.</p>

<p>Can someone explain the difference, how each is calculated and then give an example. </p>

CC BY-SA 3.0
2016-05-20T18:14:40.693Z
Is this in reference to actual code within bitcoin core? As in, are you talking about hash pointers within code? See https://en.wikipedia.org/wiki/Pointer_(computer_programming)? Or are you talking about when a block references the previous block with a hash pointer?
morsecoder
<blockchain><hash>
hash versus hash pointer
user2065276
# hash versus hash pointer

(Asked by: username_0 on 2016-05-20)

I am doing coursera online course on Bitcoin and Cryptocurrency Technologies. It defines the concept of hash pointer in the first lecture as `pointer to where some information is store and cryptographic hash of that information`. I am confused on what is the difference between hash and hash pointer. I understand hashing of the information but how can a pointer store both the hash of the information and the address of where the information is? Please correct me if i am wrong.

Can someone explain the difference, how each is calculated and then give an example.

**Tags:** blockchain, hash

> **Comments:**
> **username_1**: Is this in reference to actual code within bitcoin core? As in, are you talking about hash pointers within code? See https://en.wikipedia.org/wiki/Pointer_(computer_programming)? Or are you talking about when a block references the previous block with a hash pointer?  

---

## 4 answers

### Answer by username_4 on 2016-05-20. Score: 13 | Accepted answer

I believe that the use of the term "pointer" in the this sentence is not referring to the low-level data type, such as `int *pointer_to_int;` would be in C. I think it's more referring to a "pointer" as a key into a [data structure](https://en.wikipedia.org/wiki/Hash_table) or database table. In this sense, the hash *is* a pointer/key used to retrieve the information you are looking for.

For example, in Bitcoin, transaction hashes are used in this way. The hash of a transaction can both be used to look up the transaction *and* to verify that the transaction retrieved has not been tampered with since it was stored.

> **Comments:**
> **username_0**: Please explain how the hash/key is used to retrieve the information you are looking for. My understanding is that hash can be used to compare the integrity of data like if a given hash matches the computed hash of the data then the data is known to be untampered. Please throw more light on how hash can act as a key? How would you retrieve the value it points to given only the hash? THanks  
> **username_1**: @username_0 you have to have a database built that uses that key already. In bitcoin, the full nodes on the network keep a database of blocks and of transaction (outputs), so they can use the hash pointers in later blocks in transactions to lookup the previous blocks/transactions.  
> **username_4**: This of a table in the database, where each record has an ID field.  Instead of using an integer value like `563`, you use a hash value like `4b58bf2fdc528a32db8c82406958af828a313e162de13fe14a089f2e6a56140f`.  Now they ID you use to look up that record in the database can also verify that the record has not changed.  

---

### Answer by username_1 on 2016-05-20. Score: 2

A hash is the output of a hash function, which is a one-way functions, where knowing the output doesn't help figure out what the input was. They can sometimes serve as short, unique, identifiers for the data that was passed into the function, in order to reference that data. **Hash pointers are just hashes that are used to reference another piece of known information.**

In bitcoin's case, one place where hash pointers are used is in the the 80 byte block header. The block header is hashed to produce a block ID. You can see this ID on any block explorer. See [this](https://blockchain.info/block/0000000000000000005f8a8de1f258c7014952ffbfb4ec09e419fc216133cd4b) for example. In the upper right side of that page there is also a link for the "Previous Block", which is a hash, and it is a hash that points to the block that has that ID.

Bitcoin also uses hashes to reference funds supplied in previous transactions. So, if you want to make a transaction giving some bitcoins to someone, you have to reference (with a hash pointer) the transaction where you were given some funds.


---

### Answer by username_2 on 2017-09-29. Score: 1

A hash pointer is a pointer that also has a hash of what it points to. You use the pointer to get to the next block, and the hash to check if it has been changed is some way. If you are familiar with C, then think of it as s Structure, that contains two objects, a pointer, and a hash.

Also the block chain is a linked list, but instead of using normal pointers, it uses hash pointer which give you the ability to check if anything has been changed. (a regular pointer does not, since it's only a memory address.)

<http://learningspot.altervista.org/hash-pointers-and-data-structures/>

<https://www.youtube.com/watch?v=fOMVZXLjKYo>


---

### Answer by username_3 on 2017-09-06. Score: 1

<https://www.coursera.org/learn/cryptocurrency/lecture/EYEAo/hash-pointers-and-data-structures>
The above link has more info about Hash pointers in cryptocurrency data structures

> **Comments:**
> **username_4**: Thanks for the answer, and welcome to Bitcoin SE!  Just so you know, link-only answers are frowned upon here.  Even if the topic is better explained elsewhere, it's best to give a summary of the links you post.  Usually just enough to answer the initial question, and then you can link to a more detailed explanation.  "Click here" answers like this are often downvoted or deleted as "low quality" or "spam".  Adding just a sentence or two could make this a much better answer.  

---

