LinuxCommandLibrary

minifab

Create reproducible, isolated build environments

TLDR

Bring up the default Hyperledger Fabric network

$ minifab up [[-i|--fabric-release]] [minifab_version]
copy

Bring down the Hyperledger Fabric network
$ minifab down
copy

Install chaincode onto a specified channel
$ minifab install [[-n|--chaincode-name]] [chaincode_name]
copy

Install a specific chaincode version onto a channel
$ minifab install [[-n|--chaincode-name]] [chaincode_name] [[-v|--chaincode-version]] [chaincode_version]
copy

Initialize the chaincode after installation/upgrade
$ minifab approve,commit,initialize,discover
copy

Invoke a chaincode method with the specified arguments
$ minifab invoke [[-n|--chaincode-name]] [chaincode_name] [[-p|--chaincode-parameters]] '"[method_name]", ["argument1", "argument2", ...]'
copy

Make a query on the ledger
$ minifab blockquery [block_number]
copy

Quickly run an application
$ minifab apprun [[-l|--chaincode-language]] [app_programming_language]
copy

SYNOPSIS

minifab command [options] [arguments]

PARAMETERS

up
    Brings up a Hyperledger Fabric network according to a specified profile.

down
    Shuts down and cleans up a running Hyperledger Fabric network.

create
    Creates a new channel on the network.

install
    Installs chaincode onto peers.

approve
    Approves a chaincode definition for an organization.

commit
    Commits a chaincode definition to a channel.

invoke
    Invokes a function on a deployed chaincode.

query
    Queries a function on a deployed chaincode.

profile
    Manages network profiles used by minifab.

version
    Displays the minifab and Fabric component versions.

-o
    Specifies the orderer organization to interact with (e.g., 'OrdererOrg').

-p
    Specifies the peer organization to interact with (e.g., 'Org1MSP').

-n
    Defines the name of the chaincode for relevant operations.

-v
    Specifies the version of the chaincode or Fabric components.

-c
    Identifies the channel for an operation.

-i
    Specifies the Hyperledger Fabric Docker image tag to use.

--tls
    Enables TLS for network communication.

--sdk-go
    Generates Hyperledger Fabric Go SDK configuration.

DESCRIPTION

minifab is a command-line tool designed to simplify the setup, deployment, and management of Hyperledger Fabric blockchain networks. It is particularly valuable for developers and testers who need to quickly spin up, configure, and tear down Fabric environments without delving into the complexities of manual configuration files and cryptographic material generation.

While not a standard Linux system command, minifab acts as an orchestration tool, abstracting away much of the manual effort involved in interacting with Fabric components like peers, orderers, and Certificate Authorities (CAs). It supports various operations, including network startup/shutdown, channel creation, chaincode deployment (install, approve, commit, invoke, query), and the management of organizations and identities. Its primary goal is to accelerate the development lifecycle by providing a concise and intuitive interface for Fabric network operations.

CAVEATS

minifab is not a standard Linux utility found in typical distributions. It is a specific tool developed within the Hyperledger Fabric ecosystem, primarily for development and testing purposes. It requires a specific setup, typically involving cloning the Fabric samples repository and having Docker and Docker Compose installed. While powerful for rapid prototyping, it is generally not recommended for production deployments, which require more robust and granular control over network configuration and security. Its behavior is highly dependent on the Hyperledger Fabric version and the profiles defined for network deployment.

INSTALLATION AND SETUP

To use minifab, one typically needs to clone the Hyperledger Fabric samples repository (or a similar source) where the minifab script resides. Prerequisites usually include Docker and Docker Compose, as minifab orchestrates Fabric components as Docker containers. It is executed directly from its script location, often requiring execution permissions (e.g., chmod +x minifab).

USAGE CONTEXT

minifab is primarily used for creating isolated, ephemeral blockchain networks on a local machine or a single server. It is ideal for:

  • Rapidly testing chaincode logic.
  • Experimenting with different Fabric configurations.
  • Onboarding new developers to Hyperledger Fabric.
  • Demonstrating Fabric network capabilities without extensive setup.
It automates tasks that would otherwise require deep knowledge of Fabric's underlying configuration files and command-line tools.

HISTORY

minifab emerged from the need to streamline the notoriously complex process of setting up Hyperledger Fabric networks for development and testing. Before tools like minifab, developers often had to manually configure Docker Compose files, generate cryptographic materials using cryptogen, and manage certificates with configtxgen and fabric-ca. This manual process was error-prone and time-consuming. minifab was developed to abstract these low-level operations, providing a higher-level, more intuitive command-line interface, thereby accelerating the developer's workflow and making Fabric more accessible for rapid prototyping and learning.

Copied to clipboard