The crates
A Cargo workspace. Dependencies point one way — core and trie know nothing
about the network, and networking knows nothing about execution.
| Crate | Lines | Responsibility |
|---|---|---|
cli | 28.4k | Entry point, argument parsing, genesis bootstrap, wiring every service together — and 71 diagnostic tools under examples/ |
core | 19.9k | Base types — Header, Block, Transaction, Receipt — consensus rules, validation, chain config, activation heights, the typed chain-event channel |
trie | 10.5k | RSK Unitrie: nodes, paths, account encoding, key mapping, and the snapshot traversal and chunk proof |
execution | 113.0k | EVM executor, block processor, every RSK precompile, the BTC–RSK Bridge, REMASC, merged mining, supply conservation, the tracer |
storage | 18.7k | RocksDB persistence behind a write cache, the position layer, epoch GC, block pruning, the rskj importer |
networking | 11.4k | P2P: RLPx, discovery, sessions, peer management, peer scoring and bans, the snap wire messages |
sync | 45.4k | Sync state machine, header and body pipeline, snapshot sync on both sides, coherence invariants, the Φ watchdog, transaction pool and rate limiter, gas price tracker, transaction relay |
rpc | 20.0k | axum JSON-RPC server, the WebSocket transport and eth_subscribe, and the debug/trace namespaces |
alerts | 4.8k | Two-way-peg monitoring, node-health alarms, and the shared email transport |
flatdb | 3.4k | An append-only trie store behind the same seam as RocksDB: mmap'd heap, keyless open-addressed index, CRC'd checkpoint. Faster serially on real state, and not yet the mainnet default |
Around 276,000 lines in all. Nearly half the codebase is execution, and most of that is the Bridge. That ratio is the
honest shape of an RSK client: the EVM is a solved problem with a good Rust implementation, and the
peg is not.
How big is that, really
Against the three other clients a Rootstock or Ethereum node is usually measured by. Counted the
same way on all four: production code only, with tests excluded everywhere —
Go's _test.go files, Java's src/test/java, and Rust's inline
#[cfg(test)] modules, which are 28–30% of both Rust trees and would otherwise
flatter them badly.
| Client | Language | Own code | + EVM | Total |
|---|---|---|---|---|
| reth | Rust | 308,165 | 36,285 | 344,450 |
| geth | Go | 272,696 | — | 272,696 |
| Rustock | Rust | 173,288 | 36,285 | 209,573 |
| rskj | Java | 130,837 | — | 130,837 |
Why the EVM column. rskj and geth carry their virtual machines inside the tree
— rskj in org.ethereum.vm, geth in core/vm — so their totals
already include one. Rustock and reth both depend on revm,
which is a separate project neither of them owns. Adding it is what makes the four comparable; leaving
it out would credit the two Rust clients with an EVM they did not write but do not have to.
Read this for scale, not for merit. The four are not the same program four times. reth and geth implement Ethereum: blob transactions, proof of stake, the Engine API, an explorer namespace Rustock has none of. Rustock and rskj implement Rootstock: a Bitcoin SPV header chain, merged mining, and a two-way peg Bridge that has no Ethereum counterpart at all. A line count says nothing about maturity either — rskj has secured a live chain for nine years and Rustock is a prototype, and no column here shows that.
The 276,000 above counts everything in this repository including inline tests, which is
the figure the rest of this site uses; the table strips tests from all four so the comparison is a fair
one. rskj at a7c0a94, geth 1.17.7, reth 2.5.2, revm 36 — and reth resolves a later
revm than Rustock does, so its EVM column is an approximation rather than a measurement.
The pipeline
peers
│ RLPx frames, chunked at 32 KB
▼
┌─────────────┐ headers ┌──────────────┐
│ networking │─────────────▶│ sync │ skeleton → chunks → bodies
│ discovery │◀─────────────│ tracker │ 4 requests in flight per peer
│ sessions │ requests └──────┬───────┘
└─────────────┘ │ blocks, in order
▲ ▼
│ ┌──────────────┐
│ relay │ execution │ REVM + precompiles + Bridge
│ │ processor │ one journal per block
┌──────┴──────┐ └──────┬───────┘
│ tx pool │ │ EvmState
└─────────────┘ ▼
┌──────────────┐ ┌──────────────┐
│ trie │───▶│ storage │ RocksDB,
│ (Unitrie) │ │ 7 col.family │ 7 column families
└──────┬───────┘ └──────┬───────┘
│ state root │
▼ ▼
compare with ┌──────────┐
block header │ rpc │
└──────────┘
Every block ends with the same question: does the recomputed state root equal the one in the header? If it does not, the node stops rather than building on state it cannot justify. Nearly every entry in the compatibility catalogue was found by that comparison failing at a specific mainnet height.
Networking
Rustock speaks the RSK variant of devp2p, which is close enough to Ethereum's that the differences are easy to miss and fatal when missed.
- RLPx — full encrypted transport, inbound and outbound handshakes.
- Multi-frame messages. Standard Ethereum clients send each P2P message as one frame
regardless of size. rskj splits anything over 32 KB into multiple frames sharing a
contextId, each with its own header and MAC. A client that does not reassemble them never receives a large body response — it just sees the sync stall. - Kademlia discovery over UDP, with peer exchange and a node table persisted across restarts so a cold start is not a cold network.
- Serving peers. Rustock answers
BlockHeadersRequest,BlockHashRequest,SkeletonRequestandBodyRequest— it contributes to the network rather than only consuming it. - Transaction relay. Transactions from peers are validated, admitted to the pool and rebroadcast to every other connected peer.
Sync
The high-level shape matches rskj's skeleton sync — find a connection point, pull a skeleton of every Nth header, download the in-between chunks, then bodies, then execute. The difference is how much of that runs at once.
Multi-peer parallel header download
Header chunks are spread across every connected peer, with up to four chunk requests in
flight per peer. A PeerChunkTracker assigns chunks, records which peer holds which, buffers
out-of-order responses and drains them back into strict order before they touch the store. Responses are
matched to chunks by content, not by arrival order, so reordering across peers is safe, and
fill_pipeline tops every peer up to capacity each round. rskj downloads header chunks from
one peer, one request at a time.