Blockchain is a fancy word, and not many people understand it. If you want to explain this to your GF/partner, what would be the most simple way?
Right, blocks are chained in one way, as time goes on, in particular for STEEM blockchain, every 3 seconds, we append a new block to the end of the current chain. So the chain goes longer and longer each day.
We need a way to tell if the current block can be attached (we can’t just produce a random block and force appending it). For each block, we will have a unique block ID, and we will have a previous field that match the previous Block ID. The first block on steem blockchain has previous
set to 0000000000000000000000000000000000000000.
Run this in SteemJS
1 | const blockNum = 1; |
You will see the block_id and previous value of the first block.
1 | {"previous":"0000000000000000000000000000000000000000","timestamp":"2016-03-24T16:05:00","witness":"initminer","transaction_merkle_root":"0000000000000000000000000000000000000000","extensions":[],"witness_signature":"204f8ad56a8f5cf722a02b035a61b500aa59b9519b2c33c77a80c0a714680a5a5a7a340d909d19996613c5e4ae92146b9add8a7a663eef37d837ef881477313043","transactions":[],"block_id":"0000000109833ce528d5bbfb3f6225b39ee10086","signing_key":"STM8GC13uCZbP44HzMLV6zPZGwVQ8Nt4Kji8PapsPiNq1BK153XTX","transaction_ids":[]} |
And the second block gives:
1 | {"previous":"0000000109833ce528d5bbfb3f6225b39ee10086","timestamp":"2016-03-24T16:05:36","witness":"initminer","transaction_merkle_root":"0000000000000000000000000000000000000000","extensions":[],"witness_signature":"1f3e85ab301a600f391f11e859240f090a9404f8ebf0bf98df58eb17f455156e2d16e1dcfc621acb3a7acbedc86b6d2560fdd87ce5709e80fa333a2bbb92966df3","transactions":[],"block_id":"00000002ed04e3c3def0238f693931ee7eebbdf1","signing_key":"STM8GC13uCZbP44HzMLV6zPZGwVQ8Nt4Kji8PapsPiNq1BK153XTX","transaction_ids":[]} |
As you can see, the previous value is the same as the block_id for the Block 1. This goes on and on. Let’s print the first 10 blocks’ previous and block_id:
Run the Code in SteemJS
1 | function getBlock(blockNum) { |
And you will see the rule applies. In fact, this is the fundamental rule of the blockchain - the rule to chain the blocks.
1 | {"block":1,"previous":"0000000000000000000000000000000000000000","block_id":"0000000109833ce528d5bbfb3f6225b39ee10086"} |
Steem Blockchain is a public database. Every 3 seconds, one witness helps to package operations (comment, vote, transfer etc) into a block, seal it with the signing key, and finally push to the chain for a small reward.
As the blockchain gets bigger and bigger, it takes enormous efforts to alter the chain, as you will need to modify every prior blocks.
Every little helps! I hope this helps!
Steem On!~
Reposted to Blog
If you like my work, please consider voting for me, thanks!
https://steemit.com/~witnesses type in justyy and click VOTE
Alternatively, you could proxy to me if you are too lazy to vote!
Also: you can vote me at the tool I made: https://steemyy.com/witness-voting/?witness=justyy
Visit me at: https://steemyy.com
This page is synchronized from the post: ‘Illustrating the Blockchain via SteemJs - Blocks are Chained’