Draft Architecture L2

Cirkle Blockchain Architecture

                                              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                              β”‚  Explorer   β”‚
                                              β”‚             β”‚
                                              β””β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”˜
                                                    β”‚ JSON-RPC
                                                    β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       libp2p Gossipsub       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            β”‚ ◄──────────────────────────► β”‚               β”‚
β”‚  CLI Walletβ”‚      libp2p PubSub &         β”‚  Core Node    β”‚
β”‚            β”‚       Peer Discovery         β”‚               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β–²                                            β–²
       β”‚                                            β”‚
       β”‚                                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
       β”‚                                β”‚   Consensus Engine    β”‚
       β”‚                                β”‚   (PoS Validator      β”‚
       β”‚                                β”‚    Selection + BFT)   β”‚
       β”‚                                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚                                            β”‚ State
       β”‚                                            β”‚ Transition
       β”‚                                            β”‚
       β”‚   JSON-RPC / gRPC              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
       └────────────────────────────────│    State Machine      β”‚
                                        β”‚  (EVM Engine + Merkle β”‚
                                        β”‚       Trie)           β”‚
                                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                    β”‚
                                                    β”‚
                                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                         β”‚      Mempool         β”‚
                                         β”‚ (TX Pool + Validator β”‚
                                         β”‚   Block Assembler)   β”‚
                                         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–²β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                    β”‚ Blocks & TXs
                                                    β”‚
                                          libp2p    β”‚
                                          PubSub    β”‚
                                                    β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                              β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”
β”‚  Relayer /    β”‚                              β”‚  Bridge β”‚
β”‚ Monitoring    β”‚                              β”‚ Module  β”‚
β”‚ & Metrics     β”‚                              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ (Prom/Graf)   β”‚                              
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Components

Components 1, 2, 3, 4 are required for an MVP

  1. P2P Layer (libp2p)

    • Peer Discovery via mDNS/DHT
    • Gossipsub for:
      • Transaction propagation
      • Block propagation
    • Secure Channels (Noise/TLS)
  2. Core Node (Go)

    • Consensus Engine
      • PoS validator selection
      • BFT finality
    • State Machine
      • EVM-compatible execution (go-ethereum’s evm package)
      • Merkle trie for world state
    • Mempool & Block Assembler
      • Transaction validation, gas accounting
      • Block creation by elected validator
    • APIs
      • JSON-RPC & gRPC for wallets, explorer, and relayer
      • REST for health checks
  3. Wallet (CLI & MetaMask-compatible)

    • Key management (BIP-39, secp256k1)
    • Transaction creation & signing
    • Peer discovery for local devnet (optional via libp2p)
    • RPC calls to Core Node for balance & tx submission
  4. Bridge Module

    • Relayer Service listens to:
      • Ethereum deposit events (via web3)
      • Cirkle withdrawal events (via libp2p PubSub or RPC)
    • Initiates cross-chain mint/burn transactions
  5. Explorer (React/NextJS)

    • Indexer Service (Go) subscribes to libp2p PubSub or polls JSON-RPC
    • Stores blocks/txs in database
    • Exposes REST/GraphQL for frontend
    • Real-time updates via WebSocket
  6. Monitoring & Metrics

    • Prometheus exporter in Core Node and Explorer
    • Grafana dashboards for:
      • Peer count, mempool size, block times
      • Validator performance & uptime

Data Flows

  • Transaction Flow: Wallet β–Ά JSON-RPC β–Ά Core Node β–Ά libp2p PubSub β–Ά All Peers β–Ά Mempool β–Ά Block Assembler β–Ά Block PubSub β–Ά All Peers β–Ά State Machine

  • Block Propagation: Core Node (Validator) β–Ά libp2p Gossipsub β–Ά Other Nodes β–Ά Block Validation β–Ά State Update

  • Explorer Indexing: Explorer Indexer β–Ά (libp2p subscription or RPC polling) β–Ά Processes Blocks/Txs β–Ά Database β–Ά API β–Ά Frontend

  • Cross-Chain Bridge: Relayer β–Ά Ethereum β–Ά Bridge Contract β–Ά Events β–Ά Cirkle β–Ά libp2p or RPC β–Ά Mint/Burn on Cirkle


Loading comments...