Installing Hyperledger Sawtooth 1.0.5 on Alibaba Cloud ECS

By Dev Bhattacharyya, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud’s incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.

Sawtooth is a powerful Permissioned Blockchain Network offering from Hyperledger. Sawtooth is primarily driven by Intel and notes and documentation are their contribution. Unlike its peer, Fabric, Sawtooth is a nimble system that runs on small containers. For Hyperledger Fabric 1.3, I had chosen an Elastic Compute Service (ECS) instance from Alibaba Cloud with Ubuntu 16.0.4 64 Bit, 2 VCPU, 4 GB RAM and 40 GB disk space. I let the two block chains co-exist on the ECS instance, besides opening the two blockchain systems to the external world.

This article is on Hyperledger Sawtooth installation and you can read about Hyperledger Fabric in a previous article. Hyperledger team has tested Sawtooth on Ubuntu 16.0.4 as we write, though there are some nightly builds that support 18.x.

CONSOLE: Set up the ECS Instance. In our case we had chosen a 64-bit Ubuntu 16.0.4 running on 2 VCPUs, 4 GB, 40 GB. You can select a downgraded version such as 1 VCPU, 2 GB RAM and 20 GB instance.

CONSOLE: Set a security group. Assign or create a new set of keys for the instance and download the keys. Ensure the keys are secure and only readable by you before using them.

LOCAL: Secure the downloaded keys.

LOCAL: SSH (Secure Shell) into your new server instance.

You should see a similar greeting:

If is not a generic Ubuntu 16.0.4 64-Bit system, you may have chosen an incorrect instance. It will be a challenge in installing Sawtooth on such an instance.

INSTANCE: Create a new user for all related installations regarding Hyperledger Sawtooth.

INSTANCE: Install Apache2 on this new server

INSTANCE: Upon successful installation of Apache, the install kit sets up a ‘htdocs’ folder where the htmls get stored.

LOCAL: After Apache’s installation, turn your attention to your local machine, fire up a web browser and check out the instance. The xx.xx.xxx.xxx represents the IPv4 address you can get from the Alibaba Cloud Console.

INSTANCE: Change the attributes and the ownership of the Web Folder.

INSTANCE: If you are planning on pointing your domain name to this instance, this is the right time make the changes to the apache configuration file.

INSTANCE: Sawtooth expects a few prerequisites installed before attempting to install and finetune itself. As you may have noticed, the ECS instance chosen is a relatively small resource intensive instance and I intend to show you what it entails to run Sawtooth without any other frills in a barebones Ubuntu 16.0.4 instance equipped with Apache.

INSTANCE: Its a good idea to take an inventory of what all you installed with Sawtooth.

For Sawtooth to perform Blockchain operations, it needs Transaction Processors, Consesus mechanism, Sawtooth CLI, REST API, SDK, Validator and some examples.

INSTANCE: You will find the steps in the Sawtooth Documentation. Some of them are repeated here. The next steps generate the public and private keys for the Validator. The Validator recognizes those Transactors who present their transactions authenticated by the public key.

INSTANCE: Now you generate the genesis batch file for the Validator.

INSTANCE: Generate the keys for the Validator.

INSTANCE: Configuring Sawtooth — If the config directory has a file named validator.toml, the configuration settings are applied when the validator starts.

  • By default, the config directory is /etc/sawtooth/
  • Sawtooth installation adds a few example files in that folder
  • Its a good start to view the folder and rename or copy the files as extension TOML.
  • TOML files are the same as YAML files. Toml convention used is similar to YAML files. Edit the toml files as necessary.

INSTANCE: Stop the services that may have auto started after the installation. Sawtooth generates many Sytemd files as part of the installatio.

INSTANCE: As part of cleanup, sometimes it is safer to the reboot the instance

LOCAL: Back to the local machine where you will need to Secure Shell back into the instance.

INSTANCE:

INSTANCE: Start the Sawtooth Validator and RESTful services

INSTANCE: Test the service if its up and running

INSTANCE: Check if Validator is using ports 8800 for other peers and 4004 for the transaction processor. The RESTful service should be listening at 8008.

INSTANCE: Continuing with our Apache installation, I am going to suggest using the LetsEncrypt service to secure the web application.

Install LetsEncrypt certificates

Edit the apache configuration file.

Now set the Apache with the new sertificates

Restart Apache

LOCAL: Check the URL on your local web browser to see if Sawtooth is accessible.

Troubleshooting

If the validator and REST-API do not show up, it maybe necessary to bring down the services, regenerate the keys and rerun the services.

Conclusion

Besides installing Hyperledger Sawtooth, this article also walks you through the steps needed to setup Apache and TLS / SSL certificates so you can access the site safely. Sawtooth as such is intended to run behind Apache and does not expose to the external world. Through the reverse proxy you can set the communications to the Sawtooth REST service.

Original Source

https://www.alibabacloud.com/blog/installing-hyperledger-sawtooth-1-0-5-on-alibaba-cloud-ecs_594985?spm=a2c41.13104002.0.0

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.