Documentation

Everything needed to build a Rustock node, put it on RSK mainnet and keep it there.

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

MinimumComfortable
CPU4 cores8+ cores — execution and the sync pipeline are both parallel
RAM8 GB16 GB — the trie write cache and RocksDB block cache both benefit
DiskNVMe SSDNVMe SSD. A full archival store is ~130 GB and grows.
NetworkanySync 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-idNotes
RSK Mainnet30Default. Merged-mined with Bitcoin mainnet.
RSK Testnet31Separate genesis, separate activation heights.
Regtestany otherLocal 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

FlagDefaultDescription
--port30303P2P listen port (TCP sessions and UDP discovery)
--data-dir./dataData directory for RocksDB and logs
--network-id3030 mainnet, 31 testnet, anything else regtest
--secret-keyauto-generatedHex-encoded secp256k1 private key for the node identity
--log-levelinfotrace…error, or RUST_LOG-style directives
--log-to-stdoutfalseLog to the console instead of a rotating file
--rpc-port4444JSON-RPC HTTP port
--rpc-host127.0.0.1JSON-RPC bind address
--no-rpcfalseDisable the JSON-RPC server entirely
--external-ipnoneExternal IP advertised in discovery
--import-rskjnoneConvert a synced rskj database — see below
--metadata-in-memoryfalseRebuild chain metadata in memory at start-up
--alerts-confignonePath to an alerts TOML file — see below
--rpc-adminfalseEnable the administrative rsk_ methods
--dev-rpcfalseEnable the evm_ development namespace
--trie-toolnoneTrie 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:

rskjrustock
ContainerOne RocksDB per datasource directory (blocks/, unitrie/, receipts/)One RocksDB, 7 column families