What’s the Hype About Hyperledger Sawtooth

Hyperledger Sawtooth is an open source Blockchain platform founded by the Linux Foundation’s open-source blockchain project, Hyperledger. Proposed by Intel, it is an enterprise-grade distributed ledger and was one of the first projects under the Hyperledger Umbrella.

With a pluggable consensus model, Hyperledger Sawtooth is :

  1. Modular
  2. Scalable
  3. Supports Permissionless and Permissioned Infrastructure.

Its underlying design is aimed at keeping ledgers distributed and adding business logic to smart contracts.

In many standard blockchain based platforms, applications and core are executed and hosted on their platform, that may cause performance issues and security concerns.

However, Hyperledger Sawtooth is different from such platforms in a way that it isolates the core ledger system from the application specific environment. As a result, it simplifies the application development yet keeps the system safe and secure.

With Sawtooth’s modular architecture, developers can develop applications in the programming language of their choice and can host, run and operate it on system periphery without hindering the core blockchain system.

An application on Hyperledger Sawtooth can be based on a core business logic to run business operations, or it can be built and run as a smart contract virtual machine with a self-governing mechanism to create, notify and execute the contracts between various members on the blockchain network.

Sawtooth’s core system allows both of these applications to co-exist, allowing different types of applications to stay in the same instance of the blockchain network.

Applications on Sawtooth can select transaction rules, define the consensus mechanisms and select the required permissioning to decide the working of the digital ledger in a way that it meets the requirements of an enterprise.

Being extremely scalable. Hyperledger Sawtooth can offer high transaction throughput of data and is, therefore, a great option for handling production supply chains.

Features of Hyperledger Sawtooth

The blockchain manages the settings that specify identities and roles so that participants within the network can access the information on the network.

Transactions in Sawtooth are executed parallelly to prevent double spending even with several modifications to the same state. This type of scheduling leads to the potential increase in performance as compared to serial execution.

It supports the following consensus implementations:

**Proof of Elapsed Time (PoET):**It is a Nakamoto-style consensus, designed as a production-grade protocol that can support large network populations. Relying on a secure instruction execution, it can achieve the scalability of Nakamoto-style consensus mechanism without the drawbacks of power consumption of the PoW algorithm.

**PoET Simulator:**It enables PoET-style consensus on any hardware and a virtualized cloud environment.

**Dev mode:**It is a simplified random-leader mechanism used for development and testing.

Getting started with Hyperledger Sawtooth Application Development?

Image Source: Hyperledger Sawtooth Documentation

You will have to set up and execute a local validator to test your application before you start developing an application on Hyperledger Sawtooth platform. Once the network will be running, you can conduct new transactions and fetch the block data and resulting state from the blockchain via Sawtooth REST API and HTTP.

Sawtooth validators can run from prebuilt Docker containers which are installed using Ubuntu 16.904 or deployed in AWS from the AWS marketplace.

We will walk you through the process of Hyperledger Sawtooth Application Development using Docker Compose.

Installing Docker Engine and Docker Compose

**Windows:**Docker Compose can be installed automatically when you install Docker Engine on Windows.

**Linux:**On the Linux operating system, you will need to install both Docker Engine and Docker Compose.

**macOS:**On macOS, you will have to install the latest version of the Docker Engine. Similar to Windows, Docker Compose is also installed automatically with Docker Engine on macOS.

Setting up Environment

A Docker Compose file is provided to state the process for building a Sawtooth environment. The Sawtooth environment comprises of the following containers:

Docker Compose file also represents the container images to obtain from Docker Hub and the network settings required for containers to interact correctly.

The Docker Compose File serves as the basis for the multi-container Sawtooth application development environment. Download the Docker Compose File and set up the environment for the development of Sawtooth application.

Starting up the Sawtooth environment involves the following tasks:

Downloading of the docker images may take a few minutes. After you find the containers registering and building initial blocks, move to the next step.

In case the environment needs to be stopped or reset, you need to log out of the client container to return to the default state and then press CTRL- C from the Windows system where you initially executed docker-compose.

How to Create and Submit transactions to the Sawtooth network

Sawtooth provides the intkey command to make sample transactions of the IntegerKey (intkey) transaction type for testing. This method uses intkey for preparing batches of intkey transactions that assign a few keys to random values, then increase and decrease those values randomly.

These batches are stored locally and distributed to the validator within the network.

Run the mentioned-below commands from the client container:

$ intkey create_batch — count 10 — key-count 5 $ intkey load -f batches.intkey -U http://rest-api:8008The terminal window where you ran the docker-compose command will start logging output as a validator and intkey transaction processor manages the transactions submitted recently.

Rather than using intkey load, you can also use “sawtooth batch submit” command to submit transactions. For instance, submit the transactions in batches.intkey file with the command:

$ sawtooth batch submit -f batches.intkey — url http://rest-api:8008

Viewing the Blockchain

Following are the different commands for viewing the block, list of blocks, a specific block and global state:

Connecting to the REST API

Use the command “$ curl http://rest-api:8008/blocks" to ensure that you can connect to the REST API via the host.

To connect the REST API from the host, use the command: “$ curl http://localhost:8008/blocks".

Due to the potential of Hyperledger Sawtooth to build modular and scalable blockchain apps, it is being used widely by blockchain companies to provide blockchain business solutions to enterprises and startups.

Shameless Plug a.k.a Our Work on Hyperledger Sawtooth

We have built a distributed ledger platform called TraceRx on the Hyperledger Sawtooth that enables end-to-end traceability across the pharma supply chain on the blockchain. The platform allows UNO to track the distribution of free aid and perform recalls quickly.

Image Source: LeewayHertz

At LeewayHertz, we have a team of Blockchain Consultants who can assist companies and individuals interested in advancing their business operations with distributed ledger technology.

<a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a>