Getting Started with Blockchain

0
4243
blockchain featured image osfy july 2020

Transparency, immutability and security, which characterise blockchain technology, have propelled it into unthought of domains. From being a means of carrying out decentralised monetary or asset transactions, it has now been adopted in areas like healthcare, real estate, supply chain management and energy distribution.

Blockchain is a peer-to-peer ledger system that allows transactions among peers without any centralised authority. The peer-to-peer network is completely decentralised because each peer carries a copy of the ledger. The ledger can be a complete copy or the minimal copy required for it to stay connected and functional for the network.

To ensure consensus across transactions, consensus methods like proof-of-work, proof-of-stake, etc, are used. Also, each transaction is completely secured with the help of advanced cryptographic algorithms. Clearly, the whole blockchain mechanism is used to benefit from its trust, immutability and transparency. The idea is the complete opposite of centralisation. In short, it is a network with peers capable of doing transactions without any centralised authority. This simple idea is single-handedly changing how industries work.

Healthcare, for example, can now be revolutionised to store patients’ data on the blockchain. In this way, patients do not have to carry their own documents as everything is stored on the network, and is just one click away. Patients can also share their data with researchers and help improve research on many critical illnesses. It also solves the counterfeit drug problem — helping both patients and drug companies.

Blockchain architecture for beginners
Now that we have some idea of how a blockchain functions, it is time to learn about its architecture.

The key components of the blockchain architecture are:

  • Transactions
  • Blocks
  • Mining
  • Consensus

Apart from the general components, there are different types of blockchain architecture like public, private, and consortium.

Blocks: A blockchain is composed of blocks. The blocks are stored in a linear fashion whereby the latest one is attached to the previous block. Each block contains data — the structure of the data stored within the block is determined by the type of blockchain and how it manages the data.

Let us look at the example of the Bitcoin blockchain. A block in Bitcoin contains the basic information about a transaction, including the receiver, the sender, and the amount of Bitcoin transferred. The first block of any blockchain is known as the genesis block. This is the only one that doesn’t have any preceding block.

In a block, there is important information known as the hash. This is used to determine the authenticity of any block and whether it should be attached to the current chain. The hash is unique to every block and hence cannot be replicated by any malicious block. It is also a gateway to understanding what the block includes. This enables the block to protect its contents. So, if someone tries to change the information within the block, the hash value will also change, triggering a warning so that other blocks do not accept it.

The structure of each block can be divided into three parts — the data, hash, and the previous block hash. The whole chain is constructed in this manner.

Transactions: A transaction takes place within the network when one peer sends information to another. It is a key element of any blockchain and without it there would be no purpose in initiating a transaction. A transaction consists of information, including the sender, the receiver and the value. It is similar to a transaction done on modern credit card platforms. The only difference is that the transaction here is done without a centralised authority.

A simple example would be of one user sending Bitcoin to another. The transaction initiates an agreed-contract blockchain which changes its state. As the whole blockchain is a decentralised network, it needs to be updated by all the nodes. Each node contains an exact copy of the ledger, and thus, a state of blockchain is created. Any single transaction can initiate a state change.

As mentioned earlier, a block contains a bunch of transactions. There is a limit to how many transactions a block can contain. This depends on the block, the transaction size and also on the limit imposed on how many transactions can stay in a block. The verification of the transaction is done by independent nodes based on the consensus method used. Technically, each transaction can have one or more input(s) and output(s). In this way, the transactions are linked so that they can keep a proper note on the expenditure done in the blockchain.

Mining: Mining is an important part of a blockchain network. Bitcoin uses mining for the proof-of-work (PoW) state. Clearly, block creation requires real-world effort, which is mining. The mining is done by spending computational units to solve complex mathematical puzzles.
The miners are responsible for mining operations. Nodes with the necessary hardware participate in the mining process. They are required to solve complex mathematical solutions and hash the block. They are also incentivised for doing the hard work. Their payment, however, depends on the mining difficulty level and the work done towards validating a block.

Mining is only required in public blockchains.
Consensus: The last important part of blockchain architecture is consensus. This is the method by which a transaction is validated. Each blockchain can have a different consensus method attached to it. For example, Bitcoin uses proof-of-work (PoW), whereas Ethereum uses proof-of-stake (PoS). There are other types of consensus methods as well.

A consensus method is a set of rules that needs to be followed by everyone in the network. Also, to impose a consensus method, the nodes should participate. Without any node participation, the consensus method cannot be implemented. This also means that the more nodes that join in to participate in the consensus method, the stronger the network becomes. Bitcoin has a big network and offers great incentives to become a miner. In fact, it also has one of the biggest miner communities out there.

The miners can collectively also follow their own wishes or make their point. For example, if there is a change required in the blockchain, then miners can decide on how to achieve that change. Conversely, if a change that they do not approve of has been made, they can protest against it. Miners or the nodes taking part in the consensus method are also capable of hijacking the network if more than 51 per cent of them are controlled by any one entity. This is known as a 51 per cent attack, whereby more than half the nodes are controlled by one entity. In such cases, the nodes can fake transactions and also make it possible to do double-spending.

Types of blockchain architecture
Now that we have understood the core components of any blockchain network, let’s learn about the types of blockchain architecture.

Public blockchain architecture: In a public blockchain architecture, anyone can participate in the network. The transaction’s public information is available to everyone. However, this doesn’t mean that the private data of a transaction is available anymore. Examples of public blockchain architecture include Bitcoin, Lite-On and Ethereum.

Private blockchain architecture: Not everyone can access the blockchain. The administrator or the ruling set of nodes determines who can join the network.

Federated/consortium blockchain architecture: The last type of blockchain architecture is the federated/consortium blockchain architecture. It combines the best features of both the public and private blockchains. It is also heavily controlled and is best suited for enterprise blockchains.

To understand the differences between the three, just go through Table 1.

Table 1: How private, public and consortium blockchains differ from each other
Feature Private blockchain Public blockchain Consortium blockchain
Access Private Public Public/private
Consensus Organisation based Public Selected nodes
Efficiency High Low High
Centralisation Yes No Partial
Consensus process Permission based Permission based Permissionless
Immutability Not completely tamper-proof Completely
tamper-proof
Not completely tamper-proof


How a blockchain works

How a blockchain works can be understood by going through a step-by-step process. The key components of a blockchain include the following:

  • Node
  • Block
  • Transaction
  • Chain
  • Consensus
  • Miners

Step 1: In the first step, a transaction is requested. The transaction can be either to transfer information or some asset of monetary value.

Step 2: A block is created to represent the transaction. However, the transaction has not been validated yet.

Step 3: The block with the transaction is now sent to the network nodes. If it is a public blockchain, it is sent to each node. Each block consists of the data, the previous block hash and the current block hash.

Step 4: The nodes now start validating the transaction according to the predetermined consensus method used. In the case of Bitcoin, proof-of-work (PoW) is used.

Step 5: After successful validation, the node now receives a reward based on its effort.

Step 6: The transaction is now complete.

Consensus methods
Consensus methods are integral to any blockchain type. They determine how fast, efficient and secure a transaction is.

Right now, there are various consensus methods out there. For the sake of simplicity, we are covering only the four most popular ones.

  • Proof-of-work
  • Proof-of-stake
  • Delegated proof-of-stake
  • Practical Byzantine fault tolerance

Proof-of-work (PoW): This is the first-ever consensus method that was used by a blockchain network. It was introduced with Bitcoin. In the consensus method, there are miners who are responsible for validating a transaction. The hash of a new block needs to be found so that it can be added to the network. The first one who finds it gets rewarded. This process requires extreme computational power and also has high-end requirements when it comes to hardware.

Proof-of-stake (PoS): This is used by second generation blockchain networks like Ethereum. It has a completely different approach as it doesn’t involve extensive power consumption. Here coins are staked by the nodes. Ethereum has its own requirements regarding how coins need to be staked for it to be eligible to take part in the consensus algorithm. The nodes that have more coins staked have more chances of getting rewarded. This also makes proof-of-stake investment heavy.

Delegated proof-of-stake (DPoS): This is different from PoS. It handles the node selection differently. In this case, the coin holders select the nodes to take part in the consensus method. They can also vote while choosing or kicking a node. It is more suited to an established network that operates under higher levels of trust.

Practical Byzantine fault tolerance (PBFT): This is a way of solving the Byzantine General’s Problem. It enables nodes to decide whether to accept or deny the submitted information. The party maintains an internal state which is used to run computation on new messages. If the party’s computation runs well, it then decides to share the transaction with other parties within the same network. The final result is arrived at when multiple parties have run computations on it and the decision is based on the results sent by the parties. As all nodes are not required for the consensus method, it also has a low hash rate requirement.
However, to make it successful, it requires good trusted nodes to work together. PBFT is used in popular projects like Ripple, Stellar and Hyperledger.

Blockchain use cases
Taking a closer look at a few blockchain use cases, from the hundreds out there, will help you understand blockchain technology better.

Supply chain management: Supply chain management (SCM) currently suffers from a lot of problems. For example, the biggest problem is product counterfeiting. By using blockchain, products can be traced accurately, making counterfeiting impossible. It also improves transparency and ensures that there is an overall cost reduction. Improvements in SCM also means improvements in different industries like healthcare, food, etc.

The Food Trust project by IBM, run in collaboration with Walmart, is an excellent example of supply chain improvement with blockchain in the food industry.

Healthcare: Healthcare also benefits from blockchain. Right now, there is no way for healthcare specialists to look at one single version of a person’s healthcare report. With blockchain, it now becomes possible for patients to have their reports stored on a blockchain — which can be retrieved later on. In this way, doctors can work on a single report and give better medical services to patients. It also makes the process efficient, improves the exchange of information, and results in the best possible way for patients to both secure and access their documents so that they do not have to be carried around.

MediBlock is one of the projects that is using blockchain technology to improve healthcare services.

The energy market: Energy distribution companies are big players that provide services to almost everyone. For now, as a consumer, you need to wait for the big companies to provide you with a connection — which can take anywhere between a few days to a few weeks, depending on your location. The energy market is currently a closed ecosystem with new players trying to revolutionise it with the help of blockchain technology. With blockchain, nodes will become capable of generating and trading electricity without the need for any centralised authority.

This will reduce energy prices and also improve the reach of energy in places where it was unavailable earlier. There are projects like Grid+ and Power Ledger that are making all of this possible.

Real estate: Real estate is one big sector. Right now, many players in the sector are struggling due to one reason or another. One major reason behind the slow growth of the real estate market is the lack of efficiency in the whole system. If you wish to purchase a property, then you need to go through a slow, painful process that can take weeks to complete.

With blockchain, real estate can become more efficient, enabling safe and smooth transactions. All of this is possible because of smart contracts that can automate tasks like buying or selling a property. It can also help carry out ownership verification and is cost-effective.

Blockchain development for beginners
If you want to get started with blockchain development, then you need to begin with programming first. It is wise to learn C++, followed by Python, JavaScript, Solidity and Go. When it comes to the choice of the blockchain network, you should start with Ethereum. It has an excellent community, and you will surely feel at home while learning it.

LEAVE A REPLY

Please enter your comment!
Please enter your name here