The blockchain technology is undeniably a pretty ingenious invention. However, not more than often, when asked about it, many people say they still don’t understand what the technology is and how does it work. That is the reason why blockchain remains one of the most underestimated technologies of the time. One of the reasons for this is people, especially the ones who are new to the concept; have a hard time understanding the basics of how blockchain functions. Having basic understanding of the concepts is very essential to understand the working of technology.
This article will take you through some of the basic concepts of what blockchain is and how it makes your transactions secure. I will be covering the technical aspects of some of the topics.
- What is block
- What is a genesis block
- What does a block contain
- What is blockchain
- How does it work
- What is the need for blockchain
Types of blockchain
The blockchain principles and fundamentals are really coming initially from the design work on the Bitcoin. Most of this article focuses on the design and the principle of the blockchain put in place in the Bitcoin system.
Some more recent (Blockchain 2.0) implementations differ slightly while still sharing most genes with the original blockchain, making all that is presented below valid from a conceptual perspective in these other implementations as well.
What is a Block?
A block is actually a file where data pertaining to blockchain network is permanently stored. A block records some or all the recent blockchain transaction details that have not yet entered any of the prior blocks. Thus, a block is like a page of a ledger or an account book. Each time a block is completed, it gives way to the other block. Data stored in blocks cannot be altered.
What is a genesis block?
A genesis block is the first block of a blockchain. Modern versions of Bitcoin number it as block O, though very early versions counted it as block 1. Genesis block is almost hardcoded into the software of the applications that utilize its blockchain.
A file named genesis.json defines the genesis block; this file is called the Genesis file. It is like the “settings” for the blockchain including the chain configuration, mining level difficulty, etc.
What does a block contain?
Each block contains, among other things, a record of some or all the recent transactions, and is cryptographically hashed. It also contains the hash of the block prior to it linking the two, ensuring all the data in the blockchain remains unchanged and is not tampered with.
Source: Diagram taken from 'Bitcoin: A Peer-to-Peer Electronic Cash System' by Satoshi Nakamoto
Because each block contains a hash to the previous one, the collection of all the blocks in existence form a chain called a “Blockchain”.
This still leaves us with two important questions:
- What is a hash?
- How does it work?
What is a Hash?
A hash function is a function that takes in an input and produces an output of a specific size. The process of applying the hash function to any data is called hashing and the output is called the hash.
One critical characteristic of a secure hash function is that it is only one way. This means that given the hash, it is virtually impossible to determine what the input was. The technical term for this is preimage resistance.
A cryptographic hash function must also be collision resistant. Collision is when a hash function produces same output for more than one input.
The preimage resistance makes it hard to solve the hash function. The only way to determine the output is by hashing all combinations of inputs, until the correct input is hashed which means, if the input was random, finding it would take an indeterminate amount of time, and thus is virtually and effectively impossible.
Hashing and Blockchain
Hashing is extensively used with blockchains. For example, addresses on a blockchain are derived by a process of hashing public keys. An Ethereum account is computed by hashing a public key with Keccak-256.
The end of this section indicates that now you have a basic knowledge of what is a block is. Now it’s time to understand what blockchain is and how it functions.
What is a Blockchain?
A blockchain is a distributed database that maintains a continuously growing list of records called blocks which are secured from tampering and revision using cryptography.
As the name suggests, a Blockchain is a chain of blocks that hold batches of valid transactions. Each block includes the hash to the prior block in the blockchain.
In addition to a hash based history, any blockchain database has a specified algorithm for scoring different versions of history.
It uses a peer-to-peer network, which means, every node in the network is connected to every other node in the network. As the transaction is done, it is added to the block of the blockchain which is then reflected in the copy every user in the network possesses.
How does blockchain work?
Let us suppose that Sam wants to buy a Jacket from an online shopping store. The store selling the product only accepts PayPal or so,e other kind of online transactions. Now, Sam has to pay, or at least give some proof that he will pay to the store. Payment via VISA (credit/debit card) will involve third parties in the transactions (since the payment will be done through their gateway). This means that there will be people involved who the transacting parties know nothing about. This is one of the major drawbacks of the current system.
Here comes Blockchain...
Blockchain removes the need for the involvement of the third parties as it works on the principle of the distributed ledger.
Every user present in the network has a copy of the blockchain (this is what distributed ledger means). After the transaction is verified, it is broadcast to this network and is added to everyone’s copy of the blockchain.
Eliminating the need of the central ledger is precisely the core intent of the blockchain.
Operating Principle Overview
The operating principle of the blockchain is pretty simple:
• Sam wants to pay to the online store, he broadcasts a transaction to the network
• Miners add the transaction to the block they are currently working on
• Randomly, one of the miners may solve the hash code and “mine” the block
• At this point, this new definitive block is broadcasted to the network and added to everyone’s copy of the blockchain
Miners and the “proof of work”
In order for a block to be accepted by the network peers, miners must complete the proof of work which covers all the data in the block. The difficulty of this work is adjusted as to limit the rate of new block generation to one every 10 minutes (in Bitcoin).
The proof of work is the piece of data which is difficult to produce but easy for others to verify. Producing a proof of work is a random process and hence it requires a lot of trial and error.
The blockchain Data Structure
The data structure of a blockchain is an ordered, back-linked list of blocks containing transaction details. Each block is in chronological order otherwise the prior block will be lost.
Need for blockchain
Comparison with present model
A distributed ledger is a list of shared and synchronized data which are geographically spread across many sites. The data are exactly replicated and synchronized across all the locations to maintain data integrity, availability and resiliency.
Unlike the centralized system, there is no central administrator or single point of control. If a location abruptly fails or stops functioning, the remaining location has the data and capacity to maintain the ledger or all transaction details in the absence of the failed location. This way a distributed ledger provides real-time information and reduced error or fail rates of transactions. This also reduces the costs of infrastructure as compared to the centralized system.
A distributed ledger uses a peer-to-peer network to communicate with nodes which are spread around the globe. Additionally, distributed ledger technology gives us the opportunity for economies of scale achieved by allowing the transaction to serve simultaneously as agreement, settlement, and regulatory reporting. Instead of building numerous duplicative and redundant services, one master prime record can serve as the source, eliminating the need for reconciliation and increased post-trade processing speed.
Removal of centralized system
As discussed earlier in the working section, any online transaction not only involves the risk of frauds but also includes third parties into the transaction which costs money. Here the blockchain comes in.
With the distributed ledger system, there is no need for third party involvements as every node in the blockchain has a copy of the transactions done. This also reduces the chances of re-spending (also known as double spending) the currency already spent as the redundancy will show.
Here are some of the advantages of blockchain technology:
- Immutability - Nothing on blockchain can be changed. Any confirmed transactions cannot be altered
- Permanence - A public blockchain will act as a public ledger, meaning the data will be accessible as long s the blockchain remains active
- Removal of intermediaries - The P2P nature of blockchain does away with the need of intermediaries.
- Speed - Transactions are much faster than a centrally controlled ledger
- Security - Last but not the least, neither the nodes nor anyone else except the sender and receiver can access the data sent across the blockchain
Types of blockchains
1. Public blockchains
As the name suggests, these blockchains are open to public and anyone can participate as a node in the decision-making process. Users may or may not be rewarded for their participation. These ledgers are not owned by anyone and are publicly open for anyone to participate in. All users of the permission-less ledger maintain a copy of the ledger on their local nodes and use a distributed consensus mechanism in order to reach a decision about the eventual state of the ledger. These blockchains are also known as permission-less ledgers.
Bitcoin is the best example of a public blockchain. Whenever a user does a transaction, it is reflected on everyone's copy of the block. This is because Bitcoin uses a Public blockchain.
2. Private blockchains
Private blockchains as the name implies are private and are open only to a consortium or group of individuals or organizations that has decided to share the ledger among themselves. Only the owner of the blockchain has the right to make any changes to it.
Example, Blockstack aims to provide the financial institutions with back office operations, including clearing and settlement on private blockchain.
However, the use cases of a private blockchain are relatively small as compared to the public blockchain. Some people may argue that a private blockchain is not of much use as the implementation concept does not differ much from that of the current systems. Others believe that private blockchain can provide to some of the problems which bitcoin cannot such as know-your-customer (KYC) or anit-money laundering (AML).
3. Consortium blockchains
This blockchain is basically a hybrid of public and private blockchains.
Federated Blockchains operate under the leadership of a group. As opposed to public Blockchains, they don’t allow any person with access to the Internet to participate in the process of verifying transactions. Federated Blockchains are faster (higher scalability) and provide more transaction privacy. Consortium blockchains are mostly used in the banking sector. The consensus process is controlled by a pre-selected set of nodes; for example, one might imagine a consortium of 15 financial institutions, each of which operates a node and of which 10 must sign every block in order for the block to be valid. The right to read the blockchain may be public, or restricted to the participants.
With the basic understanding of what the blockchain technology is and how it works, in the next article we will focus at the public blockchain system and Ethereum, which is, just like Bitcoin, an application of the public blockchain.