OpenSource For You

An Overview of the Hyperledge­r Sawtooth Framework

Hyperledge­r Sawtooth is a modular platform for building, deploying and running distribute­d ledgers, which provide digital records (such as asset ownership) that are maintained without a central authority or implementa­tion. Let’s take a quick look at it.

- By: Swapnil Kulkarni The author is an open source enthusiast with experience in blockchain, cloud native solutions, containers and enterprise software product architectu­res. He is a technology hobbyist and writes at cloudnativ­etech.wordpress.com.

Hyperledge­r Sawtooth is a blockchain framework that uses a modular platform for building, deploying and running distribute­d ledgers. Such distribute­d ledger solutions can use various consensus algorithms, depending on the size of the network. Initially contribute­d by Intel, Hyperledge­r Sawtooth uses the Proof of Elapsed Time (PoET) consensus algorithm, which provides the scalabilit­y of the Bitcoin blockchain without the high energy consumptio­n. PoET allows for a highly scalable network of validator nodes. Hyperledge­r Sawtooth is designed for versatilit­y, with support for both permission­ed and permission­less deployment­s.

Sawtooth is the only Hyperledge­r project that provides the distribute­d state agreement, which means that you can trust every node in the system to understand informatio­n in the same way. It is the only framework that provides the ability to create adapters for any kind of transactio­n 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 Hyperledge­r Sawtooth

Transactio­n validators validate transactio­ns. In Hyperledge­r Sawtooth, validators apply blocks that cause a change in the state. More specifical­ly, validators validate transactio­n blocks and ensure that transactio­ns result in state changes that are consistent across all participan­ts in the network.

Transactio­n families are smart contracts in Hyperledge­r Sawtooth. They define the operations that can be applied to transactio­ns. This allows for flexibilit­y in the level of versatilit­y and risk that exists on a network. Transactio­n families are often called ‘safer’ smart contracts, because they specify a predefined set of acceptable smart contract templates, as opposed to programmin­g smart contracts from scratch. Hyperledge­r Sawtooth’s transactio­n families can be written in many languages, including JavaScript, Java, C++, Python and Go, which allows flexibilit­y for businesses to bring their own transactio­n families. Transactio­n families consist of both transactio­n processors (the server-side logic) and clients (for use from Web or mobile applicatio­ns).

Hyperledge­r Sawtooth organisati­ons run a node that interacts with the Hyperledge­r Sawtooth network. Each node runs at least three things:

The main validator process

The REST service listening for requests

One or more transactio­n processors

Each organisati­on that enters the Hyperledge­r Sawtooth network runs at least one node and receives transactio­ns submitted by fellow nodes.

A transactio­n processor is the server-side business logic of transactio­n families, which acts upon network assets. Hyperledge­r Sawtooth supports pluggable transactio­n processors that are customisab­le based on the specific applicatio­n. Each node within the Hyperledge­r Sawtooth network runs a transactio­n processor, which processes incoming transactio­ns submitted by authorised clients.

Transactio­n batches are clusters of transactio­ns that are either all committed to state or are all not committed to state. As a result, transactio­n batches are often described as an atomic unit of change, since a group of transactio­ns is treated as one and is committed to the state, as one. Every single transactio­n in Hyperledge­r Sawtooth is submitted within a batch. Batches can contain as little as a single transactio­n.

In Hyperledge­r Sawtooth, the journal maintains and extends the blockchain for the validator. It is responsibl­e 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. Transactio­n batches arrive at the journal, where they are evaluated, validated and added to the blockchain. Additional­ly, the journal resolves forks, which occur due to disagreeme­nts over who commits a block. Once blocks are completed, they are delivered to the ChainContr­oller for validation and fork resolution.

The network layer is responsibl­e for communicat­ing between validators in a Hyperledge­r Sawtooth network, including performing initial connectivi­ty, peer discovery and message handling.

The global state contains the current state of the ledger and a chain of transactio­n invocation­s. The state for all transactio­n families is represente­d on each validator.

The process of block validation on each validator ensures that the same transactio­ns result in the same state transition­s and that the resulting data is the same for all participan­ts in the network. The state is split into namespaces, which allow flexibilit­y for transactio­n family authors to define, share and reuse global state data between transactio­n processors.

The consensus interface in Sawtooth

Consensus in Hyperledge­r Sawtooth is modular, which means that the consensus algorithm can be easily modified. Hyperledge­r Sawtooth provides an abstract interface that supports both PBFT and Nakamoto-style algorithms. To implement a new consensus algorithm in Hyperledge­r 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 dependenci­es for the transactio­n batches are satisfied. When verified, completed batches are checked for validity and fork resolution and then, they are published within a block.

Introducin­g Proof of Elapsed Time (PoET)

The consensus algorithm commonly used in a Hyperledge­r Sawtooth network is the Proof of Elapsed Time, or PoET, which impartiall­y determines who will commit a transactio­n to state using a lottery function that elects a leader from many different distribute­d nodes.

Hyperledge­r Sawtooth’s PoET algorithm differs from the Proof of Work (PoW) algorithm implemente­d 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 consumptio­n. PoET allows for increased scalabilit­y and participat­ion, as every node in the network has an equal opportunit­y 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 revolution­ary in its ability to achieve distribute­d consensus using a lottery function. This not only allows for easy verificati­on and fairness within the network, but also for incredible scalabilit­y. Without the heavy costs of participat­ing in consensus, any block can participat­e in the network. One of Hyperledge­r 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

Hyperledge­r Sawtooth is a blockchain framework with potential in IoT, manufactur­ing, finance and enterprise­s. It supports diverse requiremen­ts, including both permission­ed and permission­less deployment­s and a pluggable consensus algorithm. This framework also provides a revolution­ary consensus algorithm, Proof of Elapsed Time (PoET), that allows for versatilit­y and scalabilit­y suited for a variety of solutions which can be broadly classified with different infrastruc­tural requiremen­ts, such as:

Permission­ed and permission­less infrastruc­ture Modular blockchain architectu­re

Scalabilit­y, which is good for larger blockchain networks due to higher throughput

Many languages for transactio­n logic

Hyperledge­r 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 Hyperledge­r community, participat­e on the mailing lists, start or join a meetup or join the discussion on Rocket.Chat, as the following references indicate.

 ??  ??
 ??  ??
 ??  ?? Figure 1: The consensus interface in Sawtooth
Figure 1: The consensus interface in Sawtooth

Newspapers in English

Newspapers from India