You are viewing a single comment's thread from:

RE: BLOCKCHAIN FOR DUMMIES - what would be your explanation? [question from my recent interview]

in Project HOPE4 months ago

I think blockchain is best explained as archive room full of binders... Each binder might contain special index papers that are used as synchronization points, and the remaining papers are blocks. One can print only certain amount of text in one paper and that is the limit of transactions that can be added to a block in blockchain... Because each binder can hold only certain amount of papers, one can think that each binder is amount of blocks that the machine can process before moving the blocks to archive. First paper in each binder has information about the previous binder. More than one binder can refer to same "previous" binder, these are called alternate chains. Alternate chain can be as short as one block, but can also be as long as one binder.

Synchronization points are used in some cryptocurrencies to store metadata about blockchain that does span multiple blocks like fork heights.

Fork height is place in the binder where there is more than one binder to continue, there is almost always one preferred route to continue and the remaining routes are alternate chains.

Most blockchains can be only traversed from highest numbered block down to lowest numbered block as there is no pointer from one binder to next binder with block having next consecutive number, only the other way around.

For a daemon to be able to sync from first block to most recent block, it needs to know something about the synchronization points. First thing it does ask from other daemon is the block at synchronization point, and then the information about the very first block. All daemons have hardcoded information about the very first block and that can be compared.

Every time daemon starts syncing after the previous synchronization point, it compares the information of current synchronization point and the next synchronization point, if the current doesn't match, the chain has split and daemon needs to download the blocks one by one and figure out first block that is different. If the next synchronization point has inconsistencies, the daemon compares the version number to see if an upgrade is required.

Between two synchronization points, blocks can be downloaded in random order, but they can be only verified if all previous blocks have already been downloaded.

Each chain has counter that counts how much effort was put on the chain and the chain that has highest effort (also called cumulative difficulty) will become primary chain and the remaining ones will be alternate chains.

Any chain where the effort counter is invalid or one of the blocks can't be verified, is either truncated or discarded.

Sort:  
 4 months ago 

Love your explanation @mtl1979 :)

Big thx for taking the time to drop this comment

As a coin developer I have studied a lot about internals of the synchronization process... Proof-of-Stake and Proof-of-Work coins synchronize little differently, but the main idea is same.

When I was writing code for my own coin, the biggest surprise was that everything is done backwards... There was no functions to get information about first block of chain leaf except the genesis block, which is actually stored separately.

One of the first things I did do was add functions to get the first block of chain leaf. First block was actually easy to fetch as the daemon stores them in numerical order within each chain leaf.