Hyperledger Cookbook
eBook - ePub

Hyperledger Cookbook

Over 40 recipes implementing the latest Hyperledger blockchain frameworks and tools

  1. 310 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Hyperledger Cookbook

Over 40 recipes implementing the latest Hyperledger blockchain frameworks and tools

About this book

Explore the entire Hyperledger blockchain family, including frameworks such as Fabric, Sawtooth, Indy, Burrow, and Iroha; and tools such as Composer, Explorer, and Caliper.

Key Features

  • Plan, design, and create a full-fledged private decentralized application using Hyperledger services
  • Master the ins and outs of the Hyperledger network using real-world examples
  • Packed with problem-solution-based recipes to tackle pain areas in the blockchain development cycle

Book Description

Hyperledger is an open-source project and creates private blockchain applications for a range of domains. This book will be your desk reference as you explore common and not-so-common challenges faced while building blockchain networks using Hyperledger services.

We'll work through all Hyperledger platform modules to understand their services and features and build end-to-end blockchain applications using various frameworks and tools supported by Hyperledger. This book's independent, recipe-based approach (packed with real-world examples) will familiarize you with the blockchain development cycle. From modeling a business network to integrating with various tools, you will cover it all. We'll cover common and not-so-common challenges faced in the blockchain life cycle. Later, we'll delve into how we can interact with the Hyperledger Fabric blockchain, covering all the principles you need to master, such as chaincode, smart contracts, and much more. We'll also address the scalability and security issues currently faced in blockchain development.

By the end of this book, you will be able to implement each recipe to plan, design, and create a full-fledged, private, decentralized application to meet organizational needs.

What you will learn

  • Create the most popular permissioned blockchain network with Fabric and Composer
  • Build permissioned and permission-less blockchains using Sawtooth
  • Utilize built-in Iroha asset/account management with role-based permissions
  • Implement and run Ethereum smart contracts with Burrow
  • Get to grips with security and scalability in Hyperledger
  • Explore and view blockchain data using Hyperledger Explorer
  • Produce reports containing performance indicators and benchmarks using Caliper

Who this book is for

This book is for blockchain developers who want to understand how they can apply Hyperledger services in their day-to-day projects. This book uses a recipe-based approach to help you use Hyperledger to build powerful, decentralized autonomous applications. We assume the reader has a basic knowledge of the Blockchain technology and cryptography concepts

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access Hyperledger Cookbook by Xun (Brian) Wu, Chuanfeng Zhang, Andrew Zhang in PDF and/or ePUB format, as well as other popular books in Computer Science & Cryptography. We have over one million books available in our catalogue for you to explore.

Information

Working with Hyperledger Sawtooth

Hyperledger Sawtooth is an enterprise blockchain platform with which to build, deploy, and run decentralized applications (dApps) with a highly modular architecture. Hyperledger Sawtooth originated from Intel and is currently an open source project under the Linux Foundation.
The main principles behind Hyperledger Sawtooth are keeping a distributed ledger, distributed data storage, a modular architecture, and a decentralized consensus; these makes smart contracts safe, particularly for enterprise organizations.
This chapter will cover the following recipes:
  • Installing Hyperledger Sawtooth
  • Configuring Hyperledger Sawtooth
  • Designing a namespace and address
  • Implementing a transaction family
  • Building a transaction processor
  • Granting permission on the Sawtooth network
  • Developing client applications with the Sawtooth REST API and SDK

Introduction

Hyperledger Sawtooth is an enterprise blockchain platform for building distributed ledger applications and private and permissioned networks that do not require centralized authority or central decision-making services. It simplifies the development of blockchain applications by separating the core system from the application domain with multi-language support.
Sawtooth is open, flexible, and extensible, allowing you to build new services such as membership, ACL, Crypto assets, and data confidentiality. Sawtooth also has a modular architecture, meaning enterprises can choose and customize transaction rules, permissioning, and plug consensus algorithms based on the organization's requirements.
The features offered by Hyperledger Sawtooth are the following:
  • A truly distributed DLT: The Hyperledger Sawtooth blockchain network is made up of validator nodes. The ledger is shared between all validator nodes and each node has the same information. They participate in a consensus to manage the network.
  • Proof of Elapsed Time (PoET) consensus and support for large-scale networks: Hyperledger Sawtooth includes a novel consensus algorithm, PoET. PoET is a Byzantine Fault-tolerance (BFT) consensus algorithm that supports large-scale networks with minimal computing and much more efficient resource consumption compared to proof of work algorithms. PoET was invented by Intel and utilizes the special CPU instruction set called Software Guard Extensions (SGX), to achieve the scaling benefits of the Nakamoto-style consensus algorithms. Each node waits for a random period of time and the first node to finish is the leader and commits the next block.
  • Fast transaction performance: Hyperledger Sawtooth keeps the latest version of assets in the global state and transactions in the block chain on each network node. This means that you can look up the state quickly to carry out CRUD actions, which provides fast transaction processing. Sawtooth requires transactions to be processed in batches and supports parallel scheduling of transactions. Parallel transaction execution not only accelerates the execution of transactions but also correctly handles the double spending problem known as Unspent Transaction Output (UTXO).
  • Support for a broad variety of languages: Sawtooth supports the implementation of transaction families (safe and smart contracts) in a wide variety of programming languages, including Python, Go, Rust, Java, and Javascript.
  • The ability to configure private, public, and consortium blockchain networks: Sawtooth can be configured with different permissions to build private, consortium, or public networks by specifying which nodes are allowed to join the validator network and participate in the consensus, and which clients are allowed to submit batches and transactions.
Sawtooth is open and flexible, allowing you to build customized solutions, such as network governance, know your customer (KYC) processes, anti-money laundering (AML), and Crypto assets, in addition to its core distribution.
The Sawtooth network is composed of the following components:
  • Validator nodes: These are peer nodes that shape the network. They are responsible for peer discovery, message communication, blockchain synchronization, managing the global state, consensus, block commits, and so on.
  • Transaction processor: This is a smart contract for processing business logic.
  • REST API: This is an API that provides the client application with the ability to interact with Validator nodes:
The Sawtooth network

Installing Hyperledger Sawtooth

This recipe will show you how to communicate with Amazon AWS using PuTTy, how to install and launch the Hyperledger Sawtooth network, and how to set up Python for developing Sawtooth applications on AWS. We will also use the Sawtooth command line to test and verify the installed Sawtooth network on AWS.

Getting ready

To set up PuTTy and Python on AWS, perform the following:
  1. Install PuTTy (from https://www.chiark.greenend.org.uk/~sgtatham/putty/) on your Windows desktop and convert the private key generated by Amazon EC2 into a putty key file using PuTTygen, following the guide that can be found at https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html.
  2. In PuTTygen, load the EC2 key file and save the private key:
  1. Run PuTTy and specify the private key file for PuTTy in Connection | SSH| Auth. Log in as ubuntu to the Sawtooth AWS instance:
  1. Set up Python. Verify that Python version 3.5 or above is pre-installed on the instance:
python3 -V
  1. Refresh the Unix package list:
sudo apt-get update
  1. Install the Python package manager, pip:
sudo apt install python3-pip
  1. Verify that pip has been installed correctly:
pip3 -V

How to do it...

The PuTTy and Python development environment is now ready on AWS. The following commands will install, launch, and verify the Sawtooth network.
  1. Subscribe to and install the Hyperledger Sawtooth product 1.0.4 (https://aws.amazon.com/marketplace/pp/B075TKQCC2) on the AWS marketplace and launch an AWS EC2 instance, which can be of the m4.2xlarge or t2.mroc type for personal development. To check whether Hyperledger Sawtooth is running on the instance, enter the following command:
systemctl list-units|grep -i sawtooth|less
Following screenshot show the list of sawtooth instances:
  1. View the Sawtooth block on the chain, as follows:
sawtooth block list
Following screenshot show the list of the sawtooth block
  1. View the Sawtooth global state as follows:
sawtooth state list
  1. Verify that the Sawtooth REST API service is working as follows:
curl http://localhost:8008/blocks
The following screenshot verifies privous comamnd:
...

Table of contents

  1. Title Page
  2. Copyright and Credits
  3. About Packt
  4. Contributors
  5. Preface
  6. Working with Hyperledger Fabric
  7. Implementing Hyperledger Fabric
  8. Modeling a Business Network Using Hyperledger Composer
  9. Integrating Hyperledger Fabric with Explorer
  10. Working with Hyperledger Sawtooth
  11. Operating an Ethereum Smart Contract with Hyperledger Burrow
  12. Working with Hyperledger Iroha
  13. Exploring the CLI with Hyperledger Indy
  14. Hyperledger Blockchain Scalability and Security
  15. Hyperledger Blockchain Ecosystem
  16. Other Books You May Enjoy