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

in #bitcoin7 years ago

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

Sort:  

I find your post quite educative and at the same time easy enough to understand for a lay person. Thanks for explaining the meaning of a hash and a nonce, and the role they have in the block hashing process.

Do you know of a good site that explains how POS hashing works?

Thank you.

100% agree, this is a very educational post with explanations available to anyone a simple and entertaining way to explain the BLOCKCHAINS

Many of you may have heard about Proof of Stake, specifically that Ethereum is moving toward a hybrid model using Proof of Stake and Proof of Work.

But of course, the same lot of you probably asked, “What the heck is Proof of Stake really?” Let’s dive into that.

There are, currently, two main Blockchain systems that the larger crypto-networks utilize:

Proof of Work
Proof of Stake
Both of these Blockchain systems govern how transactions are verified on the decentralized network.
@ebargains Try this link for more information:
https://medium.com/@robertgreenfieldiv/explaining-proof-of-stake-f1eae6feb26f
https://talk.peercoin.net/t/pos-how-does-it-really-work-long-and-maybe-confusing-thread-incoming/648
https://bitcoin.stackexchange.com/questions/52321/how-is-a-proof-of-stake-block-mined-at-the-block-level-and-how-does-it-accompli
https://steemit.com/bitcoin/@mooncryption/guide-proof-of-work-pow-vs-proof-of-stake-pos-vs-delegated-proof-of-stake-dpos
I hope you find that information with these links are very interesting
regards

I like your profile pic....

Your Wellcome

Very informative as well! Thanks!

@mech820I always like to collaborate and help others

different POS have different mechanisms. are you looking for dPOS like steem?

How do you get 19$ for comments and I can even get a penny for upvotes? I have only made 2 cents so far commenting and upvoting plus investing in 240$ of SP . Still trying to figure out how I can make money. still not happening.

Its not just about making money here. Its about contibuting to the free sorce of information and contact. Earning anything would be a bonus.

Hashing and data structures.

A data structure is a specialized way of storing data. There are two data structure properties that are critical if you want to understand how a blockchain works. They are pointers

Pointers are variables in programming which stores the address of another variable. Usually normal variables in any programming language stores data.

Eg. int a = 10, means that there is a variable “a” which stores integer values. In this case, it is storing an integer value which is 10. This is a normal variable.

Pointers, however, instead of storing values will store addresses of other variables. Which is why they are called pointers, because they are literally pointing towards the location of other variables.

Anda membuat posting yang menakjubkan! Upvoted dari @antobrampu. Aku mengikutimu. Tolong ikuti saya dan upvote atau beri komentar di pos saya. Aku akan melakukan hal yang sama padamu. Bersama-sama kita tumbuh!

It was always very difficult for me to understand the meaning of all these widely used terms. But you simplified it by so easily demonstrating their functionality and association with the actual data input and screenshots, that it became crystal clear to grasp for me now.

One thing I wanna know: Does Nonce need to be calculated by hit and trial or is there some rule to find it? Is it this calculation of "Nonce", where all PoW computing (or hashing) power gets consumed?

good question. finding the nonce is completely random. and yes, the more hash rate you have i.e. mining hardware, the more likely you will find the nonce and will consume more power.

Are you a self learner? What is the resources are you using currently?

Anda membuat posting yang menakjubkan! Upvoted dari @antobrampu. Aku mengikutimu. Tolong ikuti saya dan upvote atau beri komentar di pos saya. Aku akan melakukan hal yang sama padamu. Bersama-sama kita tumbuh!

Thanks for giving new information to all us.

Epic post Thanks for sharing this information

Oh, that's really nice. Being a non-tech person, I never understood those concepts.

But you've actually made it so easy. But to get hands on experience, I should use the mentioned website.

Thanks for the resource and making it this simple.

You got a 29.08% upvote from @postpromoter courtesy of @ddangerwu!

Want to promote your posts too? Check out the Steem Bot Tracker website for more info. If you would like to support the development of @postpromoter and the bot tracker please vote for @yabapmatt for witness!

You made an amazing post ! Upvoted from @antobrampu. I followed you. Please Follow me and upvote or give a comment on my post. I will do the same to you. Together we grow !

One hour a day for forty days?

I don't want to discourage you, but the total of 40 hours is just not enough of time to do it. I would double it at least. You wouldn't regret doing 2hr/day, I can promise you that.

Just look what awaits you after your 40 days preparation:

Finite Fields
Elliptic Curves
Elliptic Curve Cryptography
Signing/Verifying Messages
Parsing Transactions
Signing Transactions
Creating Transactions
Script parsing and processing
Address construction/Private Key WIF Format Construction
Parsing Blocks
Validating Proof-of-Work
Difficulty Calculations
Merkle Tree Construction
Merkle Proofs
Network Message Parsing
Segwit

Those are some advanced topics that will make your head spin. Don't sabotage yourself with 1hr/day of preparation.

Anyhow, I'll follow your progress. Good luck!

Coin Marketplace

STEEM 0.22
TRX 0.27
JST 0.041
BTC 104664.06
ETH 3858.84
SBD 3.32