Introduction to Blockchain and Bitcoin
In this chapter, we will take a step-by-step approach to understanding the principles of "Bitcoin" and "blockchain", and their various features and characteristics. The buzzwords Bitcoin and blockchain relate to emerging technologies that have taken the world by storm. As we progress through the chapter, we will cover the fundamentals of these unique technologies in a detailed manner. The chapter will also take you through the essence of cryptography and how cryptocurrencies are using this innovation as a foundation. We will also look into the history of Bitcoin, the alternate cryptocurrencies available, and the various Bitcoin wallets, and we will get an understanding of the structuring of the Bitcoin block header. When it comes to blockchain, we will go through the different types of blockchain, blockchain structure, its various workings and features, the challenges faced, the various platforms available for blockchain, and more.
In this chapter, we will look into the following topics:
- Cryptography and cryptocurrency
- History and introduction to Bitcoin
- An introduction to blockchain
- Comparing private, public, and consortium blockchains
An introduction to cryptography and cryptocurrency
The blockchain technology is the backbone of cryptocurrency and it uses cryptography to keep the data secure. In this section of the chapter, we will discuss cryptography, cryptocurrency, and how cryptography is used in cryptocurrency implementation. We will also look into the workings of fiat currency cryptography, energy use in cryptocurrency, and also the security features of cryptography that are used. We will learn everything we need to know about decentralized digital money and its underlying architecture.
As we browse through the various parts of this section, we will learn about the history of Bitcoin, its alternative currencies, Bitcoin basics, and the technical operation of Bitcoin; then, we will browse through the technical foundation of the blockchain, the fundamentals of cryptography, and how it keeps data secure. From there, we will move on to understanding blockchain, its features, the underlying architecture on top of each Bitcoin, and how cryptocurrencies are implemented.
Workings and security of fiat currencies
Before we understand cryptocurrency, let's first look at some basic currencies used around the world. These currencies are also known as fiat currencies.
They are shown in the following diagram:

Some of the characteristics of fiat currencies are as follows:
- These are owned by the governments of countries
- They are centrally controlled through banks or legal entities
- They are inflationary, meaning the value of a currency decreases
- They include various security properties to prevent counterfeiting and cheating, but it is not impossible to counterfeit them
Since it is not impossible to counterfeit currencies, law enforcement comes into the picture to stop and prosecute those involved in counterfeiting fiat currencies. We will now look at various security features that are implemented in fiat currencies, as shown in the following diagram:

You will find two watermarks. You'll also see micro lettering and identification marks being implemented. Most of the time, fluorescent ink is used on notes for detecting notes that are fake.
Understanding cryptocurrency and its uses
Cryptocurrency is a very interesting and intriguing topic that has become a global phenomenon. It is different from all the currencies that are found all over the world. Right from the working of cryptocurrency, to who owns or controls it, its benefits and limitations, its use and much more, are all based on new ideas and processes. Let's now see a brief overview of the various features of cryptocurrency.
The main features of cryptocurrency are as follows:
- It is a digital asset used as a medium of exchange
- It secures transactions and controls supply by using cryptography
- It is a subset of alternative currencies
- In 2008, the first decentralized cryptocurrency was conceptualized
- Cryptocurrency is digital money, while the underlying technology that enables the moving of digital coins or assets between individuals is called blockchain
Hash function
The main cryptography techniques used in cryptocurrency are a hash function and a digital signature.
Let's look at each of these briefly. The hash function is a mathematical function with the following properties:
- Any input that we provide, be it a string, number, floating number, or anything, can be of any size
- It produces a fixed-size output such as a 128-bit hash outcome or even a 256-bit outcome
- It is collision-resistant
- It hides the data within it
Let's now look at an example of a hash function in the following diagram:

Let's look at the hash function being used here. In the preceding diagram, we gave Fox, one string, as an input to the encryption module and we applied a hash function to it. It gives a specific fixed hash outcome, which is also known as a digest hash sum. Let's say we pass another statement that says The red fox runs across the ice and we apply a hash function to it. It gives us a specific hash sum, also known as a digest. Then, we add another statement, The red fox walks across the ice, and we see that it changes the hash function as the input has been changed. This is the key feature that the hash function brings.
Digital signature
This is the second building block of cryptocurrency and is digitally analogous to the hand written signatures that we usually make.
The properties of the digital signature are as follows:
- You can create your own signatures, but they can be verified by another person too
- The signature is tied to a particular document or message so that it cannot be used again and again for different documents and messages
Let's now look at an example of a digital signature in the following diagram:

Let's take an example and say that there is a string in the document which states that "I agree to pay $5000 for the software". Since this is the document that is being signed, we first apply a hash function to it. It gives us a hash or digest of the document, which is again fixed in size. Then, we apply our private key, or a specific key, to encrypt it and we get the outcome as a digital signature. This digital signature is signed specifically for this input, which states that "I agreed to pay $5,000 for the software".
Here, we saw how cryptography and cryptocurrency are digital assets that are widely used. We also saw how cryptocurrency uses cryptography and its techniques, such as hash functions and digital signatures.
An introduction to Bitcoin
Bitcoin is the first decentralized digital currency, and as such it is a revolutionary technology invention. It changed the way we compute things and the way we operate software and computers. Bitcoin and blockchain are considered to be the next big wave of change after the internet.
Now, let's look at the following properties of Bitcoin:
- It's an international network of payments.
- It uses cryptography to control its creation and management, rather than relying on central authorities such as governments, banks, union territories, or intermediaries.
- It's not printed but is produced by people using software that solves mathematical problems.
- It is controlled and limited in supply, which arrests the hyperinflation problem. For example, whenever African countries were short of currency notes, they had to print more notes, which resulted in hyperinflation and brought the value of the currency down.
- Since the arrival of Bitcoin, the way Bitcoin programs are written means there will always be a maximum of 21 million Bitcoins available across the globe. The moment 21 million Bitcoins have been mined, the program will not generate any more new Bitcoins. Hence, Bitcoins will be limited in supply and this will arrest the problem of hyperinflation.
History of Bitcoin
Bitcoin was conceptualized by Satoshi Nakamoto in 2008. We do not know whether it is a person or a group of people. This anonymous person or group of persons still remains a mystery. What we know is that Nakamoto has claimed to be a man living in Japan born on April 15th, 1975. However, there are a lot of theories and speculation about the identity of Nakamoto. Some people say that the identity of Nakamoto is based on a number of cryptography and computer science experts living in the US and the EU, not necessarily Japanese people. In November 2017, Nakamoto was believed to own up to roughly 1 million Bitcoins, the value of this 1 million comes to be 7.2 billion US dollars, which is a huge amount of money owned by someone who is not known to anybody in the world.
Alternative cryptocurrencies to Bitcoin
Altcoins is an alternate cryptocurrency to Bitcoin. Once Bitcoin became popular, people realized the value, robustness, and flexibility Bitcoin brought and also started liking the fact that Bitcoin appreciated in value. They simply took the source code of the Bitcoin protocol available from GitHub repositories, forked it, modified it as per their needs, and created alternative cryptocurrencies. With the increasing popularity of Bitcoin, the usage and rate of Bitcoin have skyrocketed. Leaving that aside, the next question that arises is "how do we store or possess this virtual currency securely in digital form?".
Bitcoin wallets
There are several types of wallet available, in which we can hold our Bitcoins safely. Each of these wallets has their own function and ways to operate.
The different kinds of the wallet are as follows:
- Software wallet: The software wallet is a Bitcoin application that sits on your computer's hard drive and allows you to completely control and secure your Bitcoins. Bitcoin Armory is an example of a software wallet and is supposed to be the most stable and secure wallet of all.
- Web wallet: The next type of wallet is a web wallet. Web wallets are more convenient than software wallets since they can be accessed to use your funds, Bitcoins, or assets from any device. So, you can access your web wallet on your Android or iOS device, your desktop and even on the internet.
- Cold wallet: The next type of wallet is called a cold wallet. Cold wallets are simply any kind of Bitcoin wallet that is not connected to the internet. These can be in paper form, or you can have wallets on USB drives as well.
- Brain wallet: The next type of wallet is the brain wallet. The brain wallet has its address generated by a computer program by hashing the passphrase with words that the user enters.
- Hardware wallet: The next type of wallet is the hardware wallet. The hardware wallet can only be accessed through physical contact with the wallet by the designated person, who owns the wallet. It stores the user's private keys in a secure hardware drive that is accessible only to the user and usually uses a fingerprint scanner or biometrics to access it.