Book Image

Foundations of Blockchain

By : Koshik Raj
Book Image

Foundations of Blockchain

By: Koshik Raj

Overview of this book

Blockchain technology is a combination of three popular concepts: cryptography, peer-to-peer networking, and game theory. This book is for anyone who wants to dive into blockchain from first principles and learn how decentralized applications and cryptocurrencies really work. This book begins with an overview of blockchain technology, including key definitions, its purposes and characteristics, so you can assess the full potential of blockchain. All essential aspects of cryptography are then presented, as the backbone of blockchain. For readers who want to study the underlying algorithms of blockchain, you’ll see Python implementations throughout. You’ll then learn how blockchain architecture can create decentralized applications. You’ll see how blockchain achieves decentralization through peer-to-peer networking, and how a simple blockchain can be built in a P2P network. You’ll learn how these elements can implement a cryptocurrency such as Bitcoin, and the wider applications of blockchain work through smart contracts. Blockchain optimization techniques, and blockchain security strategies are then presented. To complete this foundation, we consider blockchain applications in the financial and non-financial sectors, and also analyze the future of blockchain. A study of blockchain use cases includes supply chains, payment systems, crowdfunding, and DAOs, which rounds out your foundation in blockchain technology.
Table of Contents (14 chapters)

History of blockchain

We know that blockchain technology now has its main application where the tracking of transactions or events in a decentralized network is concerned; currently, the greatest scope to be found for this use case is in the area of finance. However, as a matter of fact, blockchain technology didn't appear as we know it and use it today until quite recently. The first ever idea of maintaining a chain of blocks to construct a tamper-proof timestamp of digital documents came about in 1991. But the concept wasn't popularized until an author with the pseudonym of Satoshi Nakamoto – whose identity is still not known today – showcased blockchains and their true use in decentralized networks in 2008, by publishing a paper titled Bitcoin: A Peer-to-Peer Electronic Cash System (https://bitcoin.org/bitcoin.pdf).

Later, in 2009, a reference implementation of blockchain technology was created by Satoshi Nakamoto. This was called Bitcoin. This was the first – and still remains the most popular – implementation of a blockchain-based electronic cash system. Satoshi took inspiration from several previous inventions, such as b-money and Hashcash, to create a decentralized digital currency.

Note: Although Bitcoin was responsible for the cryptocurrency revolution, there were several attempts to popularize electronic cash using cryptographic protocols that predated it. DigiCash is one such popular attempt from an American scientist named David Chaum. There was also a decentralized digital currency called Bit Gold, which was proposed by Nick Szabo, that had a similar architecture to Bitcoin.

Bitcoin was released in 2009 when Satoshi made the first transaction, which was inserted into the first block of the Bitcoin blockchain. This block is called the genesis block, and is the proof of the entire blockchain's legitimacy. Satoshi stopped contributing to the Bitcoin project in 2011 and is now allowing the open community to contribute to the project. Since then, it has grown from being a fairly simple digital currency to a resilient protocol that has become the reference implementation for every blockchain application. Although Bitcoin's market value is volatile, it's nearing the market value of $200 billion US dollars as of late 2018, which is almost half of the entire cryptocurrency market.

Bitcoin was the first decentralized digital currency to solve the problem of the double-spending attack. Maintaining an open distributed blockchain with a consensus for validating the block was the main thing that made Bitcoin a practically implementable decentralized currency. Bitcoin made use of a consensus algorithm called the proof-of-work (PoW) algorithm to prove that a node has actually worked to create a new block of the blockchain. This concept was also applied in an implementation called Hashcash, which was proposed to limit email spam by forcing the spammer to do some work before sending each email. This system prevented spammers from sending email in bulk, as a computation task was required before each email was sent. All the receiver needed to do was verify the work done by the sender. Similarly, the PoW consensus algorithm implemented in Bitcoin prevents any node from flooding the blockchain with its own created blocks, thus preventing any single entity from dominating the blockchain.

Blockchain 2.0

Bitcoin was what really gave birth to blockchain technology, and since then, several new applications of the distributed blockchain database have emerged, most notably during early 2014. This era is widely known as the era of blockchain 2.0. Namecoin was one of the first concepts to emerge. It expanded the scope of Bitcoin's blockchain and was introduced as a distributed naming system based on Bitcoin. However, unlike Bitcoin, it was able to store data as key-value pairs in the public blockchain. This concept influenced a number of blockchain 2.0 applications that would go on to gain popularity.

One of the most popular enhancements that came with blockchain 2.0 was the introduction of smart contracts. Several blockchain platforms were developed that allowed the user to write higher-level scripts and not worry about the actual blockchain implementation. One of the platforms that was most successful in doing this was Ethereum, which was proposed in late 2013 by Vitalik Buterin. The intention of Ethereum was to make the best use of the technology that Bitcoin used. Bitcoin's initial implementation was intended for the flow of digital currency. Now, although a scripting language was implemented for other applications, such as asset transfer, it was very primitive and only had a few use cases. Vitalik Buterin, the co-founder of Ethereum, suggested that Bitcoin needed a scripting language for decentralized application development in order to increase its scope. Failing to gain agreement, Vitalik proposed the development of a new platform with a more general scripting language. This platform, Ethereum, gained popularity due to the implementation of smart contracts in its environment. Smart contracts are high-level scripts that run on the Ethereum Virtual Machine (EVM). A number of decentralized applications have been developed using the Ethereum platform.

The Ethereum platform inspired developers to come up with a framework that would use Bitcoin's core protocol and build a platform to develop decentralized applications. This was a revolutionary approach, as the technology would be used to modify any application where having a third party would be both expensive and redundant.

In fact, there are plenty of motives that drive developers to integrate blockchain technology in their existing applications. In the next section, we'll explain this in more depth.

Several blockchain platforms have been created to build scalable decentralized applications; some of the most popular ones are listed here:

  • Corda: This is a distributed ledger platform designed to record, manage, and automate legal agreements between business partners. It was designed by R3 in collaboration with the world's biggest financial institutions, which makes Corda suitable for financial enterprises shifting toward distributed ledger technology.
  • Hyperledger: This is an open source effort to advance cross-industry blockchain technologies. It's hosted by the Linux Foundation and achieves collaboration between various industries and organizations. IBM and Intel, for instance, are active contributors to Hyperledger projects. There are a number of Hyperledger projects, all aimed at solving different enterprise-level problems using blockchain.
  • Multichain: This is a simple and powerful private blockchain framework that is compatible with Bitcoin. It has support for complete asset cycle management. Due to its support for access control, it's an ideal framework for developing permissioned blockchain applications.
  • NEO: Formerly known as Antshares, this application is often called "the Ethereum of China." It uses blockchain technology and digital identity to digitize assets.