synor/docs/PLAN/PHASE1-NodeIntegration/01-Milestone-01-ServiceWiring.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.7 KiB

Phase 1, Milestone 1: Service Wiring

Complete synord service integration

Status: Complete Priority: Critical Application: synord


Overview

Wire all core services in the synord node daemon: storage, consensus, network, sync, RPC, and mining.


Tasks

Task 1.1: Storage Service Integration

  • Initialize RocksDB with column families
  • Wire BlockStore from synor-storage
  • Wire HeaderStore from synor-storage
  • Wire UtxoStore from synor-storage
  • Implement actual get/put operations
  • Add block import/export commands

Files:

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

Validation:

cargo test -p synord --lib storage

Task 1.2: Consensus Service Integration

  • Wire TransactionValidator from synor-consensus
  • Wire BlockValidator from synor-consensus
  • Implement block processing pipeline
  • Connect UTXO updates on block acceptance
  • Integrate GHOSTDAG ordering

Files:

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

Validation:

cargo test -p synord --lib consensus

Task 1.3: Network Service Integration

  • Initialize libp2p swarm from synor-network
  • Start P2P listener on configured port
  • Connect to bootstrap/seed nodes
  • Wire GossipSub message handling
  • Implement peer discovery

Files:

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

Validation:

cargo test -p synord --lib network

Task 1.4: Sync Service Implementation

  • Implement header-first sync strategy
  • Download headers from peers
  • Validate header chain
  • Download blocks in parallel
  • Handle chain reorganizations

Files:

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

Validation:

cargo test -p synord --test sync_protocol

Task 1.5: RPC Service Activation

  • Start jsonrpsee HTTP server
  • Start jsonrpsee WebSocket server
  • Wire handlers to actual service methods
  • Replace hardcoded values with real data
  • Add blue score block queries

Files:

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

Validation:

cargo test -p synord --lib rpc
curl -X POST http://localhost:16110 -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"synor_getInfo","params":[],"id":1}'

Task 1.6: Miner Service Integration

  • Spawn mining threads with kHeavyHash
  • Wire block template generation
  • Handle found blocks submission
  • Implement difficulty adjustment

Files:

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

Validation:

cargo test -p synord --lib miner

Task 1.7: Mempool Service

  • Transaction pool management
  • Fee-based prioritization
  • Dependency tracking
  • Expiration and cleanup task

Files:

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

Validation:

cargo test -p synord --lib mempool

Validation

Validation Commands

# Run all synord tests
cargo test -p synord

# Run integration tests
cargo test -p synord --test '*'

# Start node and verify
./target/release/synord init --network devnet
./target/release/synord run --network devnet &
sleep 5
curl http://localhost:16110 -X POST -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"synor_getInfo","params":[],"id":1}'

Validation Agents

Agent Purpose
code-reviewer Review service implementations
silent-failure-hunter Check error handling in services
Explore Verify codebase structure

Integration Test Suite

# Node lifecycle
cargo test -p synord --test node_lifecycle

# Multi-node network
cargo test -p synord --test multi_node_network

# Sync protocol
cargo test -p synord --test sync_protocol

# Fork resolution
cargo test -p synord --test fork_resolution

Security Checks

  • RPC endpoints require authentication for sensitive operations
  • Network service validates peer messages
  • Storage service uses proper file permissions
  • Mempool validates transactions before acceptance
  • No SQL/command injection in RPC handlers

Performance Criteria

Metric Target Validation
Block processing <100ms Benchmark suite
RPC latency <10ms Load testing
Sync speed >100 blocks/s Integration test
Memory usage <2GB idle Resource monitoring

Dependencies

  • rocksdb - Storage backend
  • jsonrpsee - RPC framework
  • libp2p - P2P networking
  • tokio - Async runtime

Acceptance Criteria

  1. Node starts without errors
  2. All 9 unit tests pass
  3. All integration tests pass
  4. RPC responds to all documented methods
  5. Sync completes with test peers
  6. Mining produces valid blocks

Completed: January 2025