Introduction to Hyperledger Sawtooth

Reading Time: 4 minutes

Hyperledger Sawtooth is Hyperledger’s open-source blockchain platform, following closely on Hyperledger Fabric. It is an enterprise distributed ledger proposed by Intel and was one of the first projects to join Linux Foundation’s Hyperledger umbrella. This platform is modular, scalable, with an innovative consensus model, has unique support for permissioned and permissionless infrastructure and the potential for incredibly large network sizes.

An application can be native business logic or a smart contract virtual machine. Sawtooth allows both of these applications co-exist, thus allowing multiple types of applications to be in the same instance of the blockchain network. It also simplifies blockchain application development by separating the core system from the application domain.

Hyperledger Sawtooth is extremely scalable and is able to withstand high throughput of data, which makes it a great option for production supply chain scenarios and comes with a lot of features like:

  1. Distributed: There is no centralised data storage and thus the data is distributed among all the participants. All the nodes in the network has identical information with them.
  2. Immutable: The data, once stored in the blockchain, cannot be altered. There exists block hashes to detect any attempt to chain the history.
  3. Secure: Since the transactions are made between untrusted parties, they are verified and signed by known identities that are part of the blockchain itself.
  4. Permissioned as well as permissionless infrastructure: It allows to build both permissioned as well as permissionless blockchains depending upon the use case. In case of permissionless blockchain, anybody can participate in the network whereas in case when the network is permissioned, prospective participants must identify themselves to the network and the network can decide whether to let them participate. Once in the network, participants share a view of the blockchain ledger.
  5. Parallel transaction execution: Along with serial scheduler, it also has an advanced parallel scheduler that allows parallel execution of transactions. Thus, increasing the performance.
  6. Modular: It provides a modular platform for transaction-based updates to shared state (data) between untrusted parties.
  7. Hardware integration: In addition to certain public blockchain features, hyperledger sawtooth has become known for the ease with which it can be integrated with hardware security solutions.

Consensus Implementation:

Consensus is the backbone of every blockchain platform and Hyperledger Sawtooth provides three consensus implementations i.e. Dev_mode, PoEt, PoEt Simulator, with a forth under active development i.e. RAFT. Here, we will be discussing about one of its main consensus algorithm i.e. Proof Of Elapsed Time(PoET).

Proof Of Elapsed Time(PoET):

In Hyperledger Sawtooth, consensus is a way of selecting the  leader of the new block that is to be added in the blockchain. PoEt is the default consensus for sawtooth. There are two simple rules in this consensus:

  • Each participant in the blockchain network waits a random amount of time.
  • The first participant to finish waiting gets to be leader for the new block.

In order to ensure that the consensus is fair, it relies on the special CPU instruction set provided by the intel i.e. Intel Software Guard Extensions (SGX). SGX allows applications to run trusted code in a protected environment. For PoET, the trusted code is what ensures that these two requirements are satisfied .

Note: In SGX, a special hardware component ensures that some particular trusted code was set up correctly in a protected environment. This particular code runs in private from rest of the application.

Installation Of Hyperledger Sawtooth Using Docker:

Step 1 : Install curl:

sudo apt-get install curl

Step 2 : Install Node.js:

sudo apt-get update
sudo apt-get install nodejs

Step 3 : Install npm:

sudo apt-get install npm

Step 4 : Install docker:

sudo apt-get install docker-ce
sudo apt-get install docker-ce=<VERSION>

Step 5 : Install docker-compose from the below mentioned link:

https://github.com/docker/compose/releases

Starting Hyperledger Sawtooth

Step 1: Download the following Docker Compose file as sawtooth-default.yaml at https://raw.githubusercontent.com/hyperledger/education/master/LFS171x/sawtooth-material/sawtooth-default.yaml

Or you can use any other docker-compose file depending upon your use case.

Step 2: Change your working directory to the same directory where the sawtooth-default.yaml Docker Compose file is saved. Make sure you do not have anything else running on port 8080 and port 4004.

Step 3: Run the following command:

docker-compose -f sawtooth-default.yaml up

This command will download the Docker images that comprise the Hyperledger Sawtooth demo environment.

Step 4: Open a new terminal window and navigate to the same directory. In order to connect to the client container, run the following command:

docker exec -it sawtooth-client-default bash

In your terminal, we will see something similar to the following:

root@75b380886502:/#

Here, the container name was sawtooth-client-default. Similarly, other containers can also be run by changing the container name.

Step 5: To confirm that the validator is up and running and reachable from the client container, run the following command:

curl http://rest-api:8080/blocks

After running this command, we should see a json object response with “data”, array of batches, header, etc.

Step 6: to check the connectivity from the host computer, run the following command in a new terminal window:

curl http://localhost:8080/blocks

After running this command, we should see a json object response with “data”, array of batches, header, etc.

Stopping hyperledger Sawtooth:

Step 1: Press Ctrl+C from the window where you originally ran docker-composeYou will see containers stopping.

Step 2: Finally, run the following command:

docker-compose -f sawtooth-default.yaml down

I hope this was helpful. In my next blog, we will be exploring the architecture of Hyperledger Sawtooth.

References:

https://sawtooth.hyperledger.org/docs/core/releases/1.0/

knoldus-advt-sticker

1 thought on “Introduction to Hyperledger Sawtooth5 min read

Comments are closed.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading