Latest news about Bitcoin and all cryptocurrencies. Your daily crypto news habit.
Hyperledger Sawtooth is an open source Blockchain platform founded by the Linux Foundationâs open-source blockchain project, Hyperledger. Proposed by Intel, it is an enterprise-grade distributed ledger and was one of the first projects under the Hyperledger Umbrella.
With a pluggable consensus model, Hyperledger Sawtooth is :
- Modular
- Scalable
- Supports Permissionless and Permissioned Infrastructure.
Its underlying design is aimed at keeping ledgers distributed and adding business logic to smart contracts.
In many standard blockchain based platforms, applications and core are executed and hosted on their platform, that may cause performance issues and security concerns.
However, Hyperledger Sawtooth is different from such platforms in a way that it isolates the core ledger system from the application specific environment. As a result, it simplifies the application development yet keeps the system safe and secure.
With Sawtoothâs modular architecture, developers can develop applications in the programming language of their choice and can host, run and operate it on system periphery without hindering the core blockchain system.
An application on Hyperledger Sawtooth can be based on a core business logic to run business operations, or it can be built and run as a smart contract virtual machine with a self-governing mechanism to create, notify and execute the contracts between various members on the blockchain network.
Sawtoothâs core system allows both of these applications to co-exist, allowing different types of applications to stay in the same instance of the blockchain network.
Applications on Sawtooth can select transaction rules, define the consensus mechanisms and select the required permissioning to decide the working of the digital ledger in a way that it meets the requirements of an enterprise.
Being extremely scalable. Hyperledger Sawtooth can offer high transaction throughput of data and is, therefore, a great option for handling production supply chains.
Features of Hyperledger Sawtooth
- Private networks with the permissioning featuresSawtooth overcomes the challenges of the permissioned network as the cluster of its nodes can be deployed with isolated permissioning. No centralized service can leak confidential information or transaction patterns.
The blockchain manages the settings that specify identities and roles so that participants within the network can access the information on the network.
- Ethereum Contract Compatibility with SethThe Seth, Sawtooth-Ethereum integration project allows the interoperability of the Sawtooth platform to Ethereum. The project makes it possible for Ethereum smart contracts to get deployed to the Sawtooth platform with Seth transaction family.
- Parallel Transaction ExecutionMany blockchains need serial transaction execution to ensure consistent ordering at every node on the network. However, Sawtooth contains an advanced parallel scheduler that classifies transactions into parallel flows. Based on locations in state accessed by a transaction, Sawtooth separates the transactionsâ execution from one another while handling contextual changes.
Transactions in Sawtooth are executed parallelly to prevent double spending even with several modifications to the same state. This type of scheduling leads to the potential increase in performance as compared to serial execution.
- Isolation between the core system and the application levelHyperledger Sawtooth eases the development and deployment of an application by separating the application level from the core system level. It offers smart contract abstraction to allow developers to create contract logic in the programming language of their choice.
- Each application can define the custom transaction processors to meet the unique requirements. It provides transaction families to serve as an approach for low-level functions, like storing on-chain permissions, managing chain-wide settings and for particular applications such as saving block information and performance analysis.
- Pluggable Consensus MechanismsThe consensus mechanism is the process of coming to an agreement among a group of participants on the blockchain network. Algorithms for achieving consensus with arbitrary faults need some kind of voting among a specific set of participants. General consensus approaches comprise Nakamoto-style consensus that selects a leader through the lottery and variants of Byzantine Fault Tolerance mechanisms that run multiple rounds of explicit voting to form a consensus. Sawtooth supports multiple consensus types on the same blockchain which is chosen initially during the network setup and can be changed on a running blockchain with a transaction.
It supports the following consensus implementations:
Proof of Elapsed Time (PoET): It is a Nakamoto-style consensus, designed as a production-grade protocol that can support large network populations. Relying on a secure instruction execution, it can achieve the scalability of Nakamoto-style consensus mechanism without the drawbacks of power consumption of the PoW algorithm.
PoET Simulator:It enables PoET-style consensus on any hardware and a virtualized cloud environment.
Dev mode:It is a simplified random-leader mechanism used for development and testing.
- Sample Transaction FamiliesTransaction language and the data model are implemented in a transaction family. Though users can build custom transaction families to represent their unique requirements, Sawtooth also provides various transaction families as models:1. IntegerKey for testing deployed ledgers. 2. Identity for managing on-chain permissioning for validator and transactor keys to simplify identity management for public keysâ lists. 3. Settings to provide an implementation for saving on-chain configuration settings. 4. BlockInfo for providing an approach to store information about a number of historic blocks. 5. Smallbank for managing performance analysis for performance testing and benchmarking when doing the comparison of blockchain systemsâ performance.
Getting started with Hyperledger Sawtooth Application Development?
Image Source: Hyperledger Sawtooth Documentation
You will have to set up and execute a local validator to test your application before you start developing an application on Hyperledger Sawtooth platform. Once the network will be running, you can conduct new transactions and fetch the block data and resulting state from the blockchain via Sawtooth REST API and HTTP.
Sawtooth validators can run from prebuilt Docker containers which are installed using Ubuntu 16.904 or deployed in AWS from the AWS marketplace.
We will walk you through the process of Hyperledger Sawtooth Application Development using Docker Compose.
Installing Docker Engine and Docker Compose
Windows:Docker Compose can be installed automatically when you install Docker Engine on Windows.
Linux:On the Linux operating system, you will need to install both Docker Engine and Docker Compose.
macOS:On macOS, you will have to install the latest version of the Docker Engine. Similar to Windows, Docker Compose is also installed automatically with Docker Engine on macOS.
Setting up Environment
A Docker Compose file is provided to state the process for building a Sawtooth environment. The Sawtooth environment comprises of the following containers:
- REST API connected to the validator
- A client container to run Sawtooth commands
- A single validator that uses dev-mode consensus
- The Settings, XO transaction processors and IntegerKey
Docker Compose file also represents the container images to obtain from Docker Hub and the network settings required for containers to interact correctly.
The Docker Compose File serves as the basis for the multi-container Sawtooth application development environment. Download the Docker Compose File and set up the environment for the development of Sawtooth application.
Starting up the Sawtooth environment involves the following tasks:
- Open a terminal window.
- Switch the working directory to the same directory where you stored the Docker Compose file.
- Run the command: % docker-compose -f sawtooth-default.yaml up
Downloading of the docker images may take a few minutes. After you find the containers registering and building initial blocks, move to the next step.
In case the environment needs to be stopped or reset, you need to log out of the client container to return to the default state and then press CTRL- C from the Windows system where you initially executed docker-compose.
How to Create and Submit transactions to the Sawtooth network
Sawtooth provides the intkey command to make sample transactions of the IntegerKey (intkey) transaction type for testing. This method uses intkey for preparing batches of intkey transactions that assign a few keys to random values, then increase and decrease those values randomly.
These batches are stored locally and distributed to the validator within the network.
Run the mentioned-below commands from the client container:
$ intkey create_batchâââcount 10âââkey-count 5 $ intkey load -f batches.intkey -U http://rest-api:8008The terminal window where you ran the docker-compose command will start logging output as a validator and intkey transaction processor manages the transactions submitted recently.
Rather than using intkey load, you can also use âsawtooth batch submitâ command to submit transactions. For instance, submit the transactions in batches.intkey file with the command:
$ sawtooth batch submit -f batches.intkeyâââurl http://rest-api:8008
Viewing the Blockchain
Following are the different commands for viewing the block, list of blocks, a specific block and global state:
- sawtoothblockThis subcommand is used to see the blocks saved in the blockchain.
- sawtoothblocklistThis command is used to view the blocks stored by the state.
- sawtooth block showâââurl http://rest-api:8008 {BLOCK_ID}This command is used to view a specific blockchain using a block ID.
- sawtoothstatelistThis command is used for listing the nodes in the Merkle tree.
- sawtooth state showâââurl http://rest-api:8008 {STATE_ADDRESS}This command is used to view the data at a specific address.
Connecting to the RESTÂ API
Use the command â$ curl http://rest-api:8008/blocks" to ensure that you can connect to the REST API via the host.
To connect the REST API from the host, use the command: â$ curl http://localhost:8008/blocks".
Due to the potential of Hyperledger Sawtooth to build modular and scalable blockchain apps, it is being used widely by blockchain companies to provide blockchain business solutions to enterprises and startups.
Shameless Plug a.k.a Our Work on Hyperledger Sawtooth
We have built a distributed ledger platform called TraceRx on the Hyperledger Sawtooth that enables end-to-end traceability across the pharma supply chain on the blockchain. The platform allows UNO to track the distribution of free aid and perform recalls quickly.
At LeewayHertz, we have a team of Blockchain Consultants who can assist companies and individuals interested in advancing their business operations with distributed ledger technology.
An Introduction to Hyperledger Sawtooth and a Guide to Setting It Up was originally published in HackerNoon.com on Medium, where people are continuing the conversation by highlighting and responding to this story.
Disclaimer
The views and opinions expressed in this article are solely those of the authors and do not reflect the views of Bitcoin Insider. Every investment and trading move involves risk - this is especially true for cryptocurrencies given their volatility. We strongly advise our readers to conduct their own research when making a decision.