Skip to main content

Purpose and Scope

This document explains how to generate the genesis block, initialize the chain, and prepare validator keys for the StableNet network. It covers both automated generation using the genesis_generator tool and manual genesis file authoring. Related documents:

Genesis File Structure

The genesis file is a JSON file that defines the initial state of the blockchain, including chain configuration, initial account allocations, and consensus parameters.

Core Genesis Fields

Genesis structure:

Anzeon Consensus Configuration

For Anzeon/WBFT chains, the ChainConfig includes an Anzeon field. This configuration defines two validator sets:
  • Init: Validators active from block 1 until the first epoch (hardcoded in the genesis block ExtraData)
  • SystemContracts.GovValidator: Validator set applied from the second epoch onward (modifiable via governance)
Unless there is a specific reason, these two sets should be identical.
For details on the epoch transition mechanism, see Anzeon WBFT Consensus Protocol.

System Contracts

StableNet deploys five system contracts at fixed addresses in the genesis block: System contracts are deployed without owners and can only be upgraded via hard forks.
For detailed initialization parameters, storage slots, and dependencies of each contract, see System Contracts Overview.

Genesis Initialization Parameters

The following parameters must be configured at genesis. GovValidator: members, validators, and blsPublicKeys are parallel lists managed in the same order.
Values at the same index across lists define a single validator identity.
  • Operator address (members): EOA or multisig address used for governance voting and validator registration/removal
  • Validator address (validators): Address used for consensus message signing and coinbase (block fee recipient), derived from the node’s nodekey
  • BLS public key (blsPublicKeys): BLS public key derived from the validator key, used for WBFT PREPARE/COMMIT aggregate signatures
For detailed key roles, derivation, and operational guidance, see Validator Operations. NativeCoinAdapter:

Validator Key Preparation

Each validator’s keys must be generated before network initialization.

Node Key Generation

Use the bootnode utility to generate node keys:
Values derived from the node key: For validator key security, rotation, and multisig operator keys, see Validator Operations.

genesis_generator Tool

genesis_generator is a CLI tool that generates a genesis file with correctly configured system contracts.

Build

Interactive Mode

Running without arguments starts interactive mode:
You will be prompted for:
  1. Consensus engine selection: choose Anzeon (WBFT)
  2. Number of nodes: single-node or multi-node
  3. Node key paths: path to each validator’s node key file (default: ./nodekey)
  4. Quorum configuration: governance quorum for multi-node setups (min 2, max = validator count)
  5. Chain ID: unique network identifier (random if omitted)
The tool automatically derives validator addresses and BLS keys from node keys.

Command-Line Flags

Non-interactive usage is also supported (cmd/genesis_generator/genesis_generator.go 50–100):

Generation Examples

Single-validator network:
Multi-validator network:

Genesis Validation

During generation, genesis_generator automatically validates:
  1. Matching lengths of Init.Validators and Init.BLSPublicKeys arrays
  2. Correct hex encoding and length (96 bytes) of each BLS public key
  3. Valid Ethereum address format for all validator and member addresses
  4. Valid ranges for epoch length, block period, and timeout values
  5. Correct system contract addresses

Chain Initialization

Running gstable init

Initialize the chain database with the genesis file:
Initialization steps:
  1. Load genesis file and validate Anzeon configuration
  2. Generate WBFT ExtraData from the initial validator set
  3. Deploy system contracts via InjectContracts()
  4. Commit the genesis block to the database
If an existing database is found, the provided genesis is checked against the stored genesis.
A mismatch results in a GenesisMismatchError.

Starting Nodes After Initialization

For full runtime options, see Node Configuration.

Two-Phase Validator Initialization

StableNet manages validator sets in two phases: Phase 1: First Epoch (Block 1 ~ epochLength)
  • Defined in Anzeon.Init.Validators
  • Hardcoded in the genesis block ExtraData
  • Not modifiable via governance
Phase 2: From Second Epoch Onward
  • Defined in SystemContracts.GovValidator.Params
  • Validator set updated at epoch blocks by reading GovValidator contract state
  • Modifiable via governance voting
This design allows the chain to bootstrap with a minimal validator set and then transition to governance-controlled validator management.
For details, see Validator Governance.

Network-Specific Configuration

Mainnet

  • Chain ID: 8282
  • Network flag: --mainnet
  • Bootnodes: automatically configured (params.StableNetMainnetBootnodes)
  • Genesis: embedded in the binary (no init required)

Testnet

  • Chain ID: 8283
  • Network flag: --testnet
  • Bootnodes: automatically configured (params.StableNetTestnetBootnodes)
  • Genesis: embedded in the binary (no init required)

Private Network

Private networks require a custom genesis file. Setup procedure:
  1. Generate node keys for each validator (bootnode -genkey)
  2. Generate the genesis file using genesis_generator
  3. Run gstable init genesis.json on all nodes
  4. Start nodes with --networkid and --bootnodes specified
Recommended parameters for private networks: Private network startup example:
For production deployment checklists, Docker deployment, and Debian packages, see Network Deployment.

Post-Initialization Verification

After initialization, verify the following:

Common Initialization Issues and Resolutions

Genesis Mismatch Error

Error: GenesisMismatchError: database contains incompatible genesis Cause: Attempting to initialize with a genesis file that does not match the existing database. Resolution:

Validator Count Mismatch

Error: Invalid genesis config: validator count mismatch Cause: Length mismatch between Init.Validators and Init.BLSPublicKeys. Resolution: Ensure members, validators, and blsPublicKeys all have the same number of entries.

System Contract Deployment Failure

Error: Failed to inject system contracts Cause: Invalid initialization parameters or missing contract bytecode. Resolution: Verify system contract parameters, especially address format (0x prefix, 40 hex chars) and comma-separated list syntax.

BLS Key Format Error

Error: Invalid BLS public key format Cause: Incorrect hex encoding or length of the BLS key. Resolution: BLS public keys must include a 0x prefix and be exactly 98 characters long
(0x + 96-byte hex encoding = 0x + 192 hex characters).
Verify using bootnode -nodekey.

Init vs GovValidator Validator Mismatch Warning

If Init.Validators and SystemContracts.GovValidator.Params.validators differ, the validator set will change at the transition from the first to the second epoch.
Unless intentional, keep both sets identical.