Blockchain technology has been around for about a decade now. It started with the advent of the great Bitcoin back in 2009 by Satoshi Nakamoto. Ever since then Blockchain, Cryptocurrency as Web3 have been getting a lot of hype, and today (In 2022) these are all that everyone talks about.
But do people really understand what a Blockchain is? Do people know what Bitcoin is? Probably Not. For most people, it is nothing more than just a tradeable asset that many used to become millionaires. However, we’re here to talk about the theory behind this Blockchain and how it made cryptocurrency possible.
If you want to understand web3, you can start with the following article.
What is a Blockchain?
A blockchain is like a database system, only more complex and completely decentralized. I believe it is quite obvious by the comparison to a database system that a blockchain is used to store data, but what makes it different? Well to understand that we need to break it into…blocks….😉.
The illustration below represents what a single block looks like in a blockchain.
Every block contains:
This Header contains vital information such as the hash of the previous block in the chain, timestamp of when the block was created, a nonce (this is used in blockchain mining), etc.
The Body of the blockchain contains information regarding transactions that have occurred on that blockchain. If the transaction is a transfer of cryptocurrency then the block body will contain the address from which the transaction was initiated, the address to which the amount was transferred, and the amount which was transferred.
Linking up the blocks
As more and more transactions happen, new blocks are added to the blockchain so this creates….. a chain of blocks. This chain structure of this database ensures that it can not be tampered with (we’ll soon see how this is possible).
Unless you’ve been living under a rock, you must have heard about blockchain mining by someone somewhere. Everyone seems to be jumping on the mining bandwagon but I am quite sure not a lot of them know what mining really is (except that it gives you free cryptocurrency).
Mining is the process of creating a new block on the blockchain. A block isn’t JUST created, it takes a complex process to finish this process. Every time a block is to be created, heavy computation power is needed to solve what is called ‘the blockchain problem’.
I will discuss mining in detail in a different article. For now, you just need to understand that this “problem” is computationally expensive and takes some time to solve (15 sec for Ethereum and 10 mins for Bitcoin). This computation expense is the reason why blockchain technology is considered harmful to the environment(you know because computers run and use electricity and electricity requires fossil fuel burning yada yada yada!!).
This is perhaps the perfect time to introduce “gas fee”. If you are into crypto trading or NFT trading, you must be familiar with this fee that you must pay every time you carry out a transaction (Buy/Sell crypto or NFTs). Ever wondered what this fee is for?
Well, every time you make a transaction, a block is to be created on the blockchain. This requires mining the chain and hence some computation power must be expended. This gas fee amount is awarded to the node(computer) which solves the problem first and allows the transaction to be carried out.
This is how blockchain miners earn cryptocurrency. It’s really free money since all you gotta do is let your computer do the work and receive the gas fee as a reward.
Blockchain is decentralized?
Whenever blockchain is mentioned, the term “decentralized” always tags along. This is because a blockchain’s biggest highlight is that it is a decentralized network.
In conventional web applications, there is a database present on any 1 system. This means that hackers can easily alter this database and you lose all the data. Blockchain being decentralized means that an exact copy of the entire blockchain is present on every node(machine) which is mining that blockchain. This means that even if a hacker is able to manipulate a chain on a block and add or remove some transaction, the blockchains on every other node would remain unaltered and the malicious change would be caught.
Proof of work VS Proof of stake
These are the last concepts that I will be introducing in this article. Both of these concepts are used to assign mining processes to nodes of a blockchain.
- Proof of Work
POW was introduced with the bitcoin blockchain (the OG blockchain). In this concept whenever a transaction is to be verified, it is broadcasted to all the nodes and every node will rush to calculate the appropriate hash for that transaction. The node which does so first gets the gas fee as a reward.
The problem with ‘POW’ is that a lot of resources are wasted in calculating the hash since every node jumps into the race but only one provides the answer. So the resources utilized by all the others are completely wasted.
2. Proof of Stake
This algorithm is an improvement over the POW algorithm. Blockchains utilizing the Proof of Stake methodology require every node on its network to deposit a fee before being able to join the blockchain. This fee ensures that the joiner has a ‘stake’ in the Blockchain project.
Whenever a transaction is to be verified, the blockchain algorithm randomly picks a node on the network to solve the problem. Well not exactly randomly, every blockchain has a different way of picking a node. Some may actually pick randomly, some give preference to nodes with a higher stake in the blockchain.
While POW has no penalty for anyone trying to carry out a fraudulent transaction, POS actually has some punishments in store. Since the nodes have deposited a fee, the network is able to take away some, if not all, of that fee if a node is accused of fraud.
Since POS requires people to actually spend money, there are fewer nodes on the network and since only one node is picked at a time to mine a block, no resources are wasted and it is better for the environment.
An amazing visual guide is available on the following website.
Here you can see how a blockchain stores content and how and why block are mined.