Book Image

Learn Bitcoin and Blockchain

By : Kirankalyan Kulkarni
Book Image

Learn Bitcoin and Blockchain

By: Kirankalyan Kulkarni

Overview of this book

Blockchain is a distributed database that enables permanent, transparent, and secure storage of data. Blockchain technology uses cryptography to keep data secure. Learn Bitcoin and Blockchain is the perfect entry point to the world of decentralized databases. This book will take you on a journey through the blockchain database, followed by advanced implementations of the blockchain concept. You will learn about Bitcoin basics and their technical operations. As you make your way through the book, you will gain insight into this leading technology and its implementation in the real world. You will also cover the technical foundation of blockchain and understand the fundamentals of cryptography and how they keep data secure. In the concluding chapters, you’ll get to grips with the mechanisms behind cryptocurrencies. By the end of this book, you will have learned about decentralized digital money, advanced blockchain concepts, and Bitcoin and blockchain security.
Table of Contents (6 chapters)

An introduction to the blockchain

In this section, we will look at the architecture of blockchain, how it works, and what the salient features are that make it so disruptive. Blockchain was created by Satoshi Nakamoto as an infrastructure for Bitcoin and it is treated as the biggest thing since the internet. Blockchain, at a high level, consists of three major components, which are shown in the following diagram:

Let's now look into the following three major components of blockchain:

  • P2P Network: A peer-to-peer network (P2P) helps maintain a consistent copy of the distributed ledger. All the transactions that are captured on the blockchain in the form of blocks are maintained across the network of nodes running the blocks and programs by the distributed ledger.
  • Private Key Cryptography: This component is used by blockchain for the security and hash functions that make it immutable.
  • Blockchain Program: This component is used by blockchain as a protocol to execute steps that make it secure.

Workings of blockchain

Now, let's look at how a blockchain implementation works and what all the things are that are involved in completing the flow of execution. Let's take the example of a Bitcoin, shown in the following workflow for blockchain:

In the preceding diagram, we see how blockchain works and the steps mentioned are as follows:

  1. Let's say someone requests a transaction in Bitcoin; for example, person A wants to send Bitcoin to person B. That person or entity requests a transaction that results in debiting person A's wallet and crediting person B's wallet with one Bitcoin.
  2. Now, this requested transaction is broadcasted to the P2P network, consisting of computers known as nodes, which are spread across the globe.
  3. Now, once the transaction is propagated, the transaction is picked up by the network of nodes, they validate the nodes that are running the blockchain programs, and they validate the transaction and the user status using known algorithms that are common across all nodes.
  4. In our example, we talked about person A sending one Bitcoin to person B, which involves the cryptocurrency as well. The verification part also involves checking whether person A initiating the transaction for one Bitcoin really owns that Bitcoin or not.
One must avoid double booking and fake transactions altogether. Verification may also involve contracts, records, agreements, or documents that need verification.
  1. Once verified, the transaction is then combined with other transactions to create a new block of data for a ledger. This freshly created block of a series of transactions then gets added to an existing blockchain in a way that is permanent (it's unalterable).
  1. With this block added to the blockchain, the transaction is complete.
  2. Once the block is added, it remains there for the rest of the blockchain's life.

Features of blockchain

We will now discuss the following features of blockchain:

  • Secure: It is really impossible for anyone to tamper with transactions or ledger records present in the blockchain, which makes it more secure, so it is seen as a reliable source of information.
  • Global reach: Blockchain has been adopted worldwide and has the backing of many investors from banking and non-banking sectors, which makes it a globally accepted technology stack.
  • Automated operations: Operations are fully automated through software. Private companies are not needed to handle operations, which is why there is no mediation required to carry out the transactions, and trust is assured, so people can carry out their own transactions.
  • Open source: Blockchain is an open source technology. All the operations are carried out by the open source community.
  • Distributed: Blockchain works in a distributed mode, in which records are stored in all nodes in the network. If one node goes down, it doesn't impact any other nodes or any other records, because they are globally distributed across all the nodes.
  • Flexible: Blockchain is programmable, using basic programming concepts and programming semantics, which makes blockchain very flexible.