Around 2009 an unidentified person known as Satoshi Nakamoto created the bitcoin based on the blockchain technology. Once the price of bitcoin started rising from around 2012 , blockchain kept on getting more and more well known. From then on, the concept of blockchains had started to garner a lot of attention.
What is a blockchain though?
On googling “what is blockchain” you can find many different definitions with difficult words and phrases.
IBM defines blockchains as -Blockchain is a shared, immutable ledger that facilitates the process of recording transactions and tracking assets in a business network.
Or on Wikipedia - A blockchain is a growing list of records, called blocks, that are linked together using cryptography
Considering from a layman’s perspective these words maybe outlandish and difficult to understand. I mean what does a shared immutable ledger even mean?
In simple terms blockchain is basically an awfully long chain of data blocks which is stored at multiple locations as a whole copy of itself. These locations called as nodes together form the blockchain network.
All the nodes store the whole of the blockchain and are responsible of verifying the credibility of the new block added to the network. These blocks are all connected to the next one other with something known as the hash (we will learn more about them below) Every block contains a key (hash) of the previous block and if someone wants to access or verify any block in the blockchain they need to verify its key held by the block after it.
To explain it with a simple example-
Let us consider a blockchain to be a book of transactions, while its nodes to be the people who hold a copy of the book. The blockchain network becomes a group of the people holding the book. While the blocks can be pages of the book.
Now these pages of the book all have 2 secret keys on them- one is the page’s own key, and one is the key of the page behind it. These keys are generated based on the data of the respective page such that even if one letter or character of the data changes the keys change as well.
Now if anyone wants to verify the authenticity of the book or page one can directly compare the key of the particular page in question and the key of the same page stored on the next page. If the page were to be tampered the key would change and will not match the copy of the key on the page next to it.
Let’s say a malicious person wanted to change contents of a specific page, to tamper properly with the book one would have to change the contents of the page they want to change and then continue calculating and updating the keys of all the pages after it.
Moreover, even if someone successfully does this, since the copy of the book is held by a lot of different people upon comparison the book will be easily caught. Hence they would have to update all the pages after the page they wanted to edit for all the copies of the book.
This becomes virtually impossible even in small scale scenarios. On scaling to the scale at which major blockchains work this feat cannot be done even with the most powerful computers. Hence the blockchains are considered to be very secure.
This explanation is just a basic one and to completely understand blockchain one would need to delve further into cryptography and Data structures.
What are its usual components?
Nodes- Nodes are basically where the copies of blockchains are stored. These nodes operate together according to various protocols ( you can see which type of protocols here ) to form the blockchain network. They have various rights which enable them to accept or reject any new incoming blocks added by miners. If they validate the block, they then broadcast the change to the whole of the blockchain network.
Miners- Miners are also nodes but they have additional responsibilities. They must verify new blocks and generate the hash for the blocks before adding it to the network. They solve cryptographic puzzles to generate the hash. On successfully generating the hash the miners receive a reward for their work. This process is called as the proof of work. Once the block is mined the miner then adds it to the blockchain network and updates all the nodes on the network.
Blocks- Blocks are basically what link to make the entire blockchains. The blocks in the blockchains mainly have the 3 following components.
Hash of previous block- As we came to know earlier, blocks in the blockchains relate to the next block with the hash of the previous block. These hashes are calculated using hash functions.
Hash functions are functions which convert an input to a string of bytes with a fixed length. The output created is called a ‘hash’ or ‘checksum.’ Any hash created from data using a specific hashing algorithm is always the same length and one-way - it cannot be reversed.
These hashes are used to verify the integrity of the blockchain. Since these hashes change drastically if even a single character in the input is changed any tampering is detected easily. Its own hash - Similar to the previous block hash every block also stores its own hash. These hashes are created using specific hash functions. Blockchains such as ethereal and bitcoin use Merkle tree to generate hashes of the block. (you can learn about the Merkle trees here).
Data - The data in a block of a particular blockchains most of the times consists of individual transactions. Additionally, data can also include values like the timestamp and nonce (nonce is a random value which controls the difficulty of mining blocks. Will cover more on it in a different article).
Some blockchains like Ethereum also store smart contracts or rules as data. Though data can be any type of data in binary format but one thing to be noted is that most blockchains impose memory limits on blocks. i.e., blocks cannot be more than a certain size for example the maximum size of a block in bitcoin is 1MB. hence instead of storing large amounts of data normally either addresses or transactions on the blockchains.
How does a blockchain work then?
All blockchains first start with a single block. This block is majorly called as the genesis block. It does not have a hash for the previous block. The next block carries the hash of the genesis block and so on.
These blocks carry data. Most blockchains store transactions between wallet addresses in these blocks. A block can have one or more than one transaction though it depends on the block size limit.
A block is added to the chain after it is mined by miners. Miners calculate the hash of a block and verify all the transaction to prevent double spending, once miners successfully mine a block they receive rewards (in the case of bitcoin they receive bitcoin as a reward). you can read more about mining and rewards here.
Double-spending is a potential flaw or bug in blockchains in which the same single digital token can be spent more than once. This bug is present in bitcoin and hence mining is a concept used to prevent it.
This double spending phenomenon occurs when blockchains use UTXO method to keep track of balances and can be avoided using different balance keeping methods for example account/Balance model used in Ethereum.(Will discuss more in detail in another article).
Once the block is mined the block is sent to all the nodes in the network. All the nodes verify the block added using a consensus mechanism like proof of work which is used in blockchains like bitcoin. The whole of the network of nodes operates on specific protocols for example the bitcoin protocols or other p2p protocols built for blockchains.
Though understanding the blockchain seems like a daunting task , if you try to understand it at the basic level it becomes extremely easy and interesting.
If you liked this article, please look out for more articles on this topic by me 😊. You can also contact me for any or have any queries or corrections on my social media which you can find on my author’s profile.