Lesson 0: How does broken chain get detected #201
-
I get that blockchain is immutable bc rewriting data in an old block will invalidate the hashes in subsequent blocks. So if, on my node, I remine say the genesis block and leave the others untouched (with their old hashes), how does that ever get found - eg how does the consensus algorithm know my chain is broken since only the last block is being compared? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Great question! The answer is in decentrality. First off, it's take a lot of computing power to rehash the entire blockchain, that's part of it's beauty right there, but second of all, every other blockchain node will have a different blockchain from you, you'll be clearly the odd one out since none of your hashes match! |
Beta Was this translation helpful? Give feedback.
-
I understand that if I change on an old block - say block 1 - my hash on
block 1 would change and if anyone tried revalidating all subsequent blocks
in my version, they wouldn't match other people's chains and would differ
from consensus.
But what if I *didnt* rehash the whole blockchain - in my corrupted node,
if I simply rehashed block 1, and continued to present the existing block
hashes for blocks after block 1, how would anybody know unless they walked
my hashes all the way back to block 1 and saw a broken chain? When a new
block is validated does it walk through all the prior blocks to make sure
the chain leads back to the genesis block?
Or is it that part of the blockchain client apis that when transactions are
fetched from a node, the block gets revalidated to make sure the hash of
the blockno+nonce+data+prev hash actually matches what is saved and that it
points to a valid predecessor and descendant block?
I saw something online about merkle trees but not sure if that is the same
concept used to deal with this.
…On Fri, Oct 15, 2021 at 11:43 AM Patrick Collins ***@***.***> wrote:
Great question! The answer is in decentrality.
First off, it's take a *lot* of computing power to rehash the entire
blockchain, that's part of it's beauty right there, but second of all,
every other blockchain node will have a different blockchain from you,
you'll be clearly the odd one out since none of your hashes match!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#201 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AUBWK6CFCKQODF3O5N6T2CDUHBD3NANCNFSM5GCEVO2Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Beta Was this translation helpful? Give feedback.
-
I get that the blockchain would be invalid since block 2 would point to the
old hash.
I guess what I’m wondering is how a 3rd party could quickly know that the
chain was invalid without walking through every block from head to genesis
and validating the hashes and pointers to prior block.
As I understand it, clients connect to nodes to fetch transaction history
so it would seem that there would need to be a fast way to know the nodes
entire chain was valid other than revalidating each block?
On Mon, Oct 18, 2021 at 11:18 AM Patrick Collins ***@***.***> wrote:
If you didn't rehash the whole blockchain, your blockchain would be in an
invalid state. Each block points to the hash of the previous block. So if
you rehashed block 1, block 2 would still point to the old block 1. You'd
have to rehash block 2 to point to the new hash of block 1. Then rehash
block 3 to point to the new block 2, and so on.
Don't worry about merkle trees for this concept.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#201 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AUBWK6EOLXZCN2NIZKSKHR3UHQ3CXANCNFSM5GCEVO2Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
--
Sundeep Amrute
CEO, Long Ledge Ventures LLC
***@***.***
+1.646.643.9224
|
Beta Was this translation helpful? Give feedback.
Great question! The answer is in decentrality.
First off, it's take a lot of computing power to rehash the entire blockchain, that's part of it's beauty right there, but second of all, every other blockchain node will have a different blockchain from you, you'll be clearly the odd one out since none of your hashes match!