You might have definitely come across the word Hyperledger if you were looking for an enterprise-grade blockchain platform. Sawtooth is one of the popular projects under the Hyperledger consortium. Proposed by Intel in the year 2014, Hyperledger Sawtooth was initially designed for imparting an application that is safer for enterprise use. Later it joined with the Linux Foundation to form its present shape, making it a perfect solution for developing networks and distributed ledger technologies. Today many enterprises are using this incredible platform as it offers exactly what businesses want. The enterprises are given the adaptability to pick their own private rules.

Hyperledger Fabric is another project in the Hyperledger consortium. Here is a quick comparison of Fabric with Sawtooth.

Being highly modular, Sawtooth remains highly flexible in action and therein perfectly fits into the shoes of any enterprise model. It helps the business partners to make the right business decisions via building their own transaction rules, consensus algorithms, and permission policies. More so, Sawtooth also provides SDKs in various programming languages for the developers to develop applications in their own comfortable languages be it JavaScript, Python, Java, C++, Rust, Go, or any other. Hyperledger Sawtooth thus definitely remains a flexible environment for any business use case.

Components of a Sawtooth Application

Sawtooth introduces the concept of transaction families. A transaction family can be considered as a decentralized application in Sawtooth World. A transaction family includes the following components:

  • Client: module that handles the client logic of the application. The client is responsible for creating and signing transactions, combining those transactions into batches, and submitting them to the validator. This client can be a web application, mobile app, or even a command-line interface.
  • Transaction processor: which defines the business logic of the application. The transaction processor is responsible for registering with the validator, handling transaction requests, and getting/setting state as needed. This is a smart contract equivalent in Sawtooth. A single transaction family may have more than one transaction processor.
  • Data model: to store and retrieve data, usually referred to as a state.

HelloWorld Application

Now that you got a brief on Hyperledger Sawtooth, let’s get to the next step of running an application on Sawtooth. For this, we will be using a simple Hello World application in Sawtooth. Using this application, you will be able to, run a Sawtooth test network and run an Express application where you could write some data to the Sawtooth blockchain and retrieve it. This demo app is developed with the help of JavaScript SDK in Sawtooth. By running this application you will get a general idea about the working of a Sawtooth application.

We already saw that a Sawtooth application or a Transaction Family consists of a client, transaction processor and state. In our example, the client-side application is used to input and view text data. Then a transaction processor to handle writing and reading from the blockchain. The input text will be stored in a state. We will be using Docker to run this application.

Let’s see how it is structured in our sample application.

HelloWorld application is built with two parts,

  • Client – The client is a Node.js application (in express) which provides a web user interface for the user to ‘write’ a message and then ‘read’ it. In the HelloWorld application, helloworldClient directory contains the client logic. The app.js is the main javascript file from where the main function call occurs. Handlebars are used for templating, client-related CSS and JavaScript code is written in the public folder, and server related files are written in routes/ folder. The application dependencies and the commands to be executed are included in DockerFile.
  • Transaction Processor – The helloworldprocessor directory contains the business logic. HelloWorldProcessor.js is a generic class for communicating with a validator and routing transaction processing requests to a registered handler. HelloWorldHandler.js is the handler class that contains the business logic for the particular family of transactions.
  • The data is stored at a 70 hex digit address in the state.

Now let’s see how to run the HelloWorld application.

For that, you need certain prerequisites.


This example uses Docker Compose and Docker containers. For installing Docker Engine and Docker Compose, please follow instructions in the provided links:

Docker: Install Docker

Docker Compose: Install Docker Compose

NOTE: The recommended OS environment is Ubuntu Linux 18.04 LTS x64. Although other Linux distributions which support Docker should work.

Running the HelloWorld Application

1. Download or clone the HelloWorld application from GitHub link:

git clone

2. Open a command terminal and navigate to the directory where the HelloWorld-Sawtooth code is present.

cd HelloWorld-Sawtooth

3. Run the following command to start the HelloWorld application in the Sawtooth Docker environment.

sudo docker-compose up

4. Open a browser and go to http://localhost:3000

Now the user can enter the message in the textbox and click the Write button. It will store the data in state and you can retrieve the message by clicking Read button.

When the ‘Write’ button is clicked, the corresponding transactions are reflected in the validator window.

5. For viewing the block, transaction and state details, open a new window in the browser and give the following URLs.

a. Enter http://localhost:8008/blocks to view the block details.

b. Enter http://localhost:8008/transactions to view the transaction details.

c. Enter http://localhost:8008/state to view the state details.

6. Stopping the Sawtooth Environment

  1.  To stop the validator and destroy the containers, press CTRL+C from the terminal where we originally ran docker-compose.yaml file.
  2.  After all the containers have shut down, run the following docker-compose command:

sudo docker-compose down

c. To clean up all the docker containers, give the command.

sudo docker container prune

To conclude, Hyperledger Sawtooth is a modular enterprise blockchain platform that makes seamless the process of building, deploying, and running distributed ledgers. The design philosophy makes it enterprise safe and highly versatile. The network follows a novel consensus algorithm, Proof of Elapsed Time (PoET), that demands minimal resource consumption, making it feasible for any business size. But in our example we followed a simple developer mode(devmode) consensus, which is only for development and testing purposes.