Install and Work with Hyperledger Sawtooth


Install and Work with Hyperledger Sawtooth

Recipe ID: hsts-r13


Recipe Overview

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.

For those who are not familiar with Hyperledger project, reading Blockchain Overview, Intro to Hyperledger Family and Hyperledger Blockchain Ecosystem, Hyperledger Design Philosophy and Framework Architecture, and Overview of Building Blockchain Smart Contracts in Hyperledger articles are strongly recommended beforehand.

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 recipe will only cover the installation of Hyperledger Sawtooth. After completing this recipe, you can move on i- Configuring Hyperledger Sawtooth, ii-Designing a namespace and address, iii- Implementing a transaction family, iv- Building a transaction processor, v- Granting permission on the Sawtooth network and vi- Developing client applications with the Sawtooth REST API and SDK.

Overview of Hyperledger Sawtooth Project
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:

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:

 

Installing Hyperledger Sawtooth on AWS
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.
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:

 

3. Run PuTTy and specify the private key file for PuTTy in Connection | SSH| Auth. Log in as ubuntu to the Sawtooth AWS instance:

 

4. Set up Python. Verify that Python version 3.5 or above is pre-installed on the instance:
python3 -V

5. Refresh the Unix package list:
sudo apt-get update

6. Install the Python package manager, pip:
sudo apt install python3-pip

7. Verify that pip has been installed correctly:
pip3 -V

Put Things Together
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:

 

2. View the Sawtooth block on the chain, as follows:
sawtooth block list

Following screenshot show the list of the Sawtooth block

3. View the Sawtooth global state as follows:
sawtooth state list

 

4. Verify that the Sawtooth REST API service is working as follows:
curl http://localhost:8008/blocks

The following screenshot verifies previous command:

 

5. View Sawtooth log files as follows:
ls -l1 /var/log/sawtooth

On execution of the previous command will lead you to the following screen:

 

mv /var/lib/sawtooth/genesis.batch genesis.batch.bk

sudo sawadm keygen

Congratulation! We have successfully installed Hyperledger Sawtooth on AWS. After completing this recipe, you can move on i- Configuring Hyperledger Sawtooth, ii-Designing a namespace and address, iii- Implementing a transaction family, iv- Building a transaction processor, v- Granting permission on the Sawtooth network and vi- Developing client applications with the Sawtooth REST API and SDK.

The following recipes are excellent resources for installing other Hyperledger tools:
Blockchain Developer Guide- How to Install Hyperledger Fabric on AWS
Blockchain Hyperledger Composer Business Network Modeling and Environment Setup
Blockchain Developer Guide- How to Install Hyperledger Iroha on AWS
Blockchain Developer Guide- How to Install Hyperledger Indy and Indy CLI on AWS
Blockchain Developer Guide- How to Install Hyperledger Seth and Docker on AWS
Blockchain Developer Guide- How to Install Hyperledger Burrow on AWS

To conclude this recipe, we like to recommend our Blockchain Hyperledger Development in 30 hours course to those interested in pursuing a blockchain development career. Indeed, as of this writing, Hyperledger Foundation offers the following two Hyperledger certifications: The Certified Hyperledger Fabric Administrator (CHFA) and The Certified Hyperledger Sawtooth Administrator (CHSA), both of which are highly regarded in the industry. Hyperledger Foundation is in the process of creating Hyperledger Developer certification program, which may be released in early or middle of 2020. In short, by taking our hands-on online Hyperledger class, you would be able to obtain CHFA certification.

This recipe is written by Brian Wu who is our senior Hyperledger instructor in Washington DC. His Hyperledger Cookbook with 40+ hands-on recipes is highly recommended.

Related Training Courses

Hands-on Node.JS, MongoDB and Express.js Training
Advance JavaScript, jQuery Using JSON and Ajax
Learn Hands-on Blockchain Ethereum Development & Get Certified in 30 Hrs
Learn Blockchain Hyperledger Development & Get Certified in 30 Hrs
Become Blockchain Certified Security Architect in 30 hours
Blockchain Certified Solution Architect in 30 hours
Introduction to Python Programming
Object Oriented Programming with UML


Private and Custom Tutoring

We provide private tutoring classes online and offline (at our DC site or your preferred location) with custom curriculum for almost all of our classes for $50 per hour online or $75 per hour in DC. Give us a call or submit our private tutoring registration form to discuss your needs.


View Other Classes!