Hyperledger FireFly Documentation
repository·main·Indexed 20 days ago
https://github.com/hyperledger-firefly/fireflyAn 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.
What's inside Hyperledger FireFly
- 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.
What is Hyperledger FireFly
mainHyperledger 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:
- Web3 Connectivity: Tools to connect to existing decentralized networks.
- DApp Development: Tools to build new decentralized applications quickly with built-in security and scalability.
Explore the Hyperledger FireFly ecosystem and components
mainThe 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) andethconnect(for Hyperledger Besu / Quorum). - Other Chain Connectors:
fabconnect(Hyperledger Fabric),tezosconnect(Tezos),cardano(Cardano), andcordaconnect(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.
Understand Hyperledger FireFly Digital Asset features
mainHyperledger 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.
Explore Hyperledger FireFly code repositories
mainHyperledger 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.,
ethconnectfor Ethereum,cordaconnectfor Corda,fabconnectfor Hyperledger Fabric). - Data Exchange:
dataexchange-httpsfor HTTP data exchange. - Token Standards:
tokens-erc1155for ERC1155 token connector reference implementation.
Navigate the FireFly Repository Structure
mainThe 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.
Work with custom smart contracts in FireFly
mainFireFly 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
/invokefor state-changing transactions and/queryfor read-only state requests. - Event Handling: Listen to blockchain-emitted events through FireFly's event subscription system.
What is a FireFly Stack?
mainA 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.
What is the FireFly Interface (FFI) format?
mainThe 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 ofnameandversion.What is Hyperledger FireFly and the Supernode concept
mainHyperledger 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.
What is a FireFly Node?
mainA FireFly node is a collection of multiple runtimes unified by a single HTTPS/Websocket API exposed by the Core. It manages a private database for local and received data and provides connectivity to external parties in a network through various runtimes such as Blockchain, Shared Filesystems, and Messaging.What is a FireFly Interface (FFI)?
mainUnlike 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, andreturnsfor 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
paramssection 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.,
arrayofobject) for automatic decoding. - Events: For the
eventssection, you typically only need to specify thename. 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" } ] }- Methods: The name, description, input