Learn by Interacting with Hash, Blocks, and Blockchain + get 100SP delegated for insightful comments

Hi all,

Two week ago, I started my journey of learning to program on btc. See https://steemit.com/bitcoin/@ddangerwu/from-noob-to-proficient-how-you-can-program-on-blockchains-in-40-days for details.

BLOCKCHAIN1.png

I've stumbled upon a website that allows you to play with the relationships between Hash, and Blocks, Blockchain. see https://anders.com/blockchain/hash.html and you can also cycle through the tabs on the top right. Disclaimer: I did not make the website nor am I affiliated with it. I do think it is a great tool for helping to understand basic blockchain concepts though.

So, after playing around with it for a while, I have made some notes for myself in understanding these concepts and I'd like to share with you guys on my findings.

HASH

Screen Shot 2018-02-24 at 5.51.58 PM.png

What is it: it's a fingerprint of some digital data. As you can see, I've changed the words "Hello Steemit" into a series of gibberish starting with B016.... That gibberish is the SHA256 hash of "Hello Steemit".

Screen Shot 2018-02-24 at 5.59.26 PM.png

Now that I've changed the data, you can see the hash has also changed as well. Notice that the hash is always 64 characters long

BLOCK

Screen Shot 2018-02-24 at 6.07.16 PM.png

What is it: a block is hash that follows a certain rule or "fits" the algorithm. You notice that the background is currently red. That's because my data of "please resteem" does not currently fit the rule. What is the rule? Let's arbitrarily set it as the first 4 characters of the hash must start with 0000. You may have whatever rule you want in your algorithm, this is the rule for SHA256.

Screen Shot 2018-02-24 at 6.14.37 PM.png

If I want to force the data of "please resteem" to start with the hash of 0000... then I need to try many variations of hashing. This process of trying all variations is called "mining" and I've found that the NONCE 12175 helps me fit the rule and now the background is green. You can think of NONCE as guidelines or "key" as to how to hash the data to follow the rules.

BLOCKCHAIN

Screen Shot 2018-02-24 at 6.22.08 PM.png

What is it: it's a series of blocks all following the rule and each block verifies the previous block. Notice that all blocks have green backgrounds right now. This is because they all follow the rule of the hash starting with 0000. Their nonces are different because each block takes the hash of the last block and combines the new data within the block to calculate a new nonce.

Screen Shot 2018-02-24 at 6.30.30 PM.png

I've changed the data in block #1 from empty to "also, comment something insightful to win 100SP delegation!". I mined/found the nonce to make it follow the rule. Now block #2 and #3 are red because their respective nonces no longer allows them to follow the rule.

Screen Shot 2018-02-24 at 6.32.24 PM.png

Now I've found the nonce for block #2 which is 145

Screen Shot 2018-02-24 at 6.33.18 PM.png

Now I've found the nonce for block #3 which is 101148

Screen Shot 2018-02-24 at 6.35.24 PM.png

I've changed the data on block #2 from empty to "upvote if you want more~". Notice that block #1 is still green/following the rule and unaffected. but block #3 has also turned red because it's hash depends on the hash of block #2. Since I changed the data in block #2, the previous nonce for block #2 no longer works/follows the rule. You'd need to calculate the new nonce given the data change.

In conclusion: blockchain is secure because if you change any middle block's data, you'd cause every subsequent block to be invalidated. This is how we can be sure everything is tamper-proof just by verifying the latest block.

I will be making a video explaining the next few tabs of "distributed, token and coinbase" Please stay tuned.

-Dan


Now that you've read the post, what did you think? I want to do my part to fight spam and promote insightful comments/discussions. I read every comment and value your feedback. Write something and I will pick the most insightful comment to delegate 100 Steem Power to you for a week.

You may earn curation awards using my STEEM manually OR use a service like SmartSteem to vote automatically for you. Just click "sell your votes" button, log-in/authorize and you are set~

Here is last post's winner:Screen Shot 2018-02-24 at 6.44.36 PM.png

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center