synor/docs/PLAN/PHASE1-NodeIntegration/01-Milestone-02-GenesisChain.md
Gulshan Yadav 48949ebb3f Initial commit: Synor blockchain monorepo
A complete blockchain implementation featuring:
- synord: Full node with GHOSTDAG consensus
- explorer-web: Modern React blockchain explorer with 3D DAG visualization
- CLI wallet and tools
- Smart contract SDK and example contracts (DEX, NFT, token)
- WASM crypto library for browser/mobile
2026-01-08 05:22:17 +05:30

4 KiB

Phase 1, Milestone 2: Genesis & Chain Initialization

Genesis block creation and chain setup

Status: Complete Priority: Critical Application: synord


Overview

Implement genesis block creation, chain initialization, and network-specific configuration.


Tasks

Task 2.1: Genesis Block Creation

  • Define genesis block structure
  • Create initial UTXO allocations
  • Set genesis timestamp and nonce
  • Calculate genesis block hash
  • Store genesis in config

Files:

  • apps/synord/src/genesis.rs
  • crates/synor-types/src/genesis.rs

Validation:

cargo test -p synord genesis
./target/release/synord init --network devnet
# Verify genesis hash in output

Task 2.2: Chain Initialization Command

  • Implement synord init command
  • Create data directory structure
  • Initialize RocksDB databases
  • Store genesis block
  • Set chain metadata

Files:

  • apps/synord/src/main.rs (init command)
  • apps/synord/src/cli.rs

Validation:

./target/release/synord init --network testnet
ls -la ~/.synor/data/

Task 2.3: Network Parameters

  • Configure mainnet parameters
  • Configure testnet parameters
  • Configure devnet parameters
  • Chain ID assignment
  • Block time configuration

Files:

  • apps/synord/src/config.rs
  • crates/synor-network/src/config.rs

Network Configuration:

Parameter Mainnet Testnet Devnet
Chain ID 0 1 2
Block Time 1s 100ms 100ms
K Parameter 18 18 8
Max Block Size 1MB 1MB 1MB

Task 2.4: Metadata Storage

  • Store genesis hash
  • Store chain ID
  • Store network version
  • Store upgrade heights

Files:

  • apps/synord/src/services/storage.rs

Validation:

./target/release/synord init --network testnet
./target/release/synord info
# Should show chain metadata

Validation

Validation Commands

# Initialize all networks
./target/release/synord init --network mainnet --data-dir /tmp/synor-mainnet
./target/release/synord init --network testnet --data-dir /tmp/synor-testnet
./target/release/synord init --network devnet --data-dir /tmp/synor-devnet

# Verify genesis hashes are deterministic
./target/release/synord init --network devnet --data-dir /tmp/test1
./target/release/synord init --network devnet --data-dir /tmp/test2
# Compare genesis hashes - should be identical

Validation Agents

Agent Purpose
code-reviewer Review genesis creation logic
type-design-analyzer Validate config types

Genesis Verification

// Test that genesis is deterministic
#[test]
fn test_genesis_deterministic() {
    let genesis1 = create_genesis(Network::Devnet);
    let genesis2 = create_genesis(Network::Devnet);
    assert_eq!(genesis1.hash(), genesis2.hash());
}

// Test genesis has correct structure
#[test]
fn test_genesis_structure() {
    let genesis = create_genesis(Network::Testnet);
    assert_eq!(genesis.header.blue_score, 0);
    assert_eq!(genesis.header.parents.len(), 0);
    assert!(genesis.transactions.len() > 0); // Coinbase
}

Security Checks

  • Genesis hash is hardcoded and verified at startup
  • Initial allocations match documented distribution
  • No private keys embedded in genesis
  • Chain ID prevents cross-network replay

Compliance

  • Genesis allocations follow token economics plan
  • Distribution addresses are publicly verifiable
  • Timestamp is reasonable (not far future/past)

Genesis Allocations (Testnet)

Purpose Address Amount Vesting
Faucet synor:qz... 10M None
Dev Fund synor:qz... 5M 2 years
Community synor:qz... 5M 1 year

Acceptance Criteria

  1. synord init creates valid chain state
  2. Genesis hash is deterministic per network
  3. Chain metadata correctly stored
  4. Node can start after initialization
  5. Genesis block validates correctly

Completed: January 2025