Blockchain Applications and Implementation


Recently, there has been a lot of buzz around bitcoin and other cryptocurrencies. But the driving technology for bitcoin i.e., blockchain, is often misconceived and is less explored. Blockchain has been one of the buzzwords for a few years now. These days, blockchain is everywhere. You cannot read the news without coming across news related to blockchain, bitcoin, cryptocurrencies, etc. It has been said that blockchain will do for transactions what the internet has done for information. Experts claim that blockchain will touch all vital fields and has the ability to alter payments, economics, healthcare and even politics around the world. Buying a house or registering a vehicle can prove to be quite a painful process due to the number of intermediaries one has to go through. The primary reason for the popularity of this technology is that it allows increased transparency and efficiency in the exchange of almost anything. It reduces cost and promotes trust among parties. To sum up, blockchain has the ability to change how the world works and it has the potential to be called the most groundbreaking technology of this century.

Despite being such a revolutionary technology, many people still do not have a clear idea about what it is and how it works. The true potential of this technology lies in awareness of it. So this is precisely the agenda of this chapter i.e., what exactly is blockchain and why does it seem to have such limitless applications? This chapter explains blockchain’s significance and implications along with an outline of a brief history behind it, starting with Section 1.1.1 which gives a general idea about blockchain. Then we shall try to understand the origin of blockchain in Section 1.1.2. Further, Section 1.1.3 briefly discusses its implementation.

What is Blockchain?

Blockchain is a way of recording transactional data or tracking assets. Assets can be tangible or intangible. Practically, anything of value can be tracked using a blockchain network with lesser costs and improved transparency. Blockchain is a database distributed across a network, where the nodes of the network are in sync with each other. All the nodes have the exact same copy of the blockchain. There is no single entity or authority which is in charge of controlling the database. Any modification to this database is done after broad agreement from the participants of the network. This database is append-only i.e. data can only be added to the database, and only after agreement from all participating entities [1].

With reference to past events, when various people had to depend on the same data, they relied on a trusted third party to control the origin of data. But with the emergence of blockchain, these groups of entities can agree on events without the requirement of a third party.

Blockchain is basically a decentralized ledger, building a linked list of records, called blocks, across a point-to-point network where every block contains a certain number of transactions. The order of the blocks in the chain specifies the order in which the transactions take place. Each block consists of:

Centralized versus Decentralized systems

FIGURE 6.1 Centralized versus Decentralized systems.

Structure of a Block

FIGURE 6.2 Structure of a Block.

  • 1. Cryptographic hash of the previous block
  • 2. The timestamp
  • 3. Transactional data

In other words, the blockchain functions as an open, shared, trusted public chain that maintains a continuously growing list of transaction data between two entities efficiently and in a verifiable and persisting manner.

Due to the structure of each block, blockchain is resistant to modification of data. If someone tries to change the transaction history in some block, then all the blocks from that block until the current block will have to be modified and this will have to be reflected in every duplicate of the blockchain on the network. Since the hash in the next block is a function of the contents of this block, the next block will also have to be changed. This change will result in a different block hash. The same process will have to be circulated to the latest block in the chain. Maintaining the blockchain becomes extremely difficult once it is modified. The computing power required to accomplish this is colossal. But these days we have computers with very high processing powers and for such computers, calculating hundreds of thousands of hashes is a matter of a few seconds. So, to avoid tampering with data, blockchains use a technique called Proof of Work (PoW) which requires miners (nodes in the network) to solve a computational problem. The time and effort required to solve the problem is very high as compared to the time required to verify the result of the problem. Once a miner finds a solution to a block, it broadcasts the block to the network. All the other nodes verify this solution and the block is added to the chain. PoW has become a widely used consensus algorithm and is used by many cryptocurrencies [2].

Now let’s try to understand the working of the blockchain with the assistance of an example:

Suppose a person X wants to give ? 10,000 to Y.

Without blockchain, X would send a request to his bank to initiate a transaction of ? 10,000 from his account to Y’s account. This request will contain the sender’s and receiver’s account details along with the transaction amount. The bank would check a few things such as if X actually has ? 10,000 in his account. If everything works out fine, the bank would transfer ? 10,000 from X’s account to Y’s account.

Transaction without blockchain

FIGURE 6.3 Transaction without blockchain.

Transaction with Blockchain

FIGURE 6.4 Transaction with Blockchain.

With blockchain, X creates a transaction of ? 10,000 to Y. This transaction is included in a block and sent over the internet. All the nodes in the network check whether this is a valid transaction. If it is valid, this block is added to the chain and the transaction gets executed i.e., Y has X’s 410,000.

Blockchain is by all accounts the driving innovation behind the next-generation internet or Decentralized Web and gives an answer to the age-old human issue of trust. Now, let us look at the key attributes of blockchain which justify the above statement and such endless applications of blockchain:

  • 1. Removing the role of a central governing authority: Blockchains are managed by a group of nodes forming a point-to-point network rather than some intermediary. Instead of being verified by a third party, a transaction is verified by every node in a network. This has several benefits like reduced transfer costs and improved transparency.
  • 2. Distributed: Every node has a copy of the blockchain. So, if someone tries to tamper w'ith the data, he/she will have to modify data in all the copies of blockchain stored at every node in the blockchain network. This prevents all of the information from being tampered with at the same time. Unless hackers can tamper w'ith the transaction records on millions of nodes, they will not be able to successfully falsify the blockchain data.
  • 3. Immutable: Any transaction data, once added to the blockchain cannot be modified. Data can only be added to the blockchain in a time-sequential order. It is considered practically impossible to change any data.
  • 4. Consensus: This is the attribute w'hich gives blockchain the power of decentralization. The ledger is updated by consensus. No central authority is in charge of making changes to the ledger. Any updates made to the blockchain are verified against strict conditions and added to the blockchain only after a consensus has been reached among the nodes in the network.
  • 5. Security and reliability: There is no single point of failure in the blockchain system due to decentralization. There is no part of the system that has the ability to cease functioning of the entire system, if it fails. Also, there are no weak points in the network from where information can be tampered with. This avoids malicious attacks, thus improving overall reliability of the blockchain. Furthermore, transactions are digitally signed and encrypted, w'hich ensures high security.

History of Blockchain

For a better understanding of blockchain, we must trace blockchain’s origin. We should try to understand the context in which it was developed to perceive it better. Since the ‘big 4’ are investing in it, blockchain has gained even more importance. Optimists claim that blockchain is going to be of more prominence in the future. So, let us see what journey blockchain had before it became a matter of interest to numerous people around the world.

In 1991, Stuart Haber and W. Scott Stornetta devised a method to cryptographically secure a chain of blocks to develop a system where time-stamped documents cannot be tampered wdth. In 1992, they tried to incorporate Merkle trees into this system to make it more efficient so that multiple documents could be stored in one block. However, it was in 2008 that blockchain finally began to gain importance [3].

In 2008, blockchain and bitcoin were conceptualized by a person (or a group of persons) named Satoshi Nakamoto. Satoshi Nakamoto has chosen to remain anonymous till now. In Nakamoto’s paper ‘Bitcoin: A Peer-to-Peer Electronic Cash System’, he introduced bitcoin to the world and explained its underlying principles and how it works. In this paper, he incorporated many concepts such as cryptography, networks, calculus, etc. He tried to devise an electronic cash system based on cryptographic proof. In the following years, bitcoin became popular and the underlying concept i.e., blockchain, became even more popular. Since then blockchain has evolved and found its place in many applications beyond cryptocurrencies [3].

How it is Developed/Implementation

Blockchain was introduced with the intention of disrupting the financial sector. Many banks and financial institutions have taken advantage of this technology to make transactions more secure. But now this technology is not confined just to payments and economics. Every industry, ranging from healthcare to manufacturing, from travel to retail, is investing in it.

The underlying concept behind blockchain is similar to that of a database but the way this database is handled is entirely different. For developers willing to learn to develop blockchain, it is important to understand some key concepts which form the crux of this technology:

  • 1. Decentralized consensus: Blockchain is a decentralized peer-to-peer system. There is no mediator among the nodes in the network to govern the exchange of information. No involvement of a central authority keeps the system free from corruption. So, to make a decision in a blockchain, the participants of the network need to come to a consensus via a consensus algorithm.
  • 2. Smart contracts: This is a computer protocol that controls the transfer of assets between entities. It defines the terms and conditions of a transaction. It works in the same way as a traditional contract. It is a piece of code that requires an exact sequence of actions to take place to facilitate an agreement between the entities involved.
  • 3. Mining: Mining is the process of verifying a transaction and adding it to the chain of blocks. It basically involves running the consensus algorithm along with creating a hash of the previous block which is not easy to tamper with. The main purpose of mining is to add transactions to the blockchain in such a way that it becomes practically impossible to modify them in the future.

The basic concepts alone are not enough to develop a blockchain network. You should also be familiar with object-oriented programming languages like C++, Java, Python, Solidity, etc. You should also have some knowledge about data structures such as linked lists, hash tables, associative arrays, etc. that play an important part in creating the structure of blocks in a blockchain network. Some understanding of cryptographic techniques such as secure hashing algorithm (SHA) is also required which is useful while creating hashes for blocks [4].

The security and verifiability of transactions in the blockchain network is possible only because of the presence of consensus algorithms which play a vital role in the blockchain network. Consensus algorithm is a mechanism via which all the participants of the blockchain network reach an agreement. So now let us discuss some of the most common consensus algorithms used for blockchain development:

  • 1. Proof of Work (PoW): This is the first consensus algorithm used in the blockchain network. It is used by the majority of cryptocurrencies. It involves solving a complex computational problem. The principle of this technique lies in the fact that the time and effort required to solve this problem is much greater than the resources required to verify the result of the problem. The node which solves this problem first gets to mine the next block. When a miner wants to add a transaction to the blockchain, he/she does the PoW for the corresponding block and broadcasts it to the blockchain network. All the participating entities of the network verify and validate this block and the block gets added to the blockchain. Whenever a new block is mined, the miner gets rewarded with some currency [3][4],
  • 2. Proof of Elapsed Time: PoET is one of the best and fairest consensus algorithms that is used with a permissioned blockchain network to find out the next miner. In this technique, every node is equally likely to be the next miner. All participating entities are required to wait for a random amount of time. This random wait time is generated by every node. The node which wakes up first after being in sleep mode (i.e., shortest wait time) for this designated time is chosen as the next miner. This miner add a new block to the blockchain and transmits the necessary information across the network.
  • 3. Proof of Stake: This algorithm is an alternative to PoW. Instead of checking which node has more computational power to solve a problem, it works on stake. Stake here is the amount of currency a miner is willing to lock up for a certain amount of time. All the nodes of the network verify the blocks by placing a bet on it if they think that a certain block should be added to the chain. The nodes get rewards proportionate to their bets and their stakes increase accordingly. The node with the highest stake is chosen to mine the next block [2].

Now let us have a brief introduction of some tools useful in the development process of blockchain.

  • 1. Geth/Parity: To interact with the blockchain network, we require a node capable of establishing a point-to-point connection with other nodes of the blockchain network. Geth and Parity are interfaces used to create a full implementation of an Ethereum node. The only difference is that Geth uses Go and Parity uses Rust for node implementation.
  • 2. Mist: This is a program which acts as a wallet to store and send ether (the currency used on the Ethereum blockchain).Whenever you want to send or receive ether or invest on the Ethereum blockchain, you will require a wallet to carry out transactions and that is where Mist is helpful.
  • 3. Blockchain Testnet: This is a platform used to test a decentralized application before deploying it to the main network. It provides dummy currency having no value to carry out transactions.
  • 4. Solidity Compiler: Solidity is a loosely typed programming language used to write smart contracts on the Ethereum blockchain network. The Solidity compiler converts the solidity code into a form readable by Ethereum Virtual Machine.
  • 5. Remix: This is a Solidity-based compiler that allows users to develop smart contracts for the Ethereum blockchain. It allows us to debug, deploy and test smart contracts.

It becomes quite complicated to develop a blockchain network from scratch due to the complex concepts involved, such as cryptography, networks, hashing, etc. So nowadays we have platforms which allow us to create our own blockchain by defining the upper-level information such as terms of a transaction and not paying much heed to the low'er-level implementation details. Some of these platforms are listed below:

  • 1. Ethereum
  • 2. Openchain
  • 3. Hyperledger Fabric
  • 4. Hyperledger Sawtooth
  • 5. EOSIO
  • 6. Multichain
< Prev   CONTENTS   Source   Next >