FSC Node CLI Reference

April 29, 2026 ยท View on GitHub

Overview

FSC nodes are Go applications that embed the Fabric Smart Client library. You create a custom node application that registers your views (business logic) and starts the FSC node.

Creating a Node Application

FSC nodes require a Go application that embeds the FSC library:

package main

import (
    "fmt"
    
    fscnode "github.com/hyperledger-labs/fabric-smart-client/node"
    sdk "github.com/hyperledger-labs/fabric-smart-client/platform/view/sdk/dig"
)

func main() {
    node := fscnode.New()
    if err := node.InstallSDK(sdk.NewSDK(node)); err != nil {
        panic(err)
    }
    node.Execute(func() error {
        fmt.Println("Hello World")
        return nil
    })
}

Build your node:

go build -o mynode .

Commands

node start

Start the FSC node.

Usage:

./mynode node start

Description:

Starts the FSC node that:

  • Loads configuration from core.yaml
  • Initializes the View SDK
  • Handles graceful shutdown on signals

Configuration Required:

The node requires a core.yaml file in:

  • Current directory, OR
  • Directory specified by FSCNODE_CFG_PATH environment variable

See Configuration Guide for complete configuration options.

Examples:

  1. Start with default configuration:
# Looks for ./core.yaml
./mynode node start
  1. Start with custom configuration path:
export FSCNODE_CFG_PATH=/etc/fsc
./mynode node start
  1. Start with profiling enabled:
export FSCNODE_PROFILER=true
./mynode node start
  1. Start in background:
nohup ./mynode node start > node.log 2>&1 &

version

Display version information.

Usage:

./mynode version

Output:

node:
 Go version: go1.21.0
 OS/Arch: darwin/arm64

Description:

  • Shows program name
  • Displays Go version used to build
  • Shows OS and architecture

Environment Variables

All environment variables use the FSCNODE_ prefix.

FSCNODE_CFG_PATH

Description: Path to directory containing core.yaml

Type: String (directory path)

Default: ./ (current directory)

Example:

export FSCNODE_CFG_PATH=/etc/fsc
./mynode node start

FSCNODE_PROFILER

Description: Enable Go profiling for performance analysis

Type: Boolean (true or false)

Default: false

Example:

export FSCNODE_PROFILER=true
./mynode node start

When enabled, the following profiling data files are written to the configuration directory:

  • cpu.pprof - CPU profiling data
  • mem-heap.pprof - Memory heap profiling
  • mem-allocs.pprof - Memory allocations profiling
  • mutex.pprof - Mutex contention profiling
  • block.pprof - Blocking profiling

These files can be analyzed using Go's pprof tool, for example:

go tool pprof cpu.pprof

Signal Handling

The FSC node handles these signals for graceful shutdown:

SignalBehavior
SIGINT (Ctrl+C)Graceful shutdown
SIGTERMGraceful shutdown

Graceful shutdown:

  1. Stop accepting new requests
  2. Complete in-flight operations
  3. Close connections
  4. Exit cleanly

Note: The signal handling uses Go's signal.NotifyContext for cross-platform compatibility. On Unix-like systems, both SIGINT and SIGTERM trigger graceful shutdown. On Windows, Ctrl+C and Ctrl+Break are handled appropriately.

Exit Codes

CodeMeaning
0Clean shutdown
1Error during startup or operation