Hyperledger FireFly Documentation

repository·main·Indexed 20 days ago

https://github.com/hyperledger-firefly/firefly

An open-source Supernode stack providing APIs and orchestration for enterprise-grade Web3 applications. It handles blockchain connectivity, digital assets, and private data flows through a pluggable microservices architecture. The core system, written in Go, includes an API server, orchestrator, and specialized components like the FireFly Transaction Manager (FFTM) for blockchain connector development.

Tokens
143.7K
Snippets
313
Records
617
Agent score
68%

What's inside Hyperledger FireFly

  1. Overview of Hyperledger FireFly

    main
    Hyperledger FireFly is an open-source supernode: a full-stack solution for building and scaling secure, enterprise-grade Web3 applications. It provides APIs for digital assets, data streams, and blockchain transactions, enabling enterprises to rapidly build production-ready applications on popular blockchain technologies and protocols.
  2. What is Hyperledger FireFly

    main

    Hyperledger FireFly is an open source Supernode designed as a complete stack for enterprises to build and scale secure Web3 applications. It acts as a 'toolbox' that connects existing applications or back-office systems to the Web3 ecosystem.

    It provides two primary sets of capabilities:

    1. Web3 Connectivity: Tools to connect to existing decentralized networks.
    2. DApp Development: Tools to build new decentralized applications quickly with built-in security and scalability.
  3. Explore the Hyperledger FireFly ecosystem and components

    main

    The FireFly ecosystem is distributed across several specialized repositories. The core repository (where you are now) is written in Go and hosts the API Server and central orchestration engine.

    Other key components include:

    Blockchain Connectivity

    • Transaction Manager: Manages blockchain transactions.
    • Signer: Provides RLP & ABI encoding, KeystoreV3 utilities, and secp256k1 signer runtime.
    • EVM Connectors: evmconnect (FFCAPI reference) and ethconnect (for Hyperledger Besu / Quorum).
    • Other Chain Connectors: fabconnect (Hyperledger Fabric), tezosconnect (Tezos), cardano (Cardano), and cordaconnect (Corda).

    Token Standards

    • ERC20/ERC721: Support for standard fungible and non-fungible tokens.
    • ERC1155: Support for multi-token standards.

    Developer Tools

    • CLI: Command Line Interface.
    • Explorer UI: Web interface.
    • Node.js SDK: For programmatic integration.
    • Sandbox / Exerciser: For testing.
    • Perf CLI: For performance testing.
    • Helm Charts: For Kubernetes deployments.
  4. Understand Hyperledger FireFly Digital Asset features

    main

    Hyperledger FireFly provides an abstraction layer for managing digital assets, decoupling application logic from specific blockchain implementations and token standards. This allows developers to build interoperable systems that work across multiple blockchains and token types (fungible, non-fungible, or hybrid) using a consistent API.

    Key capabilities include:

    • Standardized Token API: Provides consistent APIs that work across different token standards (like ERC-20 or ERC-721) and various blockchain implementations.
    • Off-chain Indexing: Solves the difficulty of querying historical transaction data and calculating balances (especially in UTXO models) by providing automatic indexing of tokens, transfers, balances, and approvals.
    • Wallet & Identity Management: Facilitates the integration of multiple signing/custody solutions, maps off-chain identities to on-chain signing identities, and provides plug-points for policy-based decision making on high-value transactions.
  5. Explore Hyperledger FireFly code repositories

    main

    Hyperledger FireFly uses a plugin-based architecture with a microservice runtime footprint. Because of this modular design, the project is distributed across several specialized repositories. For developers looking to get started quickly, the CLI is the recommended entry point to orchestrate the various components.

    Key repositories include:

    • CLI / Developer experience: Tools to get running with all components quickly.
    • FireFly Samples: Reference implementations and examples.
    • UI Explorer: Interface for exploring FireFly capabilities.
    • Core: The main FireFly repository.
    • Connectors: Specialized repositories for blockchain connectivity (e.g., ethconnect for Ethereum, cordaconnect for Corda, fabconnect for Hyperledger Fabric).
    • Data Exchange: dataexchange-https for HTTP data exchange.
    • Token Standards: tokens-erc1155 for ERC1155 token connector reference implementation.
  6. Navigate the FireFly Repository Structure

    main

    The FireFly codebase is organized into several key directories that define its functionality and entry points:

    • internal: Contains the core Golang implementation code.
    • pkg: Contains interfaces intended for use by external projects (e.g., when building extensions or integrations).
    • cmd: Contains the command line entry points for the application.
    • smart_contracts: Contains the smart contract code used for FireFly's on-chain logic.
  7. Work with custom smart contracts in FireFly

    main

    FireFly allows you to interact with smart contracts deployed on various blockchain platforms using a unified RESTful API and WebSocket-based event listening. This abstraction provides a consistent developer experience regardless of the underlying blockchain (e.g., Ethereum, Fabric, Corda).

    Key capabilities include:

    • Unified HTTP API: Automatically generated OpenAPI specifications and Swagger UI based on your contract definitions.
    • Consistent Interaction: Use /invoke for state-changing transactions and /query for read-only state requests.
    • Event Handling: Listen to blockchain-emitted events through FireFly's event subscription system.
  8. What is a FireFly Stack?

    main

    A FireFly stack is a collection of Supernodes with networking and configuration designed to work together on a single development machine.

    Key characteristics:

    • Members (Organizations): A stack contains multiple members. Each member has its own Supernode.
    • Data Flows: This architecture allows developers to test data flows involving both public and private data between different parties in one environment.
    • Sandbox: Each member in the stack includes an instance of the FireFly Sandbox, which serves as an end-user application example for interacting with FireFly APIs.
  9. What is the FireFly Interface (FFI) format?

    main

    The FireFly Interface (FFI) is a blockchain-agnostic JSON format used to describe smart contracts. It allows FireFly to understand contract capabilities, perform API request validation, generate OpenAPI specifications, and prepare blockchain-specific requests.

    Contract interfaces are scoped to a namespace. Within a single namespace, every contract must have a unique combination of name and version.

  10. What is Hyperledger FireFly and the Supernode concept

    main

    Hyperledger FireFly is an open-source API Orchestration and Data layer designed to act as a gateway to Web3 technologies. Instead of being a blockchain implementation itself, it functions as a Supernode that sits between your application and the underlying decentralized infrastructure.

    Key Functions of the Supernode:

    • Data Synchronization: It provides a data layer that synchronizes state from blockchains and other Web3 technologies.
    • Abstraction: It abstracts away the complex, low-level "plumbing" or middleware code required to integrate Web3 infrastructure, preventing application complexity.
    • Reliable Interface: It exposes a developer-friendly API and Event Bus to your business logic.

    Supported Technologies:

    FireFly integrates with various decentralized technologies, including:

    • Public Blockchains, Layer 2s, Sidechains, and App chains
    • Permissioned Blockchains and DLTs
    • Decentralized storage solutions
    • Token ecosystems and standards
    • Smart Contracts, DeFi, and DAOs
    • Private off-chain encrypted communication rails
    • Advanced cryptography and Identity frameworks.
  11. What is a FireFly Interface (FFI)?

    main

    Unlike Ethereum which uses an Application Binary Interface (ABI), Hyperledger Fabric uses a generic chaincode interface that leaves encoding/decoding to the developer.

    To enable FireFly to interact with Fabric chaincode (submitting transactions, querying state, and listening for events), you must provide a FireFly Interface (FFI) document. This is a hand-crafted JSON document that defines:

    • Methods: The name, description, input params, and returns for each chaincode function.
    • Events: The names of events emitted by the chaincode.
    • Schemas: JSON schemas describing the structure of parameters and return values.

    Key Requirements:

    • Parameter Order: For the params section of a method, the sequence of properties in the JSON must exactly match the order of the input parameters in the chaincode's function signature.
    • Return Values: FireFly can automatically decode JSON payloads. You can specify a detailed structure to hide certain properties or simply specify the type (e.g., array of object) for automatic decoding.
    • Events: For the events section, you typically only need to specify the name. If the payload is JSON, FireFly decodes it; otherwise, it returns base64 encoded bytes.
    {
      "namespace": "default",
      "name": "asset_transfer",
      "description": "Spec interface for the asset-transfer-basic golang chaincode",
      "version": "1.0",
      "methods": [
        {
          "name": "GetAllAssets",
          "pathname": "",
          "description": "",
          "params": [],
          "returns": [
            {
              "name": "",
              "schema": {
                "type": "array",
                "details": {
                  "type": "object",
                  "properties": {
                    "type": "string"
                  }
                }
              }
            }
          ]
        },
        {
          "name": "CreateAsset",
          "pathname": "",
          "description": "",
          "params": [
            { "name": "id", "schema": { "type": "string" } },
            { "name": "color", "schema": { "type": "string" } },
            { "name": "size", "schema": { "type": "string" } },
            { "name": "owner", "schema": { "type": "string" } },
            { "name": "value", "schema": { "type": "string" } }
          ],
          "returns": []
        }
      ],
      "events": [
        { "name": "AssetCreated" }
      ]
    }