The world of blockchain technology is rapidly evolving, with various platforms and frameworks emerging to meet the diverse needs of organizations. In this deep dive into the Hyperledger Fabric and Sawtooth blockchains, we will explore the fundamental concepts, architectures, and features of these two prominent blockchain platforms. From Hyperledger’s inception as a global enterprise blockchain platform to the modular design and secure smart contract capabilities of Hyperledger Sawtooth, this Cryptopolitan guide provides valuable insights into the world of blockchain technology.
An Introduction to Hyperledger
Hyperledger, a global enterprise blockchain platform, was established by The Linux Organization in December 2015. Initially comprising 30 participants, it has grown to encompass over 120 members. Hyperledger aims to create and maintain open-source blockchain networks and platforms for various organizations, providing the necessary infrastructure and protocols for the development of blockchain tools and networks. The collaboration fosters commercial blockchain initiatives by offering a set of principles, rules, and methods through the Hyperledger Greenhouse, which includes frameworks and tools supporting blockchain technology.
With a diverse range of leading organizations in finance, banking, IoT, supply chain management, manufacturing and production, and technology, Hyperledger boasts a notable membership base. Companies such as Bosch, Daimler, IBM, Samsung, Microsoft, Hitachi, American Express, JP Morgan, and Visa are actively involved in shaping the future of blockchain technology. Additionally, several blockchain-based companies like Blockforce and ConsenSys contribute to the Hyperledger project.
Within the Hyperledger ecosystem, various sub-projects operate to enhance the efficiency and quality of systems and services across a network of computers. These sub-projects include Hyperledger Fabric, Hyperledger Indy, Hyperledger Caliper, Hyperledger Burrow, Sawtooth, Composer, and Cello. Understanding the nuances and differences between these projects can be challenging, particularly for newcomers to the cryptocurrency space.
Hyperledger Fabric: Empowering Modular Apps and Secure Blockchain Solutions
Hyperledger Fabric, an open-source initiative by the Hyperledger corporation, serves as a robust foundation for building modular applications and driving innovation in the realm of blockchain technology. Positioned as a blockchain platform, it empowers private enterprises to construct blockchain-based products and applications by leveraging plug-and-play components. Within the Hyperledger platform, ledgers, standards, protocols, and smart contracts work in harmony to enable efficient and secure blockchain solutions.
One of the key advantages of Hyperledger Fabric lies in its ability to facilitate data segregation and expedite transactions. As a private platform, it operates on the principle of access rights, ensuring that only authorized users can connect to the network. By restricting access to internal staff, businesses can fortify their infrastructure against unauthorized entities and establish an exclusive network system.
Hyperledger Fabric was specifically designed to overcome common limitations associated with traditional blockchain solutions, such as private exchanges and confidential contracts. It offers a flexible and secure platform for delivering industrial-grade blockchain services. The framework incorporates robust rules for storing information about network users and their access privileges, ensuring granular control over data points. In addition, Hyperledger Fabric supports permissioned membership, making it an ideal choice for sectors like finance, healthcare, and more, where privacy and regulatory compliance are critical considerations.
Architecture of Hyperledger Fabric
Consensus Layer
The consensus layer ensures agreement on transaction order and validates the accuracy of the transaction database within a block. It communicates with clients and network peers through the communication layer. By adhering to approval and consensus policies, it confirms the correctness of transactions in a proposed block. It also collaborates with the smart contract layer to validate the accuracy of the ordered transaction database, contributing to data synchronization and transaction consistency across the network.
Smart Contract Layer
The smart contract layer validates transaction validity based on policies and contracts, ensuring only valid transactions are included in blocks. It comprises two types: installed smart contracts for pre-launch business logic and on-chain smart contracts for business rules implemented through committed transactions. In Hyperledger Fabric, smart contracts, called chaincode, are developed using languages like Go, JavaScript (Node.js), and potentially Java. Chaincode runs securely in a separate Docker container from the endorsing peer process.
Communication Layer
The communication layer enables peer-to-peer message transfer among nodes in a shared ledger. It facilitates communication between the consensus layer, clients, and network peers. Transactions are executed atomically and sequentially, treating the system as a single node. Successful communication ensures all non-faulty nodes receive submitted transactions. Transport Layer Security (TLS) ensures secure communication in Hyperledger Fabric, supporting one-way and two-way authentication.
Data Store Abstraction
The data store abstraction allows modules to use different data stores. In Hyperledger Fabric, private data is stored in a dedicated database on authorized peer nodes, accessed through chaincode. A hash of the secret data is recorded in the ledgers of all channel peers. Hyperledger Fabric supports LevelDB and CouchDB as state databases. LevelDB stores chaincode data as key-value pairs, integrated into peer activity. CouchDB, an optional external database, enables rich JSON queries when chaincode data is represented in JSON format. Successful deployment installs the chaincode “on” the blockchain.
Crypto Abstraction
The crypto abstraction allows the use of different cryptographic techniques or modules without affecting other components. Hyperledger Fabric version 2.0 introduces Fabtoken, enabling the creation of native cryptocurrencies. Hyperledger Besu, based on Ethereum, is an open-source public Ethereum implementation compatible with permissionless platforms and the Ethereum network. Hyperledger Besu supports CPU and GPU mining, with Ethminer used for GPU mining testing. It’s important to note that Hyperledger Fabric doesn’t support cryptocurrencies like Bitcoin, but focuses on providing infrastructure and standards for industrial blockchain-based applications and systems.
Identity Service
The identity service establishes a trusted root, manages enrollment and registration of identities, and facilitates changes in a blockchain instance. It handles authentication, permission, and is utilized by the smart contract layer to authenticate and authorize entities during transaction processing. Hyperledger Fabric provides a personal identity service for managing user IDs and authenticating network participants, enabling permissioned networks. Access control lists add layers of permission by authorizing specific network actions. Certification Authorities (CAs), like Hyperledger Fabric CA, manage certificates.
Policy Service
The policy service manages system policies such as endorsements, consensus, and group management. It collaborates with other modules to enforce these policies effectively. In Hyperledger Fabric, policies govern the approval or rejection process for network changes, routes, and smart contracts. They are established during the initial channel setup and can be modified as the channel evolves. Policies distinguish Hyperledger Fabric by ensuring transactions are generated and confirmed by approved network nodes.
API
The API module enables client and application interaction with blockchains. It consists of three types of APIs in Hyperledger. The admin API manages operations like runtime installation, refreshment, and pinging. The common API accesses information about the connected Business Network and facilitates asset, participant, transaction, and event creation. The runtime API allows transaction functions to query, emit events, retrieve registries, access participant information, and serialize JavaScript objects. It also supports HTTP REST calls.
Interoperation
Interoperation enables communication and interaction between separate blockchain instances. It relies on comprehensive data and transaction standards to unlock the full potential of blockchain technology. Industries like food safety have leveraged data standards for enhanced product visibility. However, achieving interoperability and integration remains a significant challenge in the blockchain sector, necessitating ongoing efforts to establish seamless communication and collaboration among diverse blockchain networks.
Features of Hyperledger Fabric
Hyperledger Fabric offers a range of core features, including:
- Highly modular, permissioned architecture.
- Plug-and-play consensus mechanism.
- Open smart contract model for flexible implementation.
- Low latency for transaction finality/confirmation.
- Support for EVM and Solidity.
- Queryable data with key-based and JSON queries.
- Multi-language smart contract support (Go, Java, JavaScript).
- Flexible data privacy through channels and private data collections.
- Flexible endorsement model for consensus across organizations.
- Seamless operations, including rolling upgrades and asymmetric version support.
What is Hyperledger Sawtooth?
Hyperledger Sawtooth is an enterprise blockchain platform that facilitates the creation and operation of distributed ledger networks and applications. It prioritizes secure smart contracts for enterprise use cases and follows a blockchain-as-a-service (BaaS) model.
Hyperledger Sawtooth distinguishes itself through its modular design, allowing organizations and consortia to establish policies tailored to their specific domains. Applications can select transactional, permissioning, and consensus algorithms that align with their unique business requirements, enhancing flexibility compared to traditional blockchain systems where core and app functionalities reside on the same platform, potentially impacting security and performance.
As an open-source enterprise blockchain-as-a-service platform, Hyperledger Sawtooth enables the execution of customized smart contracts without the need for in-depth knowledge of the underlying core system design. It supports various consensus algorithms, including PBFT and PoET, and offers a user-friendly design optimized for enterprise usage. Additionally, Sawtooth ensures separate permissioning, ensuring confidentiality by eliminating centralized services that could expose sensitive information.
Functioning as a modular platform, Hyperledger Sawtooth empowers the development, deployment, and operation of distributed ledgers. It incorporates the innovative “Proof of Elapsed Time” (PoET) consensus algorithm, utilizing trusted execution environments (TEEs) for fair and efficient consensus. With its pluggable consensus algorithms and support for both permissioned and permissionless networks, Sawtooth provides a distributed ledger that logs transactions and smart contract execution across network nodes. Transactions are processed in parallel to enhance performance.
To streamline smart contract deployment and execution, Sawtooth offers the Sawtooth Lake smart contract engine. The platform provides a RESTful API for seamless interaction with the ledger and submission of transactions. Hyperledger Sawtooth boasts scalability, capable of supporting networks with thousands of nodes and processing millions of transactions per second.
Hyperledger Sawtooth is a flexible and powerful platform for building and deploying distributed ledgers. It caters to diverse applications such as supply chain management, digital asset tracking, and voting systems. By separating the core ledger system from application-specific environments, Sawtooth simplifies app development while maintaining system security. This approach allows developers to define business rules specific to their applications, enabling easy hosting, management, and usage in their preferred programming language, even outside the core blockchain network.
Architecture of Hyperledger Sawtooth
Let’s take a detailed look at the architectural components and functions of Hyperledger Sawtooth:
Hyperledger Sawtooth Architecture Diagram (source sawtooth.hyperledger.org/docs/1.2/architecture/)
Clients
Hyperledger Sawtooth follows an asynchronous client/server pattern. Clients send requests to the server, and the server responds with zero or more replies. Clients can send multiple requests without waiting for replies, and servers can send multiple replies without waiting for new requests.
Rest API
Hyperledger Sawtooth provides a pragmatic RESTish API that allows clients to interact with a validator using common JSON/HTTP standards. The REST API serves as a separate process for transaction submission and block reading with a language-neutral interface. It is extensively documented using the OpenAPI specification, ensuring clarity and accessibility for both machines and humans. The REST API supports common HTTP status codes for quality improvement, such as 404 for “Not Found” and 503 for “Service Unavailable.” It utilizes a JSON envelope to send metadata back to clients and provides error handling with code, title, and message properties. Query parameters are supported to specify request formation, and endpoints offer references to resources in the Sawtooth ledger, including blocks, transactions, and metadata.
Transaction Processors
Transaction processors validate and handle business logic for transactions, deciding whether to include them in the state. They apply transaction changes and add them to the next block. Validator nodes ensure the validity of transaction signatures. Additional logic can be added to transaction processors to meet specific requirements. Transaction handlers, added to process transactions, include apply and helper functions. The processor class, provided by the Software Development Kit (SDK), offers general-purpose functionality, while the handler class contains application-specific business logic. The transaction processor class connects with the validator and the handler class.
Consensus Engine
The consensus API has been redesigned and moved to a separate process called the “consensus engine.” It provides an interface for language-independent consensus algorithms, expanding the consensus options for Sawtooth. The consensus engine operates as a separate process alongside the REST API and transaction processors. It includes three processors: BlockPublisher for creating candidate blocks, BlockVerifier for verifying consensus rule compliance, and ForkResolver for selecting the next block to be the chain head.
Validator
In Hyperledger Sawtooth, authorized nodes validate blocks and batches similarly. Block validation includes checking on-chain transaction permissions and applying on-chain block validation rules. Batches are sent to the transaction scheduler. The network layer facilitates communication between validators, REST API, transaction processors, and clients. It handles peer discovery, transaction handling, block management, and supports consensus engines. Sawtooth supports both serial and parallel scheduling of transactions and efficiently handles transactions modifying the same state addresses. The validator process consists of the chain controller, responsible for maintaining the current chain’s last block and determining chain head updates, and the block manager and publisher, responsible for creating new candidate blocks and adding valid transactions to them.
Features of Hyperledger Sawtooth
Here are some of the unique features of Hyperledger Sawtooth:
- Separation between the application level and the core system
- Private networks with the sawtooth permissioning features
- Parallel transaction execution through the advanced parallel scheduler
- Support creating and broadcasting events
- Ethereum EVM smart contract compatibility with Seth
- Dynamic consensus
- Sample transaction families
Conclusion
As the adoption of blockchain technology continues to grow, platforms like Hyperledger Fabric and Hyperledger Sawtooth play a crucial role in enabling organizations to build secure and scalable blockchain-based solutions. Hyperledger’s collaborative approach and extensive membership base contribute to the development and standardization of blockchain tools and networks. With their modular architectures, robust consensus mechanisms, and support for smart contracts, Hyperledger Fabric and Hyperledger Sawtooth provide a solid foundation for organizations looking to leverage the benefits of blockchain technology. As the blockchain landscape evolves, Hyperledger remains at the forefront, driving innovation and transforming industries across the globe.