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 thegenesis_generator tool and manual genesis file authoring.
Related documents:
- Node Configuration — runtime options and configuration for initialized nodes
- System Contracts Overview — detailed structure and storage layout of system contracts
- Network Deployment — production network deployment procedures
- Validator Operations — validator node operation and key management
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, theChainConfig 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)
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’snodekey - BLS public key (
blsPublicKeys): BLS public key derived from the validator key, used for WBFT PREPARE/COMMIT aggregate signatures
Validator Key Preparation
Each validator’s keys must be generated before network initialization.Node Key Generation
Use thebootnode utility to generate node keys:
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:- Consensus engine selection: choose Anzeon (WBFT)
- Number of nodes: single-node or multi-node
- Node key paths: path to each validator’s node key file (default:
./nodekey) - Quorum configuration: governance quorum for multi-node setups (min 2, max = validator count)
- Chain ID: unique network identifier (random if omitted)
Command-Line Flags
Non-interactive usage is also supported (cmd/genesis_generator/genesis_generator.go 50–100):
Generation Examples
Single-validator network:Genesis Validation
During generation,genesis_generator automatically validates:
- Matching lengths of
Init.ValidatorsandInit.BLSPublicKeysarrays - Correct hex encoding and length (96 bytes) of each BLS public key
- Valid Ethereum address format for all validator and member addresses
- Valid ranges for epoch length, block period, and timeout values
- Correct system contract addresses
Chain Initialization
Running gstable init
Initialize the chain database with the genesis file:- Load genesis file and validate Anzeon configuration
- Generate WBFT ExtraData from the initial validator set
- Deploy system contracts via
InjectContracts() - Commit the genesis block to the database
A mismatch results in a
GenesisMismatchError.
Starting Nodes After Initialization
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
- Defined in
SystemContracts.GovValidator.Params - Validator set updated at epoch blocks by reading GovValidator contract state
- Modifiable via governance voting
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:- Generate node keys for each validator (
bootnode -genkey) - Generate the genesis file using
genesis_generator - Run
gstable init genesis.jsonon all nodes - Start nodes with
--networkidand--bootnodesspecified
Private network startup example:
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
IfInit.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.

