Configuring Hyperledger Sawtooth Validator and REST API on AWS


Configuring Hyperledger Sawtooth Validator and REST API on AWS

Recipe ID: hsts-r19


Recipe Overview

Hyperledger Sawtooth is an enterprise blockchain platform for building distributed ledger applications and networks. The design philosophy targets keeping ledgers distributed and making smart contracts safe, particularly for enterprise use.
Sawtooth simplifies blockchain application development by separating the core system from the application domain. Application developers can specify the business rules appropriate for their application, using the language of their choice, without needing to know the underlying design of the core system.
Sawtooth is also highly modular. This modularity enables enterprises and consortia to make policy decisions that they are best equipped to make. Sawtooth’s core design allows applications to choose the transaction rules, permissioning, and consensus algorithms that support their unique business needs.

For those who are not familiar with Hyperledger project Intro to Hyperledger Family and Hyperledger Blockchain Ecosystem and Hyperledger Design Philosophy and Framework Architecture articles are strongly recommended.
To better follow and understand this recipe, it is advisable to read Essential Hyperledger Sawtooth Features for Enterprise Blockchain Developers and Blockchain Developer Guide- How to Install and work with Hyperledger Sawtooth articles in advance.
This recipe will demonstrate how to configure the Hyperledger Sawtooth Validator, the REST API, and much more on Amazon Web Services or AWS.

Configure Hyperledger Sawtooth

Execute the following steps to configure Hyperledger Sawtooth

1. The Sawtooth validator default configuration file can be found at /etc/sawtooth/validator.toml. To set the network bind port and other component bind ports, use the following command:

bind = [
"network:tcp://127.0.0.1:8800",

"component:tcp://127.0.0.1:4004"

]

2. To set the peer discovery type and peer validator nodes, enter the following:
peering = "static"
peers = ["tcp://127.0.0.1:8801"]

3. You can find the Sawtooth REST API service default configurations file at /etc/sawtooth/rest_api.toml. To set the REST API service host and port, enter the following command:
bind = ["127.0.0.1:8008"]

4. To set the validator connecting point, enter the following:
connect = "tcp://localhost:4004"

5. Sawtooth distributes the example configuration files on EC2. When you view, create, or edit Sawtooth configuration files, you need to use sudo and verify that the Sawtooth user has permission to access these files:

sudo nano validator.toml

sudo chmod 777 validator.toml

6. To check the configuration files used by the validator, you can verify them in the validator log file:

less /var/log/sawtooth/validator-debug.log

This is shown in the following screenshot:
Hyperledger sawtooth rest api

 

Put Things Together
The Hyperledger Sawtooth base configuration files include the following:

The path to these configuration files depends on whether the SAWTOOTH_HOM environment variable is set. When SAWTOOTH_HOME is set, the directories will be as follows:

By default, the configuration files for Sawtooth on EC2 are as follows: 

Now that you learned how to configure Hyperledger Sawtooth (Validator and REST API) on AWS, you can move on to the next three steps:  Designing namespace and address for Hyperledger Sawtooth transaction family , Building Transaction Handler and Processor for Hyperledger Sawtooth and Building Transaction Processor Service and Python Egg for Hyperledger Sawtooth.

The following recipes are excellent resources for installing other Hyperledger tools:

Blockchain Developer Guide- How to Install and work with Hyperledger Sawtooth
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 Burrow on AWS
Blockchain Developer Guide- How to Install Hyperledger Seth and Docker on AWS
Blockchain Developer Guide- How to Install Hyperledger Indy and Indy CLI 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 tutorial 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!