Convert Figma logo to code with AI

hyperledger logofabric

Hyperledger Fabric is an enterprise-grade permissioned distributed ledger framework for developing solutions and applications. Its modular and versatile design satisfies a broad range of industry use cases. It offers a unique approach to consensus that enables performance at scale while preserving privacy.

15,649
8,806
15,649
187

Top Related Projects

Go implementation of the Ethereum protocol

3,975

Corda is an open source blockchain project, designed for business from the start. Only Corda allows you to build interoperable blockchain networks that transact in strict privacy. Corda's smart contract technology allows businesses to transact directly, with value.

4,654

A permissioned implementation of Ethereum supporting data privacy

Substrate: The platform for blockchain innovators

11,277

An open source smart contract platform

⟁ Tendermint Core (BFT Consensus) in Go

Quick Overview

Hyperledger Fabric is an open-source enterprise-grade permissioned distributed ledger technology (DLT) platform. It is designed to support modular architecture with plug-and-play components, such as consensus and membership services. Fabric is optimized for a broad range of industry use cases, including finance, healthcare, and supply chain.

Pros

  • Highly modular and configurable architecture
  • Supports private and confidential transactions
  • Provides high performance and scalability
  • Enables smart contracts (chaincode) in multiple programming languages

Cons

  • Steep learning curve for newcomers
  • Complex setup and deployment process
  • Limited public documentation and examples compared to some blockchain platforms
  • Requires careful design and implementation to ensure security

Code Examples

  1. Initializing a Fabric client:
const { Gateway, Wallets } = require('fabric-network');

async function initFabricClient() {
    const wallet = await Wallets.newFileSystemWallet('./wallet');
    const gateway = new Gateway();
    await gateway.connect(connectionProfile, {
        wallet,
        identity: 'user1',
        discovery: { enabled: true, asLocalhost: true }
    });
    return gateway;
}
  1. Invoking a chaincode function:
async function invokeChaincode(gateway, channelName, chaincodeName, functionName, args) {
    const network = await gateway.getNetwork(channelName);
    const contract = network.getContract(chaincodeName);
    const result = await contract.submitTransaction(functionName, ...args);
    return result;
}
  1. Querying the ledger:
async function queryLedger(gateway, channelName, chaincodeName, queryString) {
    const network = await gateway.getNetwork(channelName);
    const contract = network.getContract(chaincodeName);
    const result = await contract.evaluateTransaction('query', queryString);
    return JSON.parse(result.toString());
}

Getting Started

To get started with Hyperledger Fabric:

  1. Install prerequisites (Docker, Docker Compose, Go, Node.js)
  2. Clone the Fabric samples repository:
    git clone https://github.com/hyperledger/fabric-samples.git
    
  3. Navigate to the test-network directory:
    cd fabric-samples/test-network
    
  4. Start the test network:
    ./network.sh up createChannel -c mychannel -ca
    
  5. Deploy a sample chaincode:
    ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go
    

This sets up a basic Fabric network with two organizations and deploys a sample chaincode. For more detailed instructions and advanced usage, refer to the official Hyperledger Fabric documentation.

Competitor Comparisons

Go implementation of the Ethereum protocol

Pros of go-ethereum

  • Public, permissionless blockchain with a large, active community
  • Native cryptocurrency (Ether) and robust support for smart contracts
  • Widely adopted and battle-tested in production environments

Cons of go-ethereum

  • Lower transaction throughput compared to Fabric
  • Higher energy consumption due to Proof-of-Work consensus (pre-Merge)
  • Less flexibility in terms of privacy and access control

Code Comparison

go-ethereum (Solidity smart contract):

pragma solidity ^0.8.0;

contract SimpleStorage {
    uint256 private storedData;

    function set(uint256 x) public {
        storedData = x;
    }

    function get() public view returns (uint256) {
        return storedData;
    }
}

Fabric (Chaincode in Go):

package main

import (
    "fmt"
    "github.com/hyperledger/fabric-contract-api-go/contractapi"
)

type SimpleAsset struct {
    contractapi.Contract
}

func (t *SimpleAsset) Set(ctx contractapi.TransactionContextInterface, key string, value string) error {
    return ctx.GetStub().PutState(key, []byte(value))
}

func (t *SimpleAsset) Get(ctx contractapi.TransactionContextInterface, key string) (string, error) {
    value, err := ctx.GetStub().GetState(key)
    if err != nil {
        return "", fmt.Errorf("failed to read from world state: %v", err)
    }
    return string(value), nil
}
3,975

Corda is an open source blockchain project, designed for business from the start. Only Corda allows you to build interoperable blockchain networks that transact in strict privacy. Corda's smart contract technology allows businesses to transact directly, with value.

Pros of Corda

  • Designed specifically for financial services, with built-in privacy and regulatory compliance features
  • Supports multiple consensus mechanisms, allowing for more flexibility in network design
  • Uses a unique "flow framework" for coordinating complex, multi-party transactions

Cons of Corda

  • Smaller community and ecosystem compared to Fabric
  • Steeper learning curve due to its specialized nature and use of Kotlin
  • Limited support for smart contracts written in languages other than Java or Kotlin

Code Comparison

Fabric (Chaincode in Go):

func (s *SmartContract) CreateAsset(ctx contractapi.TransactionContextInterface, id string, value int) error {
    asset := Asset{ID: id, Value: value}
    assetJSON, err := json.Marshal(asset)
    if err != nil {
        return err
    }
    return ctx.GetStub().PutState(id, assetJSON)
}

Corda (Flow in Kotlin):

@Suspendable
override fun call(): SignedTransaction {
    val notary = serviceHub.networkMapCache.notaryIdentities.first()
    val txBuilder = TransactionBuilder(notary)
    .addOutputState(AssetState(value, ourIdentity), AssetContract.ID)
    .addCommand(AssetContract.Commands.Create(), ourIdentity.owningKey)
    val signedTx = serviceHub.signInitialTransaction(txBuilder)
    return subFlow(FinalityFlow(signedTx, listOf()))
}
4,654

A permissioned implementation of Ethereum supporting data privacy

Pros of Quorum

  • Built on Ethereum, leveraging its extensive ecosystem and tooling
  • Supports both public and private transactions within the same network
  • Offers multiple consensus mechanisms (RAFT, IBFT, Clique)

Cons of Quorum

  • Less modular architecture compared to Fabric
  • Limited support for complex smart contract languages beyond Solidity
  • Smaller community and fewer enterprise-grade deployments

Code Comparison

Fabric (Chaincode in Go):

func (s *SmartContract) CreateAsset(ctx contractapi.TransactionContextInterface, id string, value int) error {
    asset := Asset{ID: id, Value: value}
    assetJSON, err := json.Marshal(asset)
    if err != nil {
        return err
    }
    return ctx.GetStub().PutState(id, assetJSON)
}

Quorum (Smart Contract in Solidity):

pragma solidity ^0.8.0;

contract AssetManager {
    mapping(string => uint256) private assets;

    function createAsset(string memory id, uint256 value) public {
        assets[id] = value;
    }
}

Both Fabric and Quorum are enterprise-focused blockchain platforms, but they differ in their approach and underlying technology. Fabric offers a more modular and flexible architecture, while Quorum builds upon the Ethereum ecosystem. The choice between them depends on specific project requirements and existing technology stacks.

Substrate: The platform for blockchain innovators

Pros of Substrate

  • More flexible and customizable blockchain framework
  • Easier to develop and deploy custom blockchains
  • Better suited for building interoperable blockchain networks

Cons of Substrate

  • Steeper learning curve due to its complexity
  • Less mature ecosystem compared to Fabric
  • Fewer enterprise-focused features out of the box

Code Comparison

Substrate (Rust):

#[pallet::weight(10_000)]
pub fn do_something(origin: OriginFor<T>, something: u32) -> DispatchResult {
    let who = ensure_signed(origin)?;
    <Something<T>>::put(something);
    Self::deposit_event(Event::SomethingStored(something, who));
    Ok(())
}

Fabric (Go):

func (s *SmartContract) DoSomething(ctx contractapi.TransactionContextInterface, something string) error {
    err := ctx.GetStub().PutState("something", []byte(something))
    if err != nil {
        return fmt.Errorf("failed to put to world state: %v", err)
    }
    return nil
}

The code snippets demonstrate the different approaches to implementing smart contract logic in Substrate and Fabric. Substrate uses Rust and a more declarative style, while Fabric uses Go and a more imperative approach.

11,277

An open source smart contract platform

Pros of EOS

  • Higher transaction throughput and scalability
  • More user-friendly for developers with WebAssembly support
  • Faster block confirmation times (0.5 seconds)

Cons of EOS

  • More centralized governance model
  • Limited privacy features compared to Fabric
  • Potential for network congestion during high-demand periods

Code Comparison

EOS (C++):

#include <eosio/eosio.hpp>

class [[eosio::contract]] hello : public eosio::contract {
public:
    [[eosio::action]]
    void hi(name user) {
        print("Hello, ", user);
    }
};

Fabric (Go):

func (s *SmartContract) Hello(ctx contractapi.TransactionContextInterface, name string) error {
    return ctx.GetStub().PutState("greeting", []byte("Hello, "+name))
}

Key Differences

  • EOS uses C++ for smart contracts, while Fabric supports multiple languages (Go, Java, JavaScript)
  • EOS focuses on high-performance public blockchains, whereas Fabric is designed for permissioned enterprise networks
  • EOS uses a Delegated Proof-of-Stake consensus mechanism, while Fabric offers pluggable consensus protocols

Use Cases

  • EOS: Decentralized applications (dApps) with high transaction volumes, gaming, social media
  • Fabric: Supply chain management, financial services, healthcare data sharing

⟁ Tendermint Core (BFT Consensus) in Go

Pros of Tendermint

  • Simpler architecture and easier to understand
  • Better performance and scalability for high-throughput applications
  • More flexible consensus mechanism, allowing for various voting power distributions

Cons of Tendermint

  • Less mature ecosystem and enterprise adoption compared to Fabric
  • Fewer built-in privacy features and permissioning options
  • Limited smart contract support out of the box

Code Comparison

Tendermint (Go):

func (app *KVStoreApplication) DeliverTx(req abci.RequestDeliverTx) abci.ResponseDeliverTx {
    key, value := req.Tx[:32], req.Tx[32:]
    app.state.Set(key, value)
    return abci.ResponseDeliverTx{Code: 0}
}

Fabric (Go):

func (s *SmartContract) Invoke(ctx contractapi.TransactionContextInterface) error {
    _, args := ctx.GetStub().GetFunctionAndParameters()
    err := ctx.GetStub().PutState(args[0], []byte(args[1]))
    return err
}

Both examples show simple key-value storage operations, but Fabric's approach is more abstracted and integrated with its chaincode concept, while Tendermint's is more direct and lower-level.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Hyperledger Fabric

OpenSSF Scorecard CII Best Practices Go Report Card GoDoc Documentation Status

GitHub Actions Workflow Status GitHub Actions Workflow Status Security vulnerability scan

GitHub go.mod Go version GitHub Release

This project is a Graduated Hyperledger project. For more information on the history of this project, see the Fabric wiki page. Information on what Graduated entails can be found in the Hyperledger Project Lifecycle document. Hyperledger Fabric is a platform for distributed ledger solutions underpinned by a modular architecture delivering high degrees of confidentiality, resiliency, flexibility, and scalability. It is designed to support pluggable implementations of different components and accommodate the complexity and intricacies that exist across the economic ecosystem.

Hyperledger Fabric delivers a uniquely elastic and extensible architecture, distinguishing it from alternative blockchain solutions. Planning for the future of enterprise blockchain requires building on top of a fully-vetted, open-source architecture; Hyperledger Fabric is your starting point.

Releases

Fabric provides periodic releases with new features and improvements. Additionally, certain releases are designated as long-term support (LTS) releases. Important fixes will be backported to the most recent LTS release, and to the prior LTS release during periods of LTS release overlap. For more details see the LTS strategy.

Current LTS release:

Historic LTS releases:

  • v2.2.x (maintenance ended in February 2024 with the delivery of v2.2.15)
  • v1.4.x (maintenance ended in April 2021 with the delivery of v1.4.12)

Unless specified otherwise, all releases will be upgradable from the prior minor release. Additionally, each LTS release is upgradable to the next LTS release.

Fabric releases and release notes can be found on the GitHub releases page.

Please visit the GitHub issues with Epic label for our release roadmap.

Documentation, Getting Started and Developer Guides

Please visit our online documentation for information on getting started using and developing with the fabric, SDK and chaincode:

It's recommended for first-time users to begin by going through the Getting Started section of the documentation in order to gain familiarity with the Hyperledger Fabric components and the basic transaction flow.

Contributing

We welcome contributions to the Hyperledger Fabric project in many forms. There’s always plenty to do! Check the documentation on how to contribute to this project for the full details.

Community

Hyperledger Community

Hyperledger mailing lists and archives

Hyperledger Discord Chat

Hyperledger Fabric Issue Tracking (GitHub Issues)

Hyperledger Fabric Wiki

Hyperledger Wiki

Hyperledger Code of Conduct

Community Calendar

License

Hyperledger Project source code files are made available under the Apache License, Version 2.0 (Apache-2.0), located in the LICENSE file. Hyperledger Project documentation files are made available under the Creative Commons Attribution 4.0 International License (CC-BY-4.0), available at http://creativecommons.org/licenses/by/4.0/.

NPM DownloadsLast 30 Days