<p>The blockhash is a hash that includes the previousblockhash as input.</p>

<p>Suppose you are trying to change the data in block 9000. You modify it the way you like and then successfully mine the modified block (find a hash that meets the difficulty threshold at that height). You now have a block 9000 with a new hash, so block 9001 has the wrong value in previousblockhash.</p>

<p>Your theory is that you can simply update the previousblockhash in block 9001, but since that field is part of the input to the hash of block 9001 modifying it changes the blockhash. Now you need to successfully mine block 9001 with the modification and once you do, block 9002 will need to be modified to have a new previousblockhash referring to the new blockhash for block 9001 and then it will need to be mined as well, and so-on, and so-on.</p>

CC BY-SA 3.0
2018-01-21T19:03:51.953Z
Oh, thanks for this simple explanation. So, if i mine  block 9001 hash of this block will change?
umaru
CC BY-SA 3.0
2018-01-21T18:56:03.463Z
2018-01-21T18:56:03.463Z
Paul
<p>Each block is identified by the hash of its header. The block header is composed of six parts, one of which is the hash of the previous block. When even one bit of a cryptographic hash function's input is changed, the result of the hash function changes completely unpredictably. </p>

<p>Therefore, as you said, when you "change the data in block № 9000, then block № 9001 will refer to a nonexisten block". But when you change the reference in № 9001 to point to your modified № 9000, the modified № 9001 will no longer match the reference in № 9002! Hence, you will need to amend every single block since № 9000 onward to modify № 9000.</p>

<p>Additionally, the new block header resulting from your modifications will no longer fulfill the difficulty requirement! That means, that you would not only need to amend all blocks from № 9000 onward, but for every single block generate new proof of work to find block candidates that fulfill the difficulty!</p>

<p>In conclusion, to modify № 9000 you have to redo all the network's work since that block, and be able to do it sufficiently faster to overtake the network's established chaintip in order to get your modification accepted by the network.</p>

CC BY-SA 3.0
2018-01-21T19:41:51.947Z
2018-01-21T19:41:51.947Z
Murch
<p>The other answers are correct. But visuals can be easier to follow. </p>

<p>This is the best video that I've seen that shows how hashing and proof of work is used to secure the blockchain. </p>

<p><a href="https://anders.com/blockchain/?ref=producthunt" rel="nofollow noreferrer">https://anders.com/blockchain/?ref=producthunt</a></p>

CC BY-SA 3.0
2018-01-24T14:44:12.027Z
2018-01-24T14:44:12.027Z
nanonerd
<p>Maybe my question is stupid, but, why you need to rehash each block after a changed block when changing data in a blockchain? </p>

<p>Each block contains a hash of its data and hash of previous block. If I change the data in block № 9000, then block № 9001 will refer to a nonexistent block. The Chain will be broken. Every article that I read says something like:</p>

<blockquote>
  <p>To make this work, you will need to rebuild and rehash each block
  following the tampered block, replacing the contents of the
  previous-block-hash pointers.</p>
</blockquote>

<p>But, if block contains only hash of previous block, why can't I just change the previous' block hash value in block № 9001 if I change data in block № 9000? Wouldn't that restore the chain?</p>

<blockchain><hash><proof-of-work><chain-reorganization>
Why you need to rehash each block after a changed block when changing data in a blockchain?
umaru
# Why you need to rehash each block after a changed block when changing data in a blockchain?

(Asked by: username_0 on 2018-01-21)

Maybe my question is stupid, but, why you need to rehash each block after a changed block when changing data in a blockchain?

Each block contains a hash of its data and hash of previous block. If I change the data in block № 9000, then block № 9001 will refer to a nonexistent block. The Chain will be broken. Every article that I read says something like:

> To make this work, you will need to rebuild and rehash each block
> following the tampered block, replacing the contents of the
> previous-block-hash pointers.

But, if block contains only hash of previous block, why can't I just change the previous' block hash value in block № 9001 if I change data in block № 9000? Wouldn't that restore the chain?

**Tags:** blockchain, hash, proof-of-work, chain-reorganization


---

## 3 answers

### Answer by username_1 on 2018-01-21. Score: 2 | Accepted answer

The blockhash is a hash that includes the previousblockhash as input.

Suppose you are trying to change the data in block 9000. You modify it the way you like and then successfully mine the modified block (find a hash that meets the difficulty threshold at that height). You now have a block 9000 with a new hash, so block 9001 has the wrong value in previousblockhash.

Your theory is that you can simply update the previousblockhash in block 9001, but since that field is part of the input to the hash of block 9001 modifying it changes the blockhash. Now you need to successfully mine block 9001 with the modification and once you do, block 9002 will need to be modified to have a new previousblockhash referring to the new blockhash for block 9001 and then it will need to be mined as well, and so-on, and so-on.

> **Comments:**
> **username_0**: Oh, thanks for this simple explanation. So, if i mine  block 9001 hash of this block will change?  

---

### Answer by username_2 on 2018-01-21. Score: 1

Each block is identified by the hash of its header. The block header is composed of six parts, one of which is the hash of the previous block. When even one bit of a cryptographic hash function's input is changed, the result of the hash function changes completely unpredictably.

Therefore, as you said, when you "change the data in block № 9000, then block № 9001 will refer to a nonexisten block". But when you change the reference in № 9001 to point to your modified № 9000, the modified № 9001 will no longer match the reference in № 9002! Hence, you will need to amend every single block since № 9000 onward to modify № 9000.

Additionally, the new block header resulting from your modifications will no longer fulfill the difficulty requirement! That means, that you would not only need to amend all blocks from № 9000 onward, but for every single block generate new proof of work to find block candidates that fulfill the difficulty!

In conclusion, to modify № 9000 you have to redo all the network's work since that block, and be able to do it sufficiently faster to overtake the network's established chaintip in order to get your modification accepted by the network.


---

### Answer by username_3 on 2018-01-24. Score: 0

The other answers are correct. But visuals can be easier to follow.

This is the best video that I've seen that shows how hashing and proof of work is used to secure the blockchain.

<https://anders.com/blockchain/?ref=producthunt>


---

