Hyperledger Sawtooth Tutorial For Beginners

0

Many of you are now working on enterprise-based blockchain projects. High-end companies are investing so much money into blockchain digital transformation. Those of you who are interested in using Hyperledger Sawtooth as the base of your project needs to follow a Hyperledger Sawtooth tutorial first.

Thus, to help you out, I’m here with a guide on the Hyperledger Sawtooth tutorial. Hyperledger Sawtooth architecture is beginning to flourish into a robust platform for blockchain transformation. In reality, many companies are now using Hyperledger Sawtooth architecture extensively.

So, if you want to become a Hyperledger Sawtooth developer, then this guide will offer you the path you need to follow.

Anyhow, enough with the chit-chat, let’s start this Hyperledger Sawtooth tutorial for beginners now!

hyperledger sawtooth tutorial

What Is Hyperledger Sawtooth?

Before I begin the tutorial on Hyperledger Sawtooth, I want to briefly explain what this platform actually is. In reality, Hyperledger Sawtooth is a distributed ledger platform under the consortium Hyperledger. If you are familiar with Fabric, then you’ll see that both of these platforms have similarities.

Anyhow, Hyperledger Sawtooth is designed in a way that will help you develop decentralized platforms or applications.

Furthermore, the design is flawless with a user-friendly tone for helping any enterprise company use this platform.

More so, you will see once you start with the Hyperledger Sawtooth tutorial that it offers a very smooth experience. The best part is that their development layer is completely detached from the mainframe. But why, though?

Well, it’s mainly because of the excessive load you can put into the main network due to the development that it can hamper the overall performance.

Thus, to keep the performance always on the upper hand, they separated the two layers. Therefore, no matter what you do, you can’t degrade the performance of the main network. You’ll see more of these from the Hyperledger Sawtooth tutorial.

Another great feature of this platform is that it does support a variety of programming languages. So, for the developers, it’s absolutely necessary to check out Hyperledger Sawtooth tutorial in order to learn how to use every single programming language.

Anyhow, Hyperledger offers a very enriching and descriptive tutorial on Hyperledger Sawtooth. So, you can also use that to learn more about it. In this Hyperledger Sawtooth tutorial guide, you’ll get a brief explanation of the elements and steps you need to follow.

Anyway, let’s move on to the architectural design of Hyperledger Sawtooth.

 

Read More:
Hyperledger Sawtooth Vs. Fabric: How Are They Different?
Hyperledger Fabric Vs Sawtooth Vs Composer

What Are the Core Elements Hyperledger Sawtooth Architecture?

To learn Hyperledger Sawtooth, you have to start with understanding the core architectural models of this platform. So, without a proper knowledge base, it’ll be hard to focus on the tutorial.

  • The Event System

Let’s start with the event system. If you check out any Hyperledger Sawtooth example, you’ll see that the event system mainly ensures that events are developed without any issues and relayed to nodes.

So, if you use this, you can make your application to subscribe to events that will fetch new information for you. Usually, these events help run the Sawtooth platform better. Therefore, it helps in maintain full consensus by helping the nodes get the information they need from the events.

 

  • Sawtooth-Ethereum Integration Project (Seth)

It’s one of the best features of Sawtooth. To learn Hyperledger Sawtooth, you have to know about this feature as well. Also, you can find it in any Hyperledger Sawtooth example that is using Ethereum properties.

But what does it do really? And how can they use Ethereum properties? Well, this little element helps to close the gap between the two platforms. Therefore, you can attain interoperability between these two platforms using this element.

Can you imagine the countless opportunities Seth can bring to the table? Anyway, it’s a great addition to the Hyperledger Sawtooth architecture, and you should use it if your enterprise project needs it.

 

  • Pluggable Consensus Algorithms

Another cool element of the Hyperledger Sawtooth architecture is the support of pluggable consensus mechanisms. In reality, the pluggable consensus mechanism is a wonderful new feature in the blockchain industry.

More so, it allows you to choose the consensus mechanism you need for your platform. Obviously, not every single consensus is suitable for any kind of use case. That’s why you need flexibility in developing a project based on enterprise blockchain.

Thus, the pluggable consensus of Sawtooth really introduces the dynamics to the table.

When you check out a Hyperledger Sawtooth example, you can learn about Hyperledger Sawtooth more easily.

Anyhow, this means that you won’t have to use a single consensus protocol in your design. You can change it when you want and when it’s necessary. Also, there’s an option to use different consensus protocols for different actions on the system.

They mainly offer –

  • Devmode
  • PoET CFT
  • Raft
  • PBFT

There are other consensus protocols coming in the upcoming updates. So, if your favorite one isn’t on the list, you just have to wait for their updates. Anyhow, let’s move on to the next section to learn about Hyperledger Sawtooth.

 

  • Transaction Family Models

If you want to learn about Hyperledger Sawtooth, you have to understand how their transaction family works. In reality, transaction families actually help out in operation multiple functions, including offering your smart contract features.

If you check out any Hyperledger Sawtooth example, you’ll notice that you can’t operate the system without using the transaction families.

So, they are really important in this tutorial as well.

Anyways, let’s check them out from below:

  • BlockInfo Transaction Family: The BlockInfo transaction family will help you store any kind of information about the blocks.
  • Smallbank Transaction Family: In reality, this family is suited to test out and analyze the quality of your business
  • Settings Transaction Family: More so, Settings family will help you store on-chain configurations and even offer you a specific reference model for that.
  • Validator Registry Transaction Family: You can use this to add more validators to the system. In reality, without using this, you can’t add any validators. So, it’s extremely necessary.
  • IntegerKey Transaction Family: This is one of the best transaction families that lets you test out all the deployed ledgers without any extra resources.
  • XO Transaction Family: Well, this is more of a fun take on the whole network. The developers of Sawtooth wanted to add a little bit spark to the network, and that’s why they added a game of tic-tac-toe in it as well. Therefore, using this, you can play with any node.
  • Identity Transaction Family: Mainly, it’s for preserving data. Well, specifically, the permissioned data for validators. More so, it preserves information about the nodes such as their public keys and so on.

 

You will see two other transaction families on the system as well. These are fairly newer additions.

 

Seth Transaction Family:

The Seth transaction family will offer you the feature of using Ethereum based application on the network. It means you can use Solidity based smart contracts or even other applications based on that.

 

Sabre Transaction Family:

It’s another take on smart contracts. In reality, you can use this to run smart contracts on WebAssembly virtual machines or WASM virtual machines. More so, it allows you to run smart contracts on the chain.

 

Hyperledger Sawtooth Tutorial: Let’s Learn the Basics!

Now, let’s start the tutorial on Hyperledger Sawtooth. Here, you will mostly learn about the basic requirements of setting up nodes for testing out the platform. More so, I’ll further briefly explain all essential CLI commands later in the guide as well.

If you want, you can use this article as a Hyperledger Sawtooth Tutorial pdf and learn about the technology better.

If you want to pursue a career as a Hyperledger Sawtooth developer, then learning about it extremely crucial.

Anyhow, let’s start the tutorial on Hyperledger Sawtooth now.

Setting Up Sawtooth Node for Testing

First of all, you have to set up nodes before you can start developing the platform. Therefore, once you set up the node and it’s live you can then test out the application. So, for that, you have to submit transaction requests and see the results and the block data from REST API.

Anyhow, the methods below are mainly suited for typical transaction processes, XO, and IntegerKey families. If you can write a new transaction family, you can also run it using the method.

More so, you can install and run only a single node Sawtooth network using three methods – a native Ubuntu installation, Docker containers, and a virtual machine with the Kubernetes cluster.

If you are a Hyperledger Sawtooth developer, you should pay extra attention to these little details.

 

Using Docker

For this tutorial on Hyperledger Sawtooth, you have to follow the steps below after you set up a node using Docker.

  • Check the status of the Sawtooth network components.
  • Use various Sawtooth commands to display block data, submit transactions, and view the global state.
  • Examine the Sawtooth logs as well.
  • Stop the network and reset the Docker environment.

 

Prerequisites

In reality, you will need Docker Compose and Docker Engine for this environment to work.

Linux: You have to download the latest edition of Docker Composer and Docker Engine for Linux.

Windows: You have to download the latest edition of Docker Composer and Docker Engine for Windows.

macOS: You have to download the latest edition of Docker Composer and Docker Engine for macOS.

 

Using Kubernetes

For this tutorial on Hyperledger Sawtooth, you have to follow the steps below after you set up a node using Kubernetes. In reality, this environment will require using Minikube for deploying Sawtooth in a containerized environment. Basically, it will be inside a virtual machine within a local cluster of Kubernetes.

Basically, you can do the following once you check out the official tutorial.

  • Install the Minikube and kubectl.
  • Start the Minikube.
  • After that, start the Sawtooth application in the Kubernetes cluster.
  • Next, connect the Sawtooth shell container.
  • After that, use the CLI commands to submit transactions, view global state, and block data.
  • Once you see these, you can examine the Sawtooth logs.
  • Anyhow, once you are done, you can stop the network by deleting the Kubernetes cluster.

 

Prerequisites

In reality, you will need Minikube and kubectl that support a VM hypervisor. In this case, you can use VirtualBox.

 

Using Ubuntu

For this tutorial, the Hyperledger Sawtooth developer has to follow the steps below after you set up a node using Ubuntu 18.04.

 

  • Start by generating a user key.
  • After that, generate a root key.
  • Next, create the genesis block.
  • Once you are done, you have to start the components – transaction processes, REST API, consensus engine, and validator.
  • Next, check the REST API status.
  • After that, use the CLI commands to submit transactions, view global state, and block data.
  • Once you see these, you can examine the Sawtooth logs.
  • When finished, you need to stop the network and reset the development environment.

 

Prerequisites

For this, you will only need the Ubuntu 18.04 (Bionic). More so, it won’t work on any other old version than this.

 

Hyperledger Sawtooth Tutorial: Advanced Guidelines

Creating A Network with Multiple Sawtooth Nodes

This process is mainly for setting up multiple nodes and creating a mesh of network. Therefore, in this setup, you can see the real results of Sawtooth with as many nodes as you like. More so, it’s a great way to test put your application’s scalability nature.

Furthermore, just like the single node Sawtooth network setup, this one also follows three methods – a native Ubuntu installation, Docker containers, and a virtual machine with Kubernetes cluster.

That’s why it’s in this Hyperledger Sawtooth tutorial for beginners just to give you the basic guideline.

 

Using Docker

This process will mainly help you set up five Sawtooth nodes and create a development environment for your application. In reality, every single node is actually a set of Docker containers. More so, every single node will run a validator and other components of Sawtooth.

Mainly in their tutorial, you can learn how to:

  • Download the Docker Compose file of Sawtooth.
  • Use the cocker-compose to start the Sawtooth network.
  • Check process status.
  • Configure the transaction types that are allowed.
  • Connect to the Sawtooth shell container. After that, learn how to confirm the network functionalities.
  • Once you are done, stop the network and reset the Docker environment.

 

Prerequisites

You will need Docker Compose and Docker Engine for this environment to work.

Linux: You have to download the latest edition of Docker Composer and Docker Engine (v 1.2.5) for Linux.

Windows: You have to download the latest edition of Docker Composer and Docker Engine (v 1.2.5) for Windows.

macOS: You have to download the latest edition of Docker Composer and Docker Engine (v 1.2.5) for macOS.

By any chance you didn’t reset the Docker environment for the single node network, then you have to shut it down and delete all the logs and data.

 

Using Kubernetes

This is a very important part of this Hyperledger Sawtooth tutorial for beginners. In reality, this process will mainly help you set up five Sawtooth nodes and create a development environment for your application. In reality, every single node is actually a Kubernetes pod.

More so, every single pod is a container for a validator and other components of Sawtooth.

Furthermore, in their Hyperledger Sawtooth tutorial for beginners, you can learn how to:

  • Install the Minikube and kubectl.
  • Start the Minikube.
  • Download the configuration files.
  • After that, start the Sawtooth application in the Kubernetes cluster.
  • Next, connect the Sawtooth shell container.
  • After that, make sure to confirm the network functionality.
  • Once you see these configure the transaction types that are allowed
  • Anyhow, once you are done, you can stop the network by deleting the Kubernetes cluster.

 

Prerequisites

For this, you will need Minikube and kubectl that support a VM hypervisor. In this case, you can use VirtualBox.

 

Using Ubuntu

This is also a very important part of this Hyperledger Sawtooth tutorial for beginners. In reality, this process will help you set up create a development environment for on an Ubuntu platform. In reality, every host system is actually a node that runs a validator and other components of Sawtooth.

Mainly in their tutorial for beginners, you have to do the followings:

  • Install the Sawtooth
  • Start by generating user and validator keys.
  • Next, create the genesis block and include specific consensuses such as PoET or PBFT.
  • Once you are done, you have to start Sawtooth on every node.
  • After that, make sure to confirm the network functionality.
  • Once you see these configure the transaction types that are allowed
  • When finished, you need to stop the network and reset the development environment.

 

Prerequisites

By any chance you didn’t reset the Ubuntu environment for the single node network, then you have to shut it down and delete all the logs and data. Or else your mesh of network won’t start!

 

Using the Sawtooth SDKs

Here, you’ll see a summarization of all the supported SDKs in Sawtooth. You can see the stability, maturity, and completeness for transaction processes, client signing, and state delta features.

Python JavaScript C++ Go Rust Swift Java
Transaction Processor Complete? N/A
Stable API? N/A
Maturity 1 2 3 1 1 N/A 3
Client Signing Complete?
Stable API?
Maturity 1 1 3 1 1 3 3
State Delta Complete? N/A
Stable API? N/A
Maturity 1 2 3 1 1 N/A 3

 

Subscribing to Events

Well, all the blocks are attached to the blockchain, so any developer may need information about certain events for the applications. Therefore, you need events to relay this information about a new block or new fork.

But you have to include application-specific events. In reality, mainly custom transaction families can ensure that you are subscribed to certain events.

With your application subscribing to certain events you can do the followings –

  • Subscribe to certain events that affect your application or the blockchain
  • Relay information to the clients about the transaction execution without storing any of the data in state
  • Catch-up on events from a specific point in the network about state changes to gather information

In reality, your application can store information about certain events for later use or event react immediately.

 

Important Sawtooth CLI Commands

There are some important Sawtooth CLI commands that you need to learn about before you start using this platform. I’ll briefly explain them below.

  • Sawtooth batch

This is a command that will help you see the information about the Batches on the network. More so, you can submit Batches to the validator as well using the REST API.

Note: A batch is actually a group of transactions that are interdependent and the atomic unit of change in the network.

  • Sawtooth block

In reality, you can use this command to see the information about the blocks on the platform.

  • Sawtooth identity

“Sawtooth identity” is a command that lets you see what roles nodes are playing on the platform. More so, you can also create new roles, set up new policies, and so on.

  • Sawtooth peer

In reality, this command lets you see the address of a certain validator peer.

  • Sawtooth settings

If you want to check out the on-chain setting’s value then you can use the command “ Sawtooth settings.”

  • Sawtooth state

In reality, you can use this command to see the information of the entries in the current state.

  • Sawtooth status

You can use this command to see the information relating to the validator’s status.

  • Sawtooth transaction

If you want to see the information about the transactions, then you can use this command.

  • Sawtooth-validator

You can easily control the behaviors of the validators using this command.

  • sawadm

The “sawadm” command is mainly for administrative roles. More so, you can use this to create a validator key when you are setting up the platform. You can also create the genesis block as well.

  • sawnet

In reality, you can use this command to interact with all the nodes of the network.

  • sawset

This is mainly suited for settings proposals. Well, using Sawtooth, you can actually store all the settings on-chain. So, using this command, you can view, create, vote on proposals. More so, you can develop setting values for the genesis block as well.

  • settings-tp

In reality, this command will offer you a methodology in the settings transaction processor for storing configuration data on-chain.

 

Hyperledger Sawtooth Dominating the Industries

We’ve reached the ending point of our Hyperledger Sawtooth tutorial. Anyhow, i’ve gathered all the information you need to get you started with Hyperledger Sawtooth. More so, you may need additional help with the tutorial, so I’d suggest you check out their official tutorial to get a more descriptive approach.

If you want, you can keep this article as a Hyperledger Sawtooth tutorial pdf for later study purposes as well.

Also, if you are looking into blockchain digital transformation, then I will suggest you check out our blockchain courses along with that.

Our courses are jam-packed with blockchain transformation guidelines, and I’m sure that you will find these courses more than helpful. So, check them out now!


About Author

An engineer, a gadget-freak, and a perfection fanatic – the ideal combination of a tech-nerd! This Enterprise Blockchain Analyst seems to have an unfathomable interest in blockchains, which makes him perfect for sharing his new discoveries on 101 Blockchains.

Leave A Reply