Book Image

Advanced Blockchain Development

By : Imran Bashir, Narayan Prusty
Book Image

Advanced Blockchain Development

By: Imran Bashir, Narayan Prusty

Overview of this book

Blockchain technology is a distributed ledger with applications in industries such as finance, government, and media. This Learning Path is your guide to building blockchain networks using Ethereum, JavaScript, and Solidity. You will get started by understanding the technical foundations of blockchain technology, including distributed systems, cryptography and how this digital ledger keeps data secure. Further into the chapters, you’ll gain insights into developing applications using Ethereum and Hyperledger. As you build on your knowledge of Ether security, mining, smart contracts, and Solidity, you’ll learn how to create robust and secure applications that run exactly as programmed without being affected by fraud, censorship, or third-party interference. Toward the concluding chapters, you’ll explore how blockchain solutions can be implemented in applications such as IoT apps, in addition to its use in currencies. This Learning Path also highlights how you can increase blockchain scalability, and discusses the future scope of this fascinating and powerful technology. By the end of this Learning Path, you'll be equipped with the skills you need to tackle pain points encountered in the blockchain life cycle and confidently design and deploy decentralized applications.
Table of Contents (25 chapters)
Title Page
Copyright and Credits
About Packt
Contributors
Preface
15
Blockchain - Outside of Currencies
16
Scalability and Other Challenges
Index

Preface

Blockchain technology is a distributed ledger with applications in industries such as finance, government, and media. This Learning Path is your guide to building blockchain networks using Ethereum, JavaScript, and Solidity. You will get started by understanding the technical foundations of blockchain technology, including distributed systems, cryptography and how this digital ledger keeps data secure. Further into the chapters, you’ll gain insights into developing applications using Ethereum and Hyperledger. As you build on your knowledge of Ether security, mining , smart contracts, and Solidity, you’ll learn how to create robust and secure applications that run exactly as programmed without being affected by fraud, censorship, or third-party interference. Toward the concluding chapters, you’ll explore how blockchain solutions can be implemented in applications such as IoT apps, in addition to its use in currencies. The book will also highlight how you can increase blockchain scalability and even discusses the future scope of this fascinating and powerful technology. By the end of this Learning Path, you'll be equipped with the skills you need to tackle pain points encountered in the blockchain life cycle and confidently design and deploy decentralized applications. This Learning Path includes content from the following Packt products:

  • Mastering Blockchain - Second Edition by Imran Bashir
  • Building Blockchain Projects by Narayan Prusty

Who this book is for

This Learning Path is designed for blockchain developers who want to build decentralized applications and smart contracts from scratch using Hyperledger. Basic familiarity with any programming language will be useful to get started with this course

What this book covers

Chapter 1, Blockchain 101, introduces the basic concepts of distributed computing on which blockchain technology is based. It also covers history, definitions, features, types, and benefits of blockchains along with various consensus mechanisms that are at the core of the blockchain technology.

Chapter 2, Decentralization, covers the concept of decentralization and its relationship with blockchain technology. Various methods and platforms that can be used to decentralize a process or a system have also been introduced.

Chapter 3, Understanding How Ethereum Works, explains how Ethereum works.

Chapter 4, Smart Contracts, provides an in-depth discussion on smart contracts. Topics such as history, the definition of smart contracts, Ricardian contracts, Oracles, and the theoretical aspects of smart contracts are presented in this chapter.

Chapter 5, Symmetric Cryptography, introduces the theoretical foundations of symmetric cryptography, which is necessary to understand how various security services such as confidentiality and integrity are provided.

Chapter 6, Public Key Cryptography, introduces concepts such as public and private keys, digital signatures and hash functions with practical examples. Finally, an introduction to financial markets is also included as there are many interesting use cases for blockchain technology in the financial sector.

Chapter 7, Getting Started with web3.js, introduces web3js and how to import and connect to geth.  It also explains how to use it in Node.js or client-side JavaScript.

Chapter 8, Introducing Bitcoin, covers Bitcoin, the first and largest blockchain. It introduces technical concepts related to bitcoin cryptocurrency in detail.

Chapter 9, Building a Wallet Service, explains how to build a wallet service that users can use to create and manage Ethereum Wallets easily, even offline. We will specifically use the LightWallet library to achieve this.

Chapter 10, Alternative Coins, introduces alternative cryptocurrencies that were introduced after the invention of Bitcoin. It also presents examples of different altcoins, their properties, and how they have been developed and implemented.

Chapter 11, Development Tools and Frameworks, provides a detailed practical introduction to the Solidity programming language and different relevant tools and frameworks that are used for Ethereum development.

Chapter 12, Building a Betting App, explains how to use Oraclize to make HTTP requests from Ethereum smart contracts to access data from the World Wide Web. We will also learn how to access files stored in IPFS, use the strings library to work with strings, and more.

Chapter 13, Hyperledger, presents a discussion about the Hyperledger project from the Linux Foundation, which includes different blockchain projects introduced by its members.

Chapter 14, Alternative Blockchains, introduces alternative blockchain solutions and platforms. It provides technical details and features of alternative blockchains and relevant platforms.

Chapter 15, Blockchain - Outside of Currencies, provides a practical and detailed introduction to applications of blockchain technology in fields others than cryptocurrencies, including Internet of Things, government, media, and finance.

Chapter 16, Scalability and Other Challenges, is dedicated to a discussion of the challenges faced by blockchain technology and how to address them.

Chapter 17, Building a Consortium Blockchain, will discuss consortium blockchain.

Chapter 18, Current Landscape and What's Next, is aimed at providing information about the current landscape, projects, and research efforts related to blockchain technology. Also, some predictions based on the current state of blockchain technology have been made.

To get the most out of this book

You require Windows 7 SP1+, 8, 10 or Mac OS X 10.8+, examples in this book have been developed on Ubuntu 16.04.1 LTS (Xenial) and macOS version 10.13.2. As such, it is recommended to use Ubuntu or any other Unix like system. However, any appropriate operating system, either Windows or Linux, can be used, but examples, especially those related to installation, may need to be changed accordingly.

Examples related to cryptography have been developed using the OpenSSL 1.0.2g 1 Mar 2016 command-line tool.

Ethereum Solidity examples have been developed using Remix IDE, available online at https:/ / remix. ethereum. org

Ethereum Byzantine release is used to develop Ethereum-related examples. At the time of writing, this is the latest version available and can be downloaded from https:/ / www. ethereum. org/ .

Examples related to IoT have been developed using a Raspberry Pi kit by Vilros, but any aapropriate latest model or kit can be used. Specifically, Raspberry Pi 3 Model B V 1.2 has been used to build the hardware example of IoT. Node.js V8.9.3 and npm V5.5.1 have been used to download related packages and run Node js server for IoT examples.

The Truffle framework has been used in some examples of smart contract deployment, and is available at http://truffleframework.com/. Any latest version available via npm should be appropriate.

Download the example code files

You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packt.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packt.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/TrainingByPackt/Advanced-Blockchain-Development .In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalogue of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/9781838823191_ColorImages.pdf

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "The input() method is used to get an input from the user."

A block of code is set as follows:

pragma solidity ^0.4.0;
contract TestStruct {
  struct Trade
  {
    uint tradeid;
    uint quantity;
    uint price;
    string trader;
  }
  //This struct can be initialized and used as below
  Trade tStruct = Trade({tradeid:123, quantity:1, price:1,
trader:"equinox"});
}

Any command-line input or output is written as follows:

$ sudo apt-get install solc

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "If you need something different, click on the DOWNLOADS link in the header for all possible downloads:"

Note

Warnings or important notes appear like this.

Note

Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packt.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packt.com.