How Does a Blockchain Work

in #blockchain7 years ago (edited)

3277336_M.png

We all hear the word blockchain everywhere and truth be told most of us don't know how a blockchain works.
So I have decided to explain how blockchain technology works in the simplest way possible.

What Is A Blockchain?

A Blockchain can be described as a decentralized ledger that stores data in a continuously growing list of records or blocks.

What Is A Block?

3137150_L.jpg
To understand what a block is we first have to understand the main components of a block.
A block has 3 main components:

  1. The Data Of The Block: The Data of the block depends on the type of blockchain, For Eg: The Bitcoin blockchain stores transaction details in each block and on average there are more than 500 transaction details stored on each block and each block in the Bitcoin Blockchain is roughly around 1MB in size.
  2. The Hash Of The Block: The Hash of the block is like the fingerprint of the block, Its unique to a block and it identifies a block and its contents.
    The awesome part about this is that a small change in data will change the entire hash of the block
    For example:
    The SHA-256 hash of the word sage is
    7e5d4325a44714fc86a9b6989e41e966a7297bfe7e913c15fb9ab19588e33d61
    Now if I misspelled sage as sagr then this is the SHA-256 hash that I will get is
    80807ee2197f32e7f18f729ac4f2ad2e44dc307ad271c9cbf0150993776152ca
    So a small change in data will cause the hash of the block to change and the block is no longer the same.
    3.The Hash Of Previous Block: The hash of the previous block is what links all the blocks together and it functions as a security feature in the Blockchain.

When some data in a block has been changed it will cause all the following blocks to be invalid as they no longer contain a valid hash of the previous block.
But this is not enough to secure the Blockchain...

So something called proof of work is used to secure the network.

What Is Proof Of Work?

Proof of work was first suggested by Cynthia dwork and Moni Naor in 1993 to reduce DDoS attacks and spamming on a network.

Proof of work requires a user to solve a moderately difficult hash to get access to a shared resource.

Proof Of Work In The Bitcoin Blockchain.

Bitcoin uses the Hashcash proof of work system to secure the network and also to prevent Double Spending
The proof of work on the network slows down the creation of new blocks, Each new block is created in a 10-minute time gap.
And the difficulty of the proof of work increases with 2000 blocks mined.

How Secure Is A Blockchain?

A blockchain has a high level of security as it uses hashing and proof of work mechanisms to prevent block tampering.
A Blockchain being a distributed p2p network also helps increase the security of the Blockchain
i.e. When someone joins the network he will receive a full copy of the blockchain.

So let's say Bob has joined the network,
He will receive the whole copy of the blockchain and he can now create blocks and earn the block rewards.
After Bob has created a block every single node on the network gets the new block and the nodes then verify the block, If everything is ok the nodes then add the block to their own copy of the blockchain.

Bob The Evil Genius

Okay, let's say that Bob wants to tamper with a block.
So first Bob has to tamper with a block and the following blocks.
After that Bob has to redo the proof of work for everyone single block and also take control of at least 51% of the network and if he can't get control of the majority of the network the other nodes will reject the blocks tampered by Bob.
This attack could happen if all the major bitcoin mining pools join together and combine their hash rates.
So to prevent such attacks cryptocurrencies are changing to better consensus algorithms like Proof of Stake in case of Ethereum.


Yeah that's pretty much it...

Check out my previous post here:

And don't forget to upvote.....

Sort:  

It finally makes sense! I've been doing steemit for a few months now, and I just avoid the blockchain subject when telling people about crypto, because I've never understood what it actually is. I feel like less of a newbie now, thanks! Happy Steeming:)

Thank you @samvan really appreciate it bro.