GitHub โ†—

TrustNode

๐Ÿงช View test results โ€” 110/110 โ†’

A custom Solana-like validator built from scratch in Rust โ€” PoH clock, Tower BFT consensus, Sealevel parallel execution, Turbine block propagation with Reed-Solomon erasure coding, CRDS gossip protocol, and a SBF-inspired program executor.

Not a wrapper. Not a fork. Every line written from scratch to understand how Solana actually works.

Project status: educational/research implementation โ€” 110 tests, all green, full CI/CD pipeline.


๐ŸŽฏ What it does

Component What It Does Inspired By
PoH Clock SHA-256 hash chain creates a verifiable clock โ€” proves time has passed without trusting a timestamp server Solana PoH
Tower BFT PoH-based BFT consensus with lockout-based fork switching โ€” 2/3 supermajority for finality Solana Tower BFT
Sealevel Scheduler Groups non-conflicting transactions into parallel batches โ€” read-only accounts shared, write-locked serialized Solana Sealevel
Program Executor Dispatches instructions to System/Token programs โ€” full SOL transfers, account creation, token operations Solana SBF/EBPF
Accounts DB Append-only storage with DashMap index + Merkle state root โ€” O(1) lookups, verifiable state Solana AccountsDB
Turbine Reed-Solomon erasure coding splits blocks into shreds โ€” any k-of-n shreds reconstruct the block Solana Turbine
Gossip CRDS (Cluster Replicated Data Store) for node communication โ€” push messages, pull requests, ping/pong Solana CRDS
RPC Server JSON-RPC 2.0 API โ€” getAccountInfo, getBalance, getSlot, getHealth, sendTransaction (real execution via the tx-processor), getTransaction (status/logs by signature) Solana JSON-RPC

โš™๏ธ Architecture

flowchart TB
    subgraph "Validator Node"
        POH["โฑ๏ธ PoH Clock\nSHA-256 hash chain\nVerifiable delay function"]
        TOWER["๐Ÿ—ผ Tower BFT\nFork choice + lockout\n2/3 supermajority"]
        TX["โš™๏ธ Tx Processor\nSealevel scheduler\nParallel execution"]
        VM["๐Ÿ–ฅ๏ธ Program Executor\nSystem program\nToken program"]
        ACCT["๐Ÿ’พ Accounts DB\nAppend-only store\nMerkle state root"]
        TURB["๐Ÿ“ก Turbine\nReed-Solomon erasure\nNeighborhood tree"]
        GOSS["๐ŸŒ Gossip\nCRDS data store\nPush/pull protocol"]
        RPC["๐Ÿ”Œ RPC Server\nJSON-RPC 2.0\nAccount queries"]
    end

    POH --> TOWER
    TX --> VM
    VM --> ACCT
    TOWER --> TURB
    TX --> POH
    GOSS --> TURB
    ACCT --> RPC

๐Ÿš€ Quick start

# Build
git clone https://github.com/BartoszOsiej/solana-validator.git
cd solana-validator
cargo build --release

# Run validator (with block production)
./target/release/solana-validator --mining

# Run with RPC on custom port
./target/release/solana-validator --rpc-port 9000 --gossip-port 8001

# Run benchmarks
./target/release/solana-validator --bench

๐Ÿ“ Workspace Structure

solana-validator/
โ”œโ”€โ”€ crates/
โ”‚   โ”œโ”€โ”€ poh/                    # Proof of History clock
โ”‚   โ”œโ”€โ”€ accounts/               # State storage
โ”‚   โ”œโ”€โ”€ tx-processor/           # Transaction execution
โ”‚   โ”œโ”€โ”€ consensus/              # Tower BFT
โ”‚   โ”œโ”€โ”€ turbine/                # Block propagation
โ”‚   โ”œโ”€โ”€ gossip/                 # Node communication
โ”‚   โ”œโ”€โ”€ program-executor/       # Instruction VM
โ”‚   โ””โ”€โ”€ rpc/                    # JSON-RPC API
โ””โ”€โ”€ validator/
    โ””โ”€โ”€ src/main.rs             # Validator binary

โšก Benchmarks

Measured on Linux x86_64:

Benchmark Result
PoH throughput ~1M hashes/sec (SHA-256)
Accounts DB insert 10K accounts in <50ms
State root computation 1K accounts in <1ms
Erasure coding 100 encode/decode cycles
Transaction execution 10K txs/sec
Slot time ~400ms (configurable)

๐Ÿงช Test Results

test result: ok. 17 passed; 0 failed   (solana-poh)
test result: ok. 15 passed; 0 failed   (solana-accounts)
test result: ok. 12 passed; 0 failed   (solana-tx-processor)
test result: ok. 17 passed; 0 failed   (solana-consensus)
test result: ok. 16 passed; 0 failed   (solana-turbine)
test result: ok. 10 passed; 0 failed   (solana-gossip)
test result: ok.  6 passed; 0 failed   (solana-rpc)
test result: ok. 17 passed; 0 failed   (solana-program-executor)
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
           110 passed; 0 failed

๐Ÿ“ก RPC API

# Health check
curl -X POST http://127.0.0.1:8899 -d '{"jsonrpc":"2.0","method":"getHealth","id":1}'

# Get version
curl -X POST http://127.0.0.1:8899 -d '{"jsonrpc":"2.0","method":"getVersion","id":1}'

# Get slot
curl -X POST http://127.0.0.1:8899 -d '{"jsonrpc":"2.0","method":"getSlot","id":1}'

# Get account info
curl -X POST http://127.0.0.1:8899 -d '{"jsonrpc":"2.0","method":"getAccountInfo","params":["<pubkey>"],"id":1}'

# Get balance
curl -X POST http://127.0.0.1:8899 -d '{"jsonrpc":"2.0","method":"getBalance","params":["<pubkey>"],"id":1}'

๐Ÿง  How PoH Works

genesis_hash โ†’ SHA256 โ†’ SHA256 โ†’ SHA256 โ†’ ... โ†’ slot_hash
                โ†“          โ†“         โ†“
              tick       tick      tick
            (6000      (6000     (6000
            hashes)    hashes)   hashes)

Each tick proves that N sequential hash computations occurred. Transactions are interleaved between ticks, creating a verifiable temporal ordering.

Verification: To verify an entry, you re-hash from the previous hash N times and check the result matches. No trust required.

โš ๏ธ Disclaimer

This is an educational implementation โ€” not a production validator. It demonstrates the core concepts of Solana's architecture but lacks many production features (networking, persistence, BLS signatures, snapshot loading, etc.).

Do not use this for real transactions or staking.

๐Ÿ”— Links