Blockchain 101

By Pratiksha Budhwant on The Capital

Pratiksha Budhwant
The Dark Side

--

Unless you’ve been living under a rock, I’m pretty sure you must have come across the term “Blockchain.” It has been an enticing technology for over a decade now. Although people are familiar with the term, there are still many who fail to understand how it works. I was one of these people until a few months ago when I got an opportunity to explore the subject “Distributed Ledger Technology” (a more generalized term for blockchain people use today) and here’s everything you need to know as a beginner!

Disclaimer: I am a novice too, and still have a long way to go before I completely and fully understand blockchain. This blog is merely a compilation of various interesting sources I found during my research combined with my overall understanding of the technology! The most relevant sources I used will be attached at the very end for anyone interested.

Bitcoin put forward the idea of a Blockchain for cryptocurrencies and was introduced by a person(s) Satoshi Nakamoto in 2009. Ethereum later built on it and proposed a more generalized way to use blockchains for other applications and was the very first implementation of a “Decentralized Application” (DApp). As the name suggests, blockchain is simply a chain of blocks that contain some information.

In a broader perspective, blockchain can be defined as a distributed ledger* which is immutable i.e. it cannot be altered. Fundamentally, you can only add to the blockchain but not remove anything from it. If a transaction (Tx1) takes place, to undo it another transaction (Tx2) to negate the previous one has to be made. A blockchain is built on a peer-to-peer network and is visible and available for everyone to see. This was the most promising feature of blockchain that grabbed everyone’s attention when it was first introduced. It aimed at eliminating the need for third parties (such as financial institutions) by giving complete power to the people transacting.

*Ledger: A collection of financial records (in this case, transaction records)

Let’s dive deeper and take a closer look at the blocks in the blockchain.

Fig 01: Block in a blockchain.

A block typically consists of some information, hash of the previous block, which essentially creates the chain by linking the current block to the previous one and a unique hash value that identifies the block itself.

Fig 02: Structure of a block and its header.

Fig 02. depicts the structure of a block i.e. the information a block contains. In bitcoin, the size of a block is 1 MB, which accommodates up to 3500 transactions, and hence a transaction counter is needed. The transactions field contains the details of a transaction. These details can contain a hash of the Tx, the amount that was transacted, sender and receiver details, etc.

The sender and receiver’s details aren’t generic such as email id or username. When a user registers for a cryptocurrency wallet or on a blockchain, he/she is issued with a public and a private key pair that is used for transactions. Other users can use your public key to transact with you.

A block header contains additional fields that are required by the blockchain algorithm. Bitcoin uses the proof of work algorithm, and there are various algorithms used by different blockchains such as proof of stake, proof of correctness, proof of elapsed time…to name a few. These algorithms are used to determine how nodes come to a consensus.

Now, let’s understand the working of a blockchain!

Fig 03: Working of a Blockchain.

When a transaction (Tx) is conducted, it is broadcast to millions of computers on the internet. These Tx broadcasts are picked up by special nodes called the miners. These mining nodes are constantly listening for the Tx broadcasts and validating them. When a Tx is validated, it is added to a block. Once a block is created, the nodes have to solve a mathematical puzzle to compute the hash value for the block so it can be added to the chain. This hash value has to match a specific target* set by the network. The miners have to alter and feed a nonce** to the hashing algorithm such that the resulting hash meets the target requirement set by the network. When one of the nodes successfully determines the hash value, it is responsible for notifying other nodes by broadcasting the block and its newfound hash.

*The target in bitcoin is a 256-bit value which is adjusted by the network every 2 weeks such that it maintains the time required for the hash value computation to approximately 10 minutes. The very first difficulty target was coded into bitcoin by Satoshi and was a number they best guessed would require about 10 minutes for computation!

**A nonce is just a number that was used to compute the hash of a block. It is unique for each block.

The nodes once notified of the new hash value then come to a consensus (For bitcoin, the amount of work needed by the node which computed the hash is considered as proof that the block is valid. Hence, Proof of Work). All the nodes have to update their chain to add the newly mined block.

During the computation of the hash value, the miners will constantly listen for incoming transactions in parallel, validate them, and add them to create the next block. Hence the mining of the current block and creation of the next one are simultaneous processes. Once the hash value for the current block being mined is found, it gets added to the chain, the nodes then move on to mining the next one.

Miners play an important role in maintaining the blockchain! Mining is the process of determining the hash value for a block. Anyone with dedicated hardware (that gives them high processing power for computation) can become a miner. Once a hash value is found, the block is considered mined, and the miner node receives a reward!

For Bitcoin, this reward is the only way to generate bitcoins (BTC) i.e. only when a block is mined, new BTC can be created. The current reward per block is 12.5 BTC. The reward reduces by half every 4 years. This reduction takes place because Satoshi set a limit on the total number of BTC that can exist which is 21 million.

Reference sources:

Further Reads:

O’Reilly’s Foundations of Blockchain by Koshik Raj

--

--