Chapter 2 Blockchain Is the New Revolution After the Internet – Understanding Cryptocurrencies

CHAPTER 2

Blockchain Is the New Revolution After the Internet

What Is a Blockchain?

The blockchain is the brainchild of Satoshi Nakamoto as referenced in Chapter 1. Satoshi used two separate words, block and chain. With time, the two words have combined into a single word blockchain. Originally, blockchain was devised for bitcoin (cryptocurrency), but it has evolved much bigger since then. A blockchain can be viewed as a publicly available digital ledger that contains a record of the transactions. This kind of database is accessible to anyone, and there is no centralized version of it. In other words, a blockchain is a decentralized technology. It is important to understand that the blockchain technology is not necessarily for financial transactions only, and it can be used wherever any uniqueness of records is required.

A blockchain is presented by Blockgeeks.com in the diagram shown on page 8.

The users of the network participate in the blockchain. This user-to-user (peer-to-peer) participation makes the blockchain centralized. This kind of recordkeeping can be extended to any business domain. The full potential of application of the blockchain technology is still under investigation. The most attractive part of the blockchain is removal of the intermediary party between two users. Currently, finances and identity management are on the top of the applications of a blockchain.

The white paper by Satoshi refers to blockchain as follows:

system based on cryptographic proof instead of trust, allowing any two willing parties to transact directly with each other without the need for a trusted third party…

Currently, most of the systems on the Internet require a third party that blockchain tends to eliminate altogether. This elimination of third-party intermediaries is certainly a threat to the conventional (and expensive) methods.

Accordingly, a blockchain can be considered to have the following attributes:

1. Consider this as a digital ledger available publicly.

2. Records in this shared ledger use encryption and decryption.

3. Timestamped creation, validation, verification, and monitoring of the transactions in a decentralized manner.

It should be noted that a blockchain does not have to exist publicly. In that case, the nodes exist in a private network with access to the distributed ledger. A blockchain is a continuously growing list of records, called blocks, linked using cryptography. A block contains a group or batch of valid transactions. A block in the blockchain has the cryptographic hash of the previous block in the blockchain. A cryptographic hash is equivalent to a digital fingerprint. This linking of the adjacent blocks forming the chain resists the modification of the data contained within the blockchain. The authentication of the records takes place with the mass collaboration by the users. This makes the blockchain a secure database where the records become almost unalterable. Conventional centralized databases have their own challenges related to data integrity and security at very high costs to the businesses that get eliminated with the use of the blockchain technology.

The data integrity of the records is an iterative process tracing back to the genesis block. Consider the genesis block as the very first block of the blockchain, also called as block 0. As mentioned earlier, cryptocurrencies are based on the open-source code that anyone may update to create newer digital currencies. A genesis block is generally hardcoded in the software, that is, already present in the base software. This is the only time, where the genesis block is not linked with any previous block via cryptographic hashes. A blockchain can be visualized as a vertical stack that is ever growing with new blocks, where every new block is back-linked with the previous one. The first block is base of this vertical stack. The latest block is called the top block. The distance between two blocks is called height.

Structure of a Blockchain

A blockchain is a chain of blocks, where a block contains a batch of transactions. A block also contains a header. The transactions are organized in a hash tree along with the hash of the root in the header. A hash tree or Merkle tree in cryptography is a hash-based data structure that is a generalization of the hash list. A Merkle tree is a tree structure in which each leaf node is a hash of a block of data, and each non-leaf node is a hash of its children. In a binary tree, a node is a leaf node if both the left and right child nodes of it are null.

Researchers Wei Cai and Victor Leung of the University of British Columbia present the blockchain structure in a simple diagram as follows:

Merkle trees are efficient due to hashes, where hashes can be viewed as ways of encoding files that are much smaller than the actual file itself. In a Merkle tree, each node has up to two children, technically known as branching factor of two. These trees facilitate efficient and secure verification of very large data structures.

How Is a Blockchain Linked to Cryptocurrencies?

A blockchain is to cryptocurrencies, what the Internet is to an e-mail. An e-mail can be sent using the Internet, though the Internet can be used for many more other purposes as well. Similarly, cryptocurrencies are built on the blockchain technology, whereas a blockchain can perform things much more than handling cryptocurrencies. The details of such usages are covered in the chapter where use cases are elaborated.

All cryptocurrencies are blockchains, but all blockchains are not cryptocurrencies. Both blockchain and cryptocurrency go hand in hand. A blockchain can be extended to anything of value, and not currency only. Blockchain is a technology, whereas cryptocurrency is an asset. Bitcoin being the first application of blockchain, the two terms bitcoin and blockchain got used inadvertently for quite some time. However, blockchain has evolved much bigger than just supporting cryptocurrencies only.

A cryptocurrency is a digital token used for a monetary transaction between two individuals. A number of nodes validate the transaction without involving any expensive third-party intermediaries. The nodes have their individual copy of the distributed ledger where various users verify whether the token is double spent or not. Also, the balance is published after the users have verified the transaction. The updated ledger gets published every 10 minutes for bitcoin. This update includes the consensus-based batch of transactions in the form of a block on top of the current tree. The users worldwide must agree to the legitimacy of the transaction. Once a block gets added to the blockchain, the balances get updated permanently.

The blockchain relies on the computer processing power of the network. The users within this network update the distributed ledger and secure the blockchain. That is why, it is important to have a variety of users worldwide. Generally speaking, a healthy blockchain exists if one group of users or an organization does not own more than 51 percent of the computers on the network. Ownership more than this potentially may lead to stop transactions, hence making the blockchain ineffective.

Technological Overview of a Blockchain

A blockchain is a chain of back-linked blocks, with each block containing a batch of transactions, where the number of transactions are set by the underlying protocol. A network of participating computers called nodes continue to add and store blocks in this blockchain. These nodes verify the transactions before adding these to the block. The nodes also solve the underlying complex mathematical problem. After these two activities, the block gets added to the blockchain with reference to the previous block.

Encryption and decryption are used for the security of the data. A mathematical formula is used to hide data using encryption, whereas decryption is used to bring the hidden data back into its original form. A blockchain uses cryptographic hashing to achieve this. The mathematical formula used to encrypt the data related to the transaction along with metadata produces the output called hash. This hash can be viewed as compact information regarding data. With the help of set of keys, the same hash gets produced.

The public key and private key play a significant role between the two users (of a transaction). The public key, as the name suggests, is available publicly, but the private key is not. The sending party uses the private key to send the data (transaction) in an encrypted form. The nodes use the public key to decrypt the sent data to ensure that there is no double spending. Double spending gains more relevance in digital currencies, as digital information can be reproduced relatively easily, which may be used twice or multiple times. To avoid this problem, the cryptographic protocol called proof-of-work (PoW) is used. This ensures that the digital currency is not used more than once by the user. A blockchain uses the SHA256 PoW function that makes the verification process hard to compute, but easy to verify, to avoid the double-spending problem. On that note, there are many PoW systems.

A cryptographic hash is a signature of the digital data, where the SHA256 function produces a 256-bit, that is, 32-byte signature of the digital data. This generated signature of a fixed length is almost unique, which cannot be decrypted back into the original data. Regardless of small or big data, the SHA256-produced signature has a fixed length always. Based on the theory of probability, there are extremely low chances to have same signature or hash due to 2^128 possible combinations.

Technically speaking, a hash pointer is used to back-link to the previous block in a blockchain. The hash pointer is a combination of the address of the previous block and the hash of the data within the previous block. This makes the blockchain very secure, as it keeps on building on previous blocks. A block header contains the block version number, current timestamp, computational problem, hash of the previous block, nonce, and hash of the Merkle root. A nonce is an integer between 0 and 4,294,967,296.

Microsoft has presented the block structure as follows:

Why Are Users Validating the Transactions?

The users on the network gets rewarded for their collaborative efforts to validate the transactions. The activity of looking for a new potential block to be added to the blockchain is called mining. The users performing the mining process are called miners. The process of mining involves compiling new recent transactions, in the form of a block and solve a comparatively difficult mathematical problem. The miners verify that the new transactions are legitimate. When a transaction gets broadcasted on the network, various miners around the world get on the task of mining. In a way, a competition starts to verify the new transactions to be part of a potential new block and solution to the computational problem. However, a winner is who is able to provide a PoW first, which the block gets added to the blockchain. The winner miner gets rewarded for this effort of mining in the form of cryptocurrency coins. The difficulty of calculating hashes increases with every iteration. This makes the digital currency increasingly scarce similar to printable currency. The underlying algorithm of the cryptocurrency poses a limit on the number of coins, for example, bitcoin can have a maximum of 21 million bitcoins as per the current algorithm.

Why Is Blockchain Gaining So Much Importance?

Many blockchain projects are underway worldwide in what is called Web 3.0. Web 1.0 was the name given to the very first form of World Wide Web. Web 2.0 came up with global sharing of information and social media. Web 3.0 has the decentralization of information at its heart. This is also called human-centered Internet because of the fact that the information is back in the hands of its rightful owners. With decentralization, middle parties are eliminated; those may have monopolized the related business domain with their own selfish motives. Overall, the end user has full control over their data and its security, and not a third party, including government.

Considering the aforementioned benefits of Web 3.0, many applications have started emerging during the past couple of years that are taking away the monopoly of existing widespread applications from big corporations. Brave, Experty, Storj, and Status are some of the examples in Web 3.0 serving the same purpose as Web 2.0 apps browser, video or audio calls, storage media, and messaging perform.

What Are the Other Uses of a Blockchain?

The blockchain technology is much bigger than supporting cryptocurrencies only. As mentioned earlier, a public blockchain is a digital register of records available in a secure and transparent manner, in a decentralized environment without needing any expensive third-party intermediaries. A blockchain is expected to have a great use in a number of fields such as identity management, supply chain management, accounting, voting, stocks, smart contracts. These usages are also referred as use cases. This topic of other uses of a blockchain is dealt with in a greater detail in Chapter 10.

What Are the Hardware or Software Requirements?

The system requirements of a blockchain in terms of hardware and software vary drastically based on the perspective. The perspectives may include those of an end-user, investor, developer developing the blockchain, and company investing in the blockchain project internally or externally. For an end-user or investor, there is no typical requirement, and a normal laptop in current use can be used. Developers need access to the relevant programming language for development. The computation power increases dramatically for the nodes performing mining to produce the PoW. This is required as the increasingly difficult level of computational problem must be solved before the PoW-supported block can be added to the blockchain.

Why Do I Really Need to Know About It?

In the current digital era in the making of Web 3.0, where a blockchain or decentralization is focused on bringing control from the big corporations to the end-user, it is certainly of interest to anyone who would like to see reduced costs of operations while being in a safe and secured environment, where the transactions take place in an efficient and quicker manner.