Requirements
Rustock builds with Rust stable (edition 2021) and links RocksDB, which is compiled from vendored
C++ sources. That makes a working C/C++ toolchain and libclang hard requirements:
librocksdb-sys compiles C++, and zstd-sys generates its bindings with
bindgen, which needs libclang.so and clang's builtin headers at build time.
# Debian / Ubuntu sudo apt install build-essential clang libclang-dev # Fedora / RHEL sudo dnf install gcc gcc-c++ clang-devel # macOS — ships with the Xcode command line tools xcode-select --install
If bindgen still reports Unable to find libclang, point it at the library
explicitly: export LIBCLANG_PATH=/usr/lib/llvm-21/lib.
Hardware
| Minimum | Comfortable | |
|---|---|---|
| CPU | 4 cores | 8+ cores — execution and the sync pipeline are both parallel |
| RAM | 8 GB | 16 GB — the trie write cache and RocksDB block cache both benefit |
| Disk | NVMe SSD | NVMe SSD. A full archival store is ~130 GB and grows. |
| Network | any | Sync is bound by execution and dependent random reads, not bandwidth |
Spinning disks and network-attached storage are the wrong shape for this workload: a trie descent issues dependent random reads, so the device only ever sees one outstanding request at a time. See the measurements.
Quickstart
git clone https://github.com/Rustock-dev/Rustock cd Rustock cargo build --workspace --release
Then start the node. RSK mainnet (network id 30) is the default:
cargo run -p rustock-cli --release -- \ --port 30303 \ --data-dir ./data \ --log-to-stdout
Logs are written to <data-dir>/rustock.log with daily rotation unless
--log-to-stdout is given. The node starts discovery, fills its peer table, finds a
connection point, and begins the skeleton sync described in Architecture.
Syncing from genesis takes days, because every block is executed. There are two faster routes. Snapshot sync downloads the state at a recent checkpoint instead, verifying the header chain to it under the same proof-of-work rules and proving every chunk against that chain's state root. If you already run rskj, the import path converts its database directly.
Talking to it
The JSON-RPC server binds 127.0.0.1:4444 by default:
curl -s -X POST -H 'content-type: application/json' \
--data '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}' \
http://127.0.0.1:4444/
{"id":1,"jsonrpc":"2.0","result":"0x8d1804"}
The full method list is on the JSON-RPC page. Batched requests work, and so do the standard web3 libraries pointed at the same endpoint.
Running a node
Networks
| Network | --network-id | Notes |
|---|---|---|
| RSK Mainnet | 30 | Default. Merged-mined with Bitcoin mainnet. |
| RSK Testnet | 31 | Separate genesis, separate activation heights. |
| Regtest | any other | Local development chain. |
Identity and reachability
The node key is generated on first start and persisted in the data directory; pass
--secret-key to pin a specific hex-encoded secp256k1 key so your node id stays stable across
data-directory resets. Behind NAT, advertise your reachable address with
--external-ip 203.0.113.42, and forward TCP and UDP on the P2P port — discovery is
UDP, sessions are TCP.
Exposing RPC
Do not expose the RPC port to the internet. Rustock's
JSON-RPC has no authentication, no rate limiting and no CORS policy of its own — it is meant to sit behind
something that does. Bind it to loopback (the default) and put a reverse proxy in front if it has to be
reachable, or disable it entirely with --no-rpc.
As a systemd service
# /etc/systemd/system/rustock.service
[Unit]
Description=Rustock — Rootstock node
After=network-online.target
[Service]
User=rustock
ExecStart=/usr/local/bin/rustock --data-dir /var/lib/rustock --log-to-stdout
Restart=on-failure
RestartSec=5
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
RocksDB opens a lot of files; raising LimitNOFILE is not optional on a full archival store.
CLI reference
| Flag | Default | Description |
|---|---|---|
--port | 30303 | P2P listen port (TCP sessions and UDP discovery) |
--data-dir | ./data | Data directory for RocksDB and logs |
--network-id | 30 | 30 mainnet, 31 testnet, anything else regtest |
--secret-key | auto-generated | Hex-encoded secp256k1 private key for the node identity |
--log-level | info | trace…error, or RUST_LOG-style directives |
--log-to-stdout | false | Log to the console instead of a rotating file |
--rpc-port | 4444 | JSON-RPC HTTP port |
--rpc-host | 127.0.0.1 | JSON-RPC bind address |
--no-rpc | false | Disable the JSON-RPC server entirely |
--external-ip | none | External IP advertised in discovery |
--import-rskj | none | Convert a synced rskj database — see below |
--metadata-in-memory | false | Rebuild chain metadata in memory at start-up |
--alerts-config | none | Path to an alerts TOML file — see below |
--rpc-admin | false | Enable the administrative rsk_ methods |
--dev-rpc | false | Enable the evm_ development namespace |
--trie-tool | none | Trie statistics, snapshot and node lookup — see below |
Importing from rskj
A synced rskj database can be converted instead of syncing from peers. On RSK mainnet at block 9,230,008 this takes about an hour, against days of syncing.
rustock --import-rskj /path/to/database/mainnet --data-dir ./data rustock --metadata-in-memory --data-dir ./data
It is a conversion, not a copy, because the two nodes store the same chain in structurally different ways:
| rskj | rustock | |
|---|---|---|
| Container | One RocksDB per datasource directory (blocks/, unitrie/, receipts/) | One RocksDB, 7 column families |