Architecture#
Shell Chain is built as a modular Rust workspace with 12 independent crates. Each crate owns a single responsibility, enabling clean dependency boundaries, parallel compilation, and straightforward testing.
Dependency Layers#
┌─────────────────────────────────────────────────────┐
│ shell-cli │ ← Binary entry point
│ shell-node │ ← Async node harness
├──────────┬──────────┬───────────┬───────────────────┤
│ shell-rpc│shell-net │shell-pool │ shell-consensus │ ← Service layer
│ (JSON-RPC)│ (libp2p)│ (mempool) │ (PoA engine) │
├──────────┴──────────┴───────────┴───────────────────┤
│ shell-evm │ ← Execution layer
│ (revm + PQ precompiles) │
├─────────────────────────────────────────────────────┤
│ shell-storage │ ← Persistence layer
│ (RocksDB + Merkle Patricia Trie) │
├──────────────────────┬──────────────────────────────┤
│ shell-core │ shell-keystore │ ← Domain layer
│ (Block, Tx, Account) │ (PQ keystore, argon2id) │
├──────────────────────┴──────────────────────────────┤
│ shell-crypto │ shell-primitives │ ← Foundation layer
│ (Dilithium, SPHINCS+)│ (H256, Address, U256, etc.) │
└──────────────────────┴──────────────────────────────┘
Higher layers depend on lower layers. No circular dependencies exist.
Crate Reference#
| Crate | Description |
|---|---|
| shell-primitives | Core types: Keccak-256, BLAKE3 hashing, H256, Address, U256, Bytes. Every other crate depends on this. |
| shell-crypto | Post-quantum signing via CRYSTALS-Dilithium (ML-DSA) and SPHINCS+ (SLH-DSA). Wraps pqcrypto with an ergonomic API. |
| shell-core | Domain models — Block, Transaction (account-abstraction native), Account, Receipt. Defines the canonical chain types. |
| shell-keystore | Encrypted PQ keystore. Private keys are protected with argon2id key derivation and AES-256-GCM. |
| shell-storage | RocksDB-backed persistence with a Merkle Patricia Trie for state proofs. Provides StateDB and ChainDB traits. |
| shell-evm | EVM execution powered by revm (Cancun spec). Adds custom precompiles for PQ signature verification. |
| shell-consensus | Epoch-based Proof-of-Authority engine with a finality tracker. Manages validator sets and block sealing. |
| shell-mempool | Transaction pool with PQ signature validation, nonce ordering, and gas-price priority queues. |
| shell-network | Peer-to-peer networking via libp2p. Uses GossipSub for block/tx propagation and Kademlia DHT for peer discovery. |
| shell-rpc | JSON-RPC server (HTTP + WebSocket) exposing Ethereum-compatible endpoints plus Shell Chain extensions. |
| shell-node | Async node harness that wires every subsystem together. Handles block production, sync, and graceful shutdown. |
| shell-cli | CLI binary. Parses TOML configuration, initializes logging, and launches the node. |
Data Flow#
Transaction Lifecycle#
- Submission — A client sends a signed transaction via
shell-rpc(eth_sendRawTransaction). - Validation —
shell-mempoolverifies the PQ signature usingshell-crypto, checks the nonce againstshell-storage, and inserts the transaction into the priority queue. - Propagation —
shell-networkbroadcasts the transaction to peers via GossipSub. - Inclusion — When it is the validator's turn,
shell-consensusselects transactions from the mempool and passes them toshell-evmfor execution. - Execution —
shell-evmruns each transaction against the state trie, producing receipts and state diffs. - Sealing —
shell-consensusassembles the block, and the validator signs it with their PQ key. - Storage —
shell-storagepersists the block, receipts, and updated state trie to RocksDB. - Finality — The finality tracker in
shell-consensusmarks the block as finalized after sufficient attestations.
Block Sync#
When a new node joins the network:
shell-networkdiscovers peers via Kademlia DHT.- The node requests block headers and bodies from peers.
shell-evmre-executes each block to verify state transitions.shell-storagecommits verified state to RocksDB.
Build & Test#
# Build the entire workspace
cargo build --release
# Run all tests
cargo test --workspace
# Run a specific crate's tests
cargo test -p shell-evm
# Build only the CLI binary
cargo build --release -p shell-cli
Directory Layout#
shell-chain/
├── crates/
│ ├── shell-primitives/
│ ├── shell-crypto/
│ ├── shell-core/
│ ├── shell-keystore/
│ ├── shell-storage/
│ ├── shell-evm/
│ ├── shell-consensus/
│ ├── shell-mempool/
│ ├── shell-network/
│ ├── shell-rpc/
│ ├── shell-node/
│ └── shell-cli/
├── docs/
├── config/
└── Cargo.toml # Workspace manifest