An Overview of the Hyperledger Sawtooth Framework

1
6017

Hyperledger Sawtooth is a modular platform for building, deploying and running distributed ledgers, which provide digital records (such as asset ownership) that are maintained without a central authority or implementation. Let’s take a quick look at it.

Hyperledger Sawtooth is a blockchain framework that uses a modular platform for building, deploying and running distributed ledgers. Such distributed ledger solutions can use various consensus algorithms, depending on the size of the network. Initially contributed by Intel, Hyperledger Sawtooth uses the Proof of Elapsed Time (PoET) consensus algorithm, which provides the scalability of the Bitcoin blockchain without the high energy consumption. PoET allows for a highly scalable network of validator nodes. Hyperledger Sawtooth is designed for versatility, with support for both permissioned and permissionless deployments.

Sawtooth is the only Hyperledger project that provides the distributed state agreement, which means that you can trust every node in the system to understand information in the same way. It is the only framework that provides the ability to create adapters for any kind of transaction logic which means, for instance, that you can now run Ethereum Virtual Machine code, like Solidity, compile it and then run that on a Sawtooth based network.

The functional elements of Hyperledger Sawtooth

Transaction validators validate transactions. In Hyperledger Sawtooth, validators apply blocks that cause a change in the state. More specifically, validators validate transaction blocks and ensure that transactions result in state changes that are consistent across all participants in the network.

Transaction families are smart contracts in Hyperledger Sawtooth. They define the operations that can be applied to transactions. This allows for flexibility in the level of versatility and risk that exists on a network. Transaction families are often called ‘safer’ smart contracts, because they specify a predefined set of acceptable smart contract templates, as opposed to programming smart contracts from scratch. Hyperledger Sawtooth’s transaction families can be written in many languages, including JavaScript, Java, C++, Python and Go, which allows flexibility for businesses to bring their own transaction families. Transaction families consist of both transaction processors (the server-side logic) and clients (for use from Web or mobile applications).

Hyperledger Sawtooth organisations run a node that interacts with the Hyperledger Sawtooth network. Each node runs at least three things:

  • The main validator process
  • The REST service listening for requests
  • One or more transaction processors

Each organisation that enters the Hyperledger Sawtooth network runs at least one node and receives transactions submitted by fellow nodes.

A transaction processor is the server-side business logic of transaction families, which acts upon network assets. Hyperledger Sawtooth supports pluggable transaction processors that are customisable based on the specific application. Each node within the Hyperledger Sawtooth network runs a transaction processor, which processes incoming transactions submitted by authorised clients.

Figure 1: The consensus interface in Sawtooth

Transaction batches are clusters of transactions that are either all committed to state or are all not committed to state. As a result, transaction batches are often described as an atomic unit of change, since a group of transactions is treated as one and is committed to the state, as one. Every single transaction in Hyperledger Sawtooth is submitted within a batch. Batches can contain as little as a single transaction.

In Hyperledger Sawtooth, the journal maintains and extends the blockchain for the validator. It is responsible for validating candidate blocks, evaluating valid blocks to determine if they are the correct chain head and for generating new blocks to extend the chain. Transaction batches arrive at the journal, where they are evaluated, validated and added to the blockchain. Additionally, the journal resolves forks, which occur due to disagreements over who commits a block. Once blocks are completed, they are delivered to the ChainController for validation and fork resolution.

The network layer is responsible for communicating between validators in a Hyperledger Sawtooth network, including performing initial connectivity, peer discovery and message handling.

The global state contains the current state of the ledger and a chain of transaction invocations. The state for all transaction families is represented on each validator.

The process of block validation on each validator ensures that the same transactions result in the same state transitions and that the resulting data is the same for all participants in the network. The state is split into namespaces, which allow flexibility for transaction family authors to define, share and reuse global state data between transaction processors.

The consensus interface in Sawtooth

Consensus in Hyperledger Sawtooth is modular, which means that the consensus algorithm can be easily modified. Hyperledger Sawtooth provides an abstract interface that supports both PBFT and Nakamoto-style algorithms. To implement a new consensus algorithm in Hyperledger Sawtooth, you must implement the distinct interface for the following.

  • Block publisher: This creates new candidate blocks to extend the chain.
  • Block verifier: This verifies that candidate blocks are published in accordance with consensus rules.
  • Fork resolver: This chooses which fork to use as the chain head for consensus algorithms that result in a fork.

These interfaces are used by the journal component. The journal verifies that all the dependencies for the transaction batches are satisfied. When verified, completed batches are checked for validity and fork resolution and then, they are published within a block.

Introducing Proof of Elapsed Time (PoET)

The consensus algorithm commonly used in a Hyperledger Sawtooth network is the Proof of Elapsed Time, or PoET, which impartially determines who will commit a transaction to state using a lottery function that elects a leader from many different distributed nodes.

Hyperledger Sawtooth’s PoET algorithm differs from the Proof of Work (PoW) algorithm implemented by the Bitcoin blockchain in that PoW relies on vast amounts of power, while PoET is able to ensure trust and randomness in electing a leader, without the high power consumption. PoET allows for increased scalability and participation, as every node in the network has an equal opportunity to create the next block on the chain.

How Proof of Elapsed Time (PoET) works

To start with, each validator within the network requests a wait time from an enclave or a trusted function. This is where the ‘elapsed time’ comes into play. The validator with the shortest waiting period for a specific block is appointed the leader and creates the block to be committed to the ledger. As a result, a truly random leader is elected and the amount of power or type of hardware you have will not give you an advantage. Using simple functions, the network can verify that the winning validator did indeed ‘win’, by proving that it had the shortest time to wait before assuming the leadership position.

Proof of Elapsed Time is revolutionary in its ability to achieve distributed consensus using a lottery function. This not only allows for easy verification and fairness within the network, but also for incredible scalability. Without the heavy costs of participating in consensus, any block can participate in the network. One of Hyperledger Sawtooth’s main advantages is that it allows the size of the network to scale, i.e., with PoET it can nearly support limitless nodes in the network.

Use cases

Hyperledger Sawtooth is a blockchain framework with potential in IoT, manufacturing, finance and enterprises. It supports diverse requirements, including both permissioned and permissionless deployments and a pluggable consensus algorithm. This framework also provides a revolutionary consensus algorithm, Proof of Elapsed Time (PoET), that allows for versatility and scalability suited for a variety of solutions which can be broadly classified with different infrastructural requirements, such as:

  • Permissioned and permissionless infrastructure
  • Modular blockchain architecture
  • Scalability, which is good for larger blockchain networks due to higher throughput
  • Many languages for transaction logic

Hyperledger Sawtooth is an open source project, where ideas and code can be publicly discussed, created and reviewed. All code is available on GitHub and there are a number of ways that you can get involved with the Hyperledger community, participate on the mailing lists, start or join a meetup or join the discussion on Rocket.Chat, as the following references indicate.

1 COMMENT

  1. The best and most simple resource to understand the concept of hyperlerledger sawtooth that I have come across on the internet.

LEAVE A REPLY

Please enter your comment!
Please enter your name here