The Blockchain Explained With Blocks

Written by sunnydasgupta | Published 2022/05/03
Tech Story Tags: blockchain | tatum_io | blockchain-writing-contest | blockchain-technology | what-is-web3 | explaining-blockchain-basics | smart-contracts | future-technology

TLDRAn introduction Since a Blockchain is a series of blocks, organised in a chain, that contain information (bet you're glad you started reading this revolutionary stuff), this article is going to be organised in the exact same way. Let's start with our first block...to the blockchain and why it is so extra specialvia the TL;DR App


Since a Blockchain is a series of blocks, organised in a chain, that contain information (bet you're glad you started reading this revolutionary stuff), this article is going to be organised in the exact same way.

Let's start with our first block...

Block 1: The Basics

We'll start with the example of signing up to Facebook. When you sign up with your name, email and any other information you need to provide, this data is stored in a database. That database is privately owned by Facebook. They decide what to do with your data. When you sign up, you are having to trust Facebook with your data. If Facebook is hacked, the hackers may be able to alter your data.

In contrast to this, a blockchain is a decentralised, distributed ledger. It's completely public. All entries to the ledger can be seen, and no one owns the information on the blockchain.

"Distributed" means that the current state of the ledger is replicated across many different machines. Together, those machines agree by consensus on what the current state of the ledger is and validate any changes being made to the ledger. The idea is that the blockchain records information in such a way that it is very difficult to cheat or hack. Once some data has been recorded inside a blockchain, it becomes very difficult to change.

Block 2: Inside a Block

Each block contains some data, the hash of the block, and the hash of the previous block. A hash is like the DNA of a block. It identifies that block's contents and it is always unique (yep I know, twins, same DNA, move on). Changing the data inside the block will cause the hash to change. If the hash changes, that block is no longer the same block it was before.

Block 3: Creating a Chain

The third element we mentioned that goes into each block is the hash of the previous block. This is what is used to create a chain. Every block except the very first one points to a previous block. So what happens if you try to tamper with one block in the chain? The data inside it changes, so the hash changes. All of the following blocks in the chain are now invalid because the next block is pointing back to a hash that doesn't exist anymore.

What about the first block?

The first block is a little bit special, and the name for it is the Genesis Block or Block 0. It can't point back to a previous block because it is the first one in the chain. Every subsequent block in the chain can be traced back to this genesis block.

Block 4: Consensus Mechanisms

But hashes are not enough. Modern computers are very fast. They have the processing power to tamper with a block and then recalculate all of the blocks further down in the chain.  To protect against this, blockchains have consensus mechanisms. These are processes that slow down the creation and check the validity of a new block, before adding it to a chain. Before a block is added, over 50% of the validator nodes in the network have to agree that this block is valid. This makes it very hard to tamper with a blockchain.

Side Note: Nodes

These blocks of data we are discussing are stored on nodes. On a blockchain network, all nodes are connected with each other, and they use these connections to continuously exchange the newest information with each other. Nodes can be any kind of device, but they are usually computers, laptops and servers.

Block 5: Adding a Block

When a new block is created, it is sent to everyone in the network. The validator nodes then verify the block, to make sure it hasn't been tampered with. The nodes agree on which blocks are valid and which aren't. Blocks that are invalid are rejected by all nodes in the network. If everything is okay, each node adds this block to its own blockchain.

Block 6: Tamper Proof?

So to successfully hack a blockchain - these are the steps. Tamper with all the blocks on the blockchain, redo the hash calculation and the consensus mechanism process for each block, and then you need to somehow take control of over 50% of the nodes in the globally distributed network - so that the network accepts your tampered blocks. If you think about a large, global network like Bitcoin or Ethereum, this is a very, very difficult task.

Block 7: Smart Contracts

Smart contracts are programs stored on the blockchain. They can be used to automatically exchange data if certain conditions are met. The terms of the agreement between the parties involved in a smart contract are directly written into the code.

One example of a smart contract could be the use case of life insurance. In the event of someone passing, a death certificate could be the input needed to trigger the smart contract. Once the smart contract is triggered, it would automatically pay out funds to the beneficiaries named in the life insurance agreement.

Block 8: Uses

Digital currency may be where all the hype is. But those in the web3 world have much wider-ranging plans for the uses of blockchain technology. Blockchain technology and the highly secure, public chain of record it produces can be used for:

  • Fairer voting systems
  • Secure sharing of medical data
  • Personal identity security
  • Recording real estate transactions
  • Gambling

Block 9: Creating your own

This is kind of going from 0 to 100, but if you have basic programming skills, you may be interested in this video on how to create your own blockchain in Javascript. Even non-technical people can use this video to understand more because the explanations are very clear.

So that was our blockchain to explain blockchains (how meta).

Hopefully, you now understand more about why the words "decentralised" and "trustless" are being thrown around so much these days. The main principles of blockchain networks are that they are public, distributed, time-stamped and persistent (meaning that blockchain records can't be misplaced or damaged in any way). The most important lesson here is that blockchain technology is not some obscure thing related to Bitcoin. It's likely to affect many aspects of your life in future.


Published by HackerNoon on 2022/05/03