Know Hyperledger Fabric? Then moving to Sawtooth is easy

Varun Raj
Varun Raj, Co-founder and CTO
Know Hyperledger Fabric? Then moving to Sawtooth is easy

I’ve been using both Hyperledger Fabric and Sawtooth for sometime now. While they’re both great frameworks, they each have their own nicks and workarounds. In this article I aim to draw both the framework differences so that you can choose what suits you best.

Transaction Processor & Chaincode

One of the main advantages of Sawtooth is that the “smart contract” or transaction processors (as called in the Sawtooth world) can be written in wide verity of languages like Rust, Python or JavaScript. Migrating transaction processors to the chain is also different compared to Fabric.

Validators vs Endorsement Peers

The process of validating a transaction in Fabric involves a set of endorsing peers defined by the endorsement policy. After validation, the distribution of the transaction is handled by ordering services.

However in the Sawtooth architecture, there are validators which take care of validating the transactions in the network as well as distributing the transaction to other peers.

The State Store

Each framework handles maintaining the state of the blockchain network in its own way.

Hyperledger Fabric stores the data in either leveldb or couchdb based on the setup and manages a ledger per channel.

In the case of Sawtooth, all the data is stored in a specific address and this address is generated based on the corresponding transaction processor’s prefix. For handling rich queries an instance of rethinkdb is setup and the ledger is replicated and synced with rethinkdb.

Component Topology

Hyperledger Fabric has a lot of components which function together to form a blockchain network. This includes Orderers, Peers, CAs, CouchDB and Tools.

But in the case of Sawtooth there is only three majors components which are Sawtooth Validator, Transaction Processors and the REST API for the Transaction Processors. This reduces the complexity of the network and brings more scalability.

Language Support

In order to write a Smart Contract on Hyperledger Fabric one has to rely on either GoLang or Javascript as no other languages are supported.

In Sawtooth, there is support for a wide variety of languages which helps organisations adopt it much more quickly. The support languages include Go, JavaScript, Python, Java and Rust. The most preferred language by the Sawtooth team is Rust since it provides native multi threading and comes with C level performance.