Safety, Performance and Innovation: Rust in Hyperledger Sawtooth

Hello, fellow Rustaceans and those curious about Rust. The Hyperledger Sawtooth team is using Rust for new development, so these are exciting times for both Rust and Hyperledger Sawtooth. Rust is a new language that is quickly growing in popularity. The Hyperledger Sawtooth community is using Rust to build components to give application developers and administrators more control, more flexibility, and greater security for their blockchain networks. This blog post will give an overview of some of the new components being built in Rust.

Hyperledger Sawtooth was originally written in Python, which was a good choice for initial research and design. In 2018, the Sawtooth team chose the Rust language for new development. A key benefit is that Rust supports concurrency while also emphasizing memory safety. Several new core components, transaction processors, and consensus engines have already been written in Rust.

Compared to Python, Rust’s most noticeable feature is the expressive type system, along with its compile-time checks. Rust has ownership and borrowing rules to guarantee at compile time that an object has either only one mutable reference of an object or an unlimited number of immutable references. This feature of Rust forces the developer to account for all possible error and edgecases, making our interfaces more robust as we design them.

The validator’s block validation and publishing components are a good example of our recent interface changes. Before release 1.1, these components were heavily tied to PoET, the original consensus in Hyperledger Sawtooth. In addition, they were largely synchronous, where committing a block started the process of building a new block to publish. As we implemented the consensus engine interface, we took the opportunity to rewrite these components in Rust, which helped us to separate them more cleanly. Now there are three separate asynchronous tasks—block validation, block commit, and block publishing—that share a small amount of information. For example, the block publishing component is informed when batches are committed so that it can take them out of a pending queue, but none of the tasks starts either of the other tasks. For more information, see the block validation and block publishing components in the sawtooth-core repository.

This clean separation of tasks allows the new consensus interface to function correctly and makes it easier to develop new consensus engines. The Sawtooth team has already written two new engines in Rust: Sawtooth PBFT and Sawtooth Raft (which uses the PingCap raft library, raft-rs). The Sawtooth team is proud of the work we have done on these consensus engines, and the flexibility it provides Sawtooth community members who are building a blockchain application.

Rust also excels in its support for compiling to WASM, which can be used as a smart contract. Hyperledger Sawtooth already had Seth, which supports running Ethereum Solidity smart contracts using a transaction processor, but now has Sawtooth Sabre, a transaction processor that runs a WASM smart contract that is compiled from Rust to the WASM target. Sawtooth Sabre includes an innovative feature: using registries for namespaces and contracts. The namespace registry lets administrators control what information a contract can access. The contract registry lists versions of the contract, along with a SHA-512 hash of the contract, giving application developers confidence that the correct contract is registered. Sabre supports API compatibility with the Sawtooth Rust SDK, so developers can write a smart contract that can run either within Sabre or natively as a transaction processor, depending on the deployment methodology.

Rust has also influenced how changes to Hyperledger Sawtooth are handled. Our new RFC process is modeled after Rust’s RFC process, which provides a community-oriented forum for proposing and designing large changes. The Hyperledger Sawtooth team has put effort into a community-oriented design process at sawtooth-rfcs. The consensus API RFC is a good example: The guide-level explanation clearly lays out the purpose and reasoning behind the new component, then has a reference-level explanation of the technical details needed to guide implementation. The Sawtooth RFC process has been a good way to involve the larger Sawtooth community in driving the design and implementation of Sawtooth.

What’s next for Rust in Sawtooth? In 2019, the Sawtooth team is rewriting the remaining Sawtooth validator components in Rust. That means the networking and transaction processing components will be getting an overhaul. Expect that the networking components will be redesigned. The transaction processing components will have minor changes internally, while keeping a stable API. In both cases, there will be an increase in performance and stability thanks to Rust.

Come join the Hyperledger Sawtooth community in 2019 by writing your own transaction processor in Rust or even a consensus engine. Get in touch on the #sawtooth channel on RocketChat.

To learn more about Rust in Hyperledger Sawtooth, check out our recent changes:

About the Author:

Boyd Johnson is a Software Engineer at Bitwise IO who has worked on many core components of Hyperledger Sawtooth, including transaction processing components in Python and block validation and block publishing components in Rust. While originally a committed Pythonista, he has oxidized into a Rustacean.

Related:

  • No Related Posts

SD Times news digest: ML.NET 0.9, GDPR.eu, and Improbable’s response to Unity

Microsoft has announced ML.NET 0.9, the latest version of the open-source, cross-platform machine learning framework for .NET. ML.NET enables developers to leverages existing tools to build custom AI into their applications by creating machine learning models.

Models can be created targeting common tasks including classification, regression, clustering, ranking, recommendations, and anomaly detection.

ProtonMail launches new website for GDPR compliance

ProtonMail has launched a new website aimed at helping businesses become GDPR-compliant. GDPR.eu offers information on GDPR compliance topics at a level that businesses can understand. The company explains that the information is not as high-level as what would be found on a blog, but not as complicated as the actual wording in the law.

The site also contains detailed guides and examples of GDPR forms. “Going forward, we will continue to update the site with more guides, as well as news and analysis as EU regulators begin to interpret and enforce the law. We will also conduct original research to make sure we’re answering questions about the GDPR that you actually want answered, while gaining deeper insight into GDPR compliance,” the company wrote in a post.

Improbable responds to changes to Unity’s terms of service that impact SpatialOS games

Unity recently made a change to its term of service, making all of SpatialOS games that use Unity in breach of the terms. The company behind SpatialOS, Improbable, has released a statement detailing steps of how it will handle this.

First, they are working with Unity to try to resolve this issue, but if that is unsuccessful, they will begin looking into moving to a different game engine. Improbable has also set up an emergency fund for developers that are left financially uncertain during this time.

“For now, we believe this unfortunate and counterproductive action to be an error in judgement or coordination failure within Unity. We are urgently working to clarify this situation and believe that a swift resolution may be possible,” Improbable wrote in a post.

Hyperledger Fabric 1.4 LTS

Hyperledger Fabric 1.4 LTS is now available. According to the company, this is Hyperledger’s first long term support release.

New features to Hyperledger fall into four categories: serviceability and operations, improved programming model for developing applications, enhanced data privacy, and hand-on tutorials.

“As noted, Hyperledger Fabric v1.4 LTS marks our first long term support release. This is a critically important development for those beginning to deploy Hyperledger Fabric solutions into production and is a reflection of the confidence that the Fabric maintainers have in this latest release,” Hyperledger wrote in a post.

Related:

  • No Related Posts

Hyperledger Fabric 1.4 marks a very important milestone: First LTS release

Hyperledger Fabric is becoming one of the most important frameworks for blockchain development.

Just a few months ago, it was announced that this Hyperledger project will support Ethereum Virtual Machine (EVM) bytecode smart contracts. Therefore, Hyperledger Fabric is now more accessible to developers who have already started working with Ethereum and its associated tools.

Our main motivation was to give developers a migration path from Ethereum to a robust permissioned platform of Hyperledger Fabric. We wanted to make the transition as easy as possible and also give developers the ability to reuse whatever they may have already developed on Ethereum. This line of work was motivated and initiated separately from the fact that Hyperledger and the EEA have recently joined forces.

However, both are motivated by the idea that Hyperledger and Ethereum communities can work together.

Christopher Ferris, IBM Distinguished Engineer

    Blockchain Whitepaper 2018

    Free: Blockchain Technology Whitepaper

    If building a blockchain from scratch is beyond your current scope, the blockchain technology whitepaper is worth a look. Experts from the field share their know-how, tips and tricks, development advice, and strategy for becoming a blockchain master.

Hyperledger Fabric 1.4 LTS

The latest version of Hyperledger Fabric focuses on production operations and developer ease of use. The most important production-focused features of Fabric fall into four key categories, as explained in the blog post announcing v1.4:

  • Serviceability and Operations: Fabric v1.4 takes a giant leap forward with logging improvements, health checks, and operational metrics. Along with a focus on stability and fixes, Fabric v1.4 is the recommended release for production operations. Future fixes will be delivered on the v1.4.x stream, while new features are being developed in the v2.0 stream.
  • Improved programming model for developing applications: Programming model improvements in the Node.js SDK and Node.js chaincode makes the development of decentralized applications more intuitive, allowing you to focus on your application logic. The existing npm packages are still available for use, while the new npm packages provide a layer of abstraction to improve developer productivity and ease of use. We have also provided a comprehensive business scenario and tutorial to get you started with the new developer experience.
  • Enhanced data privacy: This release includes two new enhancements: 1) peers for organizations that are added to private data collections can now retrieve the private data for prior transactions to which they now are entitled, and 2) automatically enforce access control within chaincode based on the client organization collection membership without having to write specific chaincode logic.
  • Hand-on tutorials: Commercially focused training to help developers move up the Fabric learning curve quickly and efficiently to speed adoption and deployment.

SEE ALSO: Blockchain development made easy: Getting started with Hyperledger Fabric

However, what’s even more exciting is that Hyperledger Fabric v1.4 LTS marks their first long term support release. Hyperledger Fabric maintainers used to offer bug fix (patch) releases for the most recent [both major and minor] releases until the next release came along.

Since 1.4 is the first LTS release, the maintainers will offer bug fixes for a period of one year from the date of release (January 10, 2019). “This will likely result in a series of patch releases (v1.4.1, v1.4.2, …), where multiple fixes are bundled into a patch release,” according to the blog post.

Read more about the new features included in Hyperledger Fabric 1.4 here and here.

Related:

  • No Related Posts