synor/docs/PLAN.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

17 KiB

Synor Development Roadmap

Quantum-secure decentralized cloud computing blockchain platform

Current Status Overview

Component Status Completeness
synor-types Working 100%
synor-crypto Working 100%
synor-dag Working 100%
synor-consensus Working 100%
synor-mining Working 100%
synor-storage Working 100%
synor-vm Working 100%
synor-governance Working 100%
synor-network Working 100%
synor-rpc Working 98%
synor-cli Working 98%
synor-compiler Working 100%
synord (node) Working 97%
web-wallet Foundation 70%

All core components functional! Node initializes and runs successfully.

Recent Updates (January 2026)

synord improvements:

  • Block import/export commands (synord import, synord export)
  • RPC hardcoded values replaced with real data (sync status, difficulty, hashrate)
  • Mempool cleanup task with expired transaction removal

synor-cli improvements:

  • Transaction building fully implemented with hybrid signatures
  • Block lookup by blue score (DAG equivalent of height)
  • Proper ScriptPubKey creation for all address types

synor-rpc improvements:

  • Added synor_getBlocksByBlueScore method for DAG block queries

Web wallet (apps/web/) - NEW:

  • Complete React + TypeScript foundation
  • Wallet creation with 24-word BIP39 mnemonic
  • Wallet recovery from mnemonic phrase
  • Password-encrypted seed storage (AES-256-GCM)
  • Send/receive transactions UI
  • Transaction history viewer
  • Settings with network selection
  • Dashboard with balance display

Previous Updates (January 2025)

  • All services are wired and functional
  • Genesis block creation works (synord init)
  • Node starts successfully (synord run)
  • CLI has 23 commands implemented
  • Wallet supports hybrid Ed25519 + Dilithium3 keys
  • RPC server with HTTP/WebSocket endpoints working

Phase 1: Node Integration (Priority: Critical) COMPLETE

1.1 Complete synord Service Wiring

All services are now wired and functional.

Tasks:

  • Storage Service Integration

    • Initialize RocksDB with column families
    • Wire BlockStore, HeaderStore, UtxoStore from synor-storage
    • Implement actual get/put operations
    • File: apps/synord/src/services/storage.rs
  • Consensus Service Integration

    • Wire TransactionValidator from synor-consensus
    • Wire BlockValidator from synor-consensus
    • Implement block processing pipeline
    • Connect UTXO updates on block acceptance
    • File: apps/synord/src/services/consensus.rs
  • Network Service Integration

    • Initialize libp2p swarm from synor-network
    • Start P2P listener on configured port
    • Connect to bootstrap/seed nodes
    • Wire GossipSub message handling
    • File: apps/synord/src/services/network.rs
  • Sync Service Implementation

    • Implement header-first sync strategy
    • Download headers from peers
    • Validate header chain
    • Download blocks in parallel
    • File: apps/synord/src/services/sync.rs
  • RPC Service Activation

    • Start jsonrpsee HTTP server
    • Start jsonrpsee WebSocket server
    • Wire handlers to actual service methods
    • File: apps/synord/src/services/rpc.rs
  • Miner Service Integration

    • Spawn mining threads with kHeavyHash
    • Wire block template generation
    • Handle found blocks submission
    • File: apps/synord/src/services/miner.rs

1.2 Genesis Block & Chain Initialization

  • Create genesis block with initial allocations
  • Implement synord init command to set up chain
  • Configure network parameters per chain (mainnet/testnet/devnet)
  • Store genesis hash in metadata

Phase 2: CLI Wallet Completion (Priority: High) COMPLETE

2.1 Wallet Cryptography

All wallet cryptography is implemented and working.

Tasks:

  • Mnemonic Integration

    • Use synor-crypto Mnemonic for phrase generation (24 words)
    • Implement BIP39 seed derivation
    • File: apps/cli/src/wallet.rs
  • Keypair Generation

    • Generate Ed25519 + Dilithium3 hybrid keypairs
    • Derive addresses from public keys
    • File: apps/cli/src/wallet.rs
  • Wallet Encryption

    • Implement AES-256-GCM encryption for keys
    • Use Argon2id for password-based key derivation
    • File: apps/cli/src/wallet.rs
  • Transaction Signing

    • Wire hybrid signature creation
    • File: apps/cli/src/wallet.rs

2.2 CLI Commands

All 23 commands are implemented:

  • synor wallet create - Generate new wallet with mnemonic
  • synor wallet recover - Recover from mnemonic phrase
  • synor balance - Query UTXO balance
  • synor send - Build and sign transactions
  • synor tx - Transaction info
  • synor block - Fetch block by hash/height
  • synor contract deploy - Deploy WASM contracts
  • synor contract call - Invoke contract methods
  • Plus 15 more commands (info, peers, tips, mempool, mining, etc.)

Phase 3: Network Bootstrap (Priority: High) COMPLETE

3.1 Testnet Deployment COMPLETE

  • Configure testnet parameters
    • Chain ID: 1 (testnet)
    • Block time: 100ms
    • K parameter: 18
    • File: crates/synor-network/src/config.rs (testnet_params module)
    • File: apps/synord/src/config.rs (ConsensusConfig::for_network)
  • Deploy seed nodes (3-5 geographically distributed)
    • Infrastructure ready: DNS entries configured for seed1/seed2/seed3.synor.cc
    • Peer ID placeholders in config - add peer IDs after nodes are running
  • Add bootstrap peer addresses to config
    • File: crates/synor-network/src/config.rs (lines 220-236)
    • File: apps/synord/src/config.rs (P2PConfig::for_network)
  • Create testnet faucet
    • File: apps/faucet/src/main.rs (665 lines, full-featured)
    • Features: Rate limiting, cooldowns, HTML UI, API endpoints, stats
  • Deploy block explorer backend
    • File: apps/explorer/src/main.rs (1134 lines, full-featured)
    • Features: Block/tx queries, address info, DAG visualization, network stats, search

3.2 Network Hardening

  • Implement peer banning and reputation
    • File: crates/synor-network/src/reputation.rs
  • Add rate limiting for requests
    • File: crates/synor-network/src/rate_limit.rs
  • Implement eclipse attack mitigations
    • Subnet diversity, anchor connections, peer rotation
  • Add network partition detection
    • File: crates/synor-network/src/partition.rs - Detection module with 65 tests

Phase 4: Smart Contracts (Priority: Medium) COMPLETE

4.1 Contract Development Kit COMPLETE

  • Create contract template/boilerplate
    • File: contracts/template/ - Complete starter template with README
    • Script: scripts/new-contract.sh - Generator script
  • Document host function ABI
    • File: contracts/HOST_FUNCTIONS.md
  • Build Rust SDK for contract development
    • File: crates/synor-sdk/ - Full SDK with storage, events, crypto
  • Create example contracts:
    • Token (fungible): contracts/token/
    • NFT (non-fungible): contracts/nft/
    • DEX (decentralized exchange): contracts/dex/
    • Staking: contracts/staking/

4.2 Contract Tooling

  • Contract compiler (Rust -> WASM optimizer)
    • File: crates/synor-compiler/ - Full WASM optimizer with validation and metadata extraction
  • Contract testing framework
    • File: crates/synor-contract-test/ - Mock storage, test accounts, assertion macros
  • Gas estimation tool
    • File: crates/synor-vm/src/gas_estimator.rs - Binary search estimation, cost constants
  • Contract verification system
    • Built into synor-compiler: Validator struct with ABI and custom section validation

Phase 5: Governance Activation (Priority: Medium) COMPLETE

5.1 DAO Launch

  • Deploy governance contract
  • Implement proposal creation UI/CLI
  • Implement voting mechanism
  • Create treasury initialization

5.2 Governance Features

  • Parameter change proposals
  • Protocol upgrade mechanism
  • Emergency pause capability
  • Vesting schedule management

Implementation Notes (January 2025):

  • Governance contract: contracts/governance/src/lib.rs
  • DAO module: crates/synor-governance/src/dao.rs
  • Proposal system: crates/synor-governance/src/proposal.rs
  • Voting mechanism: crates/synor-governance/src/voting.rs
  • Treasury management: crates/synor-governance/src/treasury.rs
  • CLI commands: apps/cli/src/commands/governance.rs

Phase 6: Performance & Testing (Priority: Medium) COMPLETE

6.1 Benchmarks COMPLETE

  • Crypto benchmarks (Ed25519, Dilithium, hybrid signing)
    • File: crates/synor-crypto/benches/crypto_bench.rs
    • Run: cargo bench -p synor-crypto
    • Results: Ed25519 32.8µs, Dilithium3 44.4µs, Hybrid 85.1µs verify
  • GHOSTDAG benchmarks (ordering, blue score)
    • File: crates/synor-dag/benches/ghostdag_bench.rs
    • Results: 148K blocks/s linear insert, 101M ops/s blue score lookup
  • Consensus benchmarks (validation)
    • File: crates/synor-consensus/benches/consensus_bench.rs
    • Results: 11.3M tx/s validation, 25.6M ops/s UTXO lookup
  • Mining benchmarks (kHeavyHash)
    • File: crates/synor-mining/benches/mining_bench.rs
    • Run: cargo bench -p synor-mining --bench mining_bench
  • Storage benchmarks (read/write throughput)
    • File: crates/synor-storage/benches/storage_bench.rs
    • Run: cargo bench -p synor-storage --bench storage_bench

6.2 Testing COMPLETE

  • Integration tests for node lifecycle
    • File: apps/synord/tests/node_lifecycle.rs
  • Multi-node network tests
    • File: apps/synord/tests/multi_node_network.rs (683 lines, 14 tests)
  • Sync protocol tests
    • File: apps/synord/tests/sync_protocol.rs (532 lines, 14 tests)
  • Fork resolution tests
    • File: apps/synord/tests/fork_resolution.rs (667 lines, 17 tests)
  • Reorg tests
    • File: apps/synord/tests/reorg_tests.rs (DAG restructuring, VSP updates, partition recovery)
  • Stress tests (high TPS)
    • File: apps/synord/tests/stress_tests.rs (concurrent queries, multi-node stress, throughput)

6.3 Optimization

  • Profile critical paths
    • Script: scripts/profile.sh - Flamegraph generation for all components
    • Cargo profile: [profile.profiling] with debug symbols for flamegraphs
    • Results (January 2026):
      • Crypto: Ed25519 sign 13µs, Dilithium3 sign 135µs, Hybrid verify 82µs
      • GHOSTDAG: Blue score lookup 9.9ns (~100M ops/s), block insert 1-37µs
      • Consensus: TX validation 89-694ns, block header 94ns, PoW 461ns
      • Blake3: 1.7 GB/s throughput
  • Optimize GHOSTDAG for large DAGs
    • File: crates/synor-dag/src/ghostdag.rs - Incremental anticone tracking
    • Optimization: Replaced O(n²) k-cluster check with O(n) incremental update
    • Result: 50% improvement for wide DAGs (16 parents: 73µs → 38µs)
  • Cache tuning for storage layer
    • File: crates/synor-storage/src/cache.rs - Replaced O(n) LRU with O(1) lru crate
    • Added lru crate to workspace dependencies for efficient doubly-linked list cache
    • Result: O(1) get/put operations (~15-20ns per op vs previous O(n))
  • Connection pool for RPC
    • File: crates/synor-rpc/src/pool.rs - HTTP/WS pooling with health checks

Phase 7: Production Readiness (Priority: Low - Future)

7.1 Security

  • Security audit of cryptographic code
  • Security audit of consensus logic
  • Formal verification of critical components
  • Bug bounty program

7.2 Mainnet Launch

  • Finalize mainnet parameters
  • Genesis ceremony
  • Initial token distribution
  • Launch infrastructure

7.3 Ecosystem

  • Web wallet foundation (apps/web/)
    • React + TypeScript + Vite + TailwindCSS
    • BIP39 mnemonic generation and recovery
    • Ed25519 signing (Dilithium3 pending WASM module)
    • AES-256-GCM encrypted seed storage
    • Transaction building and signing
    • JSON-RPC client for node communication
    • Zustand state management
  • Desktop wallet (Tauri-based, future)
  • Mobile wallet (React Native, future)
  • Block explorer frontend (apps/explorer-web/)
    • React + TypeScript + Vite + TailwindCSS
    • Network stats, blocks, transactions, addresses
    • DAG visualization with blue score grouping
    • Search functionality (block/tx/address)
    • Responsive design with dark theme
  • Developer documentation (docs/DEVELOPER_GUIDE.md)
  • API providers
  • Exchange integrations

Technical Debt & Cleanup

Minor Issues

  • Stratum PoW verification (mining/stratum.rs) Implemented full kHeavyHash verification
  • VM storage change tracking (vm/engine.rs) Added pending_changes() to MemoryStorage
  • Remove unused imports (cargo fix) Cleaned up
  • Address dead code warnings Added allow attributes where intentional

Code Quality

  • Increase test coverage to 80%+
    • 387+ unit tests across all crates
    • Comprehensive integration tests for node lifecycle, sync, fork resolution
    • Property-based tests for consensus invariants
  • Add property-based tests for consensus
    • File: crates/synor-consensus/tests/property_tests.rs (20 property tests)
    • UTXO invariants (add/remove identity, total value consistency, maturity)
    • Difficulty properties (roundtrip, adjustment bounds, PoW validation)
    • Amount arithmetic (commutativity, overflow protection)
  • Document public APIs
    • synor-crypto: Comprehensive guide to hybrid Ed25519+Dilithium3 cryptography
    • synor-consensus: Architecture diagram, UTXO examples, difficulty adjustment usage
    • All crates have module-level rustdocs with examples
    • Run cargo doc --workspace --no-deps to generate HTML documentation
  • Add CI/CD pipeline
    • File: .github/workflows/ci.yml - Build, test, lint
    • File: .github/workflows/release.yml - Multi-platform releases
    • File: .github/dependabot.yml - Dependency updates

Priority Matrix

Task Impact Effort Priority Status
Storage service wiring Critical Medium P0 Done
Consensus service wiring Critical High P0 Done
Network service wiring Critical Medium P0 Done
Sync service implementation Critical High P0 Done
Wallet crypto integration High Low P1 Done
RPC server activation High Low P1 Done
CLI commands High Medium P1 Done
Governance activation Medium Medium P2 Done
Integration tests Medium Medium P2 Done
Testnet deployment High Medium P2 Done
Smart contract SDK Medium High P3 Done
Benchmarks Low Low P4 Done
Security audit Critical High P5 (pre-mainnet) Pending

Getting Started

To work on the next phase:

# Build the workspace
cargo build --workspace

# Run tests
cargo test --workspace

# Start the node (once Phase 1 is complete)
./target/debug/synord run --network testnet

# Use the CLI (once Phase 2 is complete)
./target/debug/synor wallet create

Architecture Notes

                    ┌─────────────────┐
                    │     synord      │  <- Node daemon
                    │   (integration) │
                    └────────┬────────┘
                             │
    ┌────────────────────────┼────────────────────────┐
    │            │           │           │            │
┌───▼───┐  ┌─────▼─────┐ ┌───▼───┐ ┌─────▼─────┐ ┌────▼────┐
│Network│  │ Consensus │ │  RPC  │ │  Mining   │ │ Storage │
│       │  │           │ │       │ │           │ │         │
└───┬───┘  └─────┬─────┘ └───────┘ └─────┬─────┘ └────┬────┘
    │            │                       │            │
    │      ┌─────┴─────┐                 │      ┌─────┴─────┐
    │      │           │                 │      │           │
┌───▼───┐ ┌▼─────┐ ┌───▼───┐        ┌────▼────┐ │  RocksDB  │
│libp2p │ │ DAG  │ │ UTXO  │        │kHeavyHash│ │           │
└───────┘ └──────┘ └───────┘        └─────────┘ └───────────┘
                │
          ┌─────┴─────┐
          │           │
      ┌───▼───┐   ┌───▼───┐
      │  VM   │   │ Crypto │
      │(WASM) │   │(Hybrid)│
      └───────┘   └────────┘

Last updated: January 7, 2026