This repository contains the Rust implementation of the Cryptix full node and related libraries. The goal is simple: a production-ready node that stays compatible with the existing Cryptix network and can replace the legacy Golang daemon in day-to-day operation. If you prefer the previous implementation, the Golang node remains available as an alternative.
If you run infrastructure, build tooling, or contribute code, this repo is the main place to work on the Rust node stack. Feedback and contributions are always welcome.
| Flag | Type | Default | Description |
|---|---|---|---|
-C, --configfile=<CONFIG_FILE> |
path | none | Load settings from a TOML config file. |
-b, --appdir=<DATA_DIR> |
path | none | Base data directory. |
--logdir=<LOG_DIR> |
path | none | Log file directory. |
--nologfiles |
switch | false |
Disable logging to files. |
-t, --async-threads=<N> |
integer | CPU core count | Number of async runtime threads. |
-d, --loglevel=<LEVEL> |
string | info |
Global/per-subsystem log level. |
--rpclisten[=IP[:PORT]] |
address | auto | gRPC listen address (defaults to network-specific port). |
--rpclisten-borsh[=IP[:PORT]] |
address | auto | wRPC Borsh listen address (defaults to network-specific port). |
--rpclisten-json[=IP[:PORT]] |
address | auto | wRPC JSON listen address (defaults to network-specific port). |
--unsaferpc |
switch | false |
Enable RPC commands that mutate node state. |
--rpc-diagnostics |
switch | false |
Enable opt-in RPC diagnostics logs: endpoint request-volume summaries every 5 seconds and slow request snapshots at >=500ms. Useful for debugging WebWallet/wRPC lag; disabled by default. |
--rpc-block-scan-cache |
switch | false |
Enable an opt-in RAM cache for recent GetHeaders/GetBlock/GetBlocks RPC scan data used by wallet sync/resync, including selected-parent links for fast descending header scans. When enabled, the node waits until it is nearly synced and Atomic is ready after the token HF, warms the newest selected-chain data, serves the cache only after warmup completes, logs warmup/activity progress, and refreshes it while running. It is read-only and falls back to normal storage on cache misses. |
--rpc-block-scan-cache-days=<DAYS> |
float | 1.0 |
Recent-data window for --rpc-block-scan-cache; values are clamped to 0.1..7.0 days. |
--rpc-block-scan-cache-max-mb=<MB> |
integer | 1024 |
Approximate RAM cap for --rpc-block-scan-cache. When full, old entries are evicted and uncached data is read normally. |
--connect=<IP[:PORT]> |
address (repeatable) | empty | Connect only to specified peers. |
--addpeer=<IP[:PORT]> |
address (repeatable) | empty | Add peers to connect to on startup. |
--listen=<IP[:PORT]> |
address | auto | P2P listen address (defaults to network-specific port). |
--outpeers=<N> |
integer | 8 |
Target outbound peer count. |
--maxinpeers=<N> |
integer | 128 |
Maximum inbound peer count. |
--rpcmaxclients=<N> |
integer | 128 |
Maximum standard RPC clients. |
--reset-db |
switch | false |
Reset local database before startup. |
--startup-repair-plan=<JSON> |
path | none | Apply a JSON startup database repair plan before networking starts. |
--enable-unsynced-mining |
switch | false |
Accept RPC block submits while unsynced (testing-oriented). |
--enable-mainnet-mining |
switch | true (deprecated flag) |
Backward-compatible flag; mainnet mining is enabled by default. |
--utxoindex |
switch | true |
Enable UTXO index. |
--no-utxoindex |
switch | false |
Disable UTXO index for low-resource nodes. |
--atomic-bootstrap-peer=<IP[:PORT]> |
address (repeatable) | empty | Optional gRPC Atomic snapshot endpoint. Normal P2P sync, local Atomic replay, and local selected-chain backfill do not require this. |
--no-atomic-seed |
switch | false |
Disable only Atomic seed sources for Atomic sync/bootstrap/health quorum. Normal P2P DNS seeding stays enabled. Alias: --atomic-bootstrap-no-seed. |
--atomic-bootstrap-allow-peer-fallback |
switch | false |
On mainnet, allow peer-only Atomic quorum fallback when Atomic seed sources are disabled or unreachable. This does not disable seeds by itself; use --no-atomic-seed when you intentionally want Atomic peer-only mode while keeping normal P2P DNS seeding. |
--atomic-bootstrap-peer-quorum-min-sources=<N> |
integer | seed-confirmed: 2, peer-only fallback: 3 |
Override the minimum independent non-seed/P2P sources required for Atomic quorum. On mainnet the default seed-confirmed policy requires >=1 seed source plus >=2 independent non-seed sources with the same Atomic state/snapshot hash; peer-only fallback defaults to >=3 independent non-seed/P2P sources with majority. Alias: --atomic-bootstrap-peer-quorum=<N>. Values below 3 are intended only for private/testing networks. |
--disable-atomic-health-audit |
switch | false |
Disable the periodic Atomic P2P healthy-state/token audit. Alias: --atomic-health-audit-disable. |
--atomic-health-audit-interval-minutes=<MINUTES> |
integer | 3 |
Set the periodic Atomic P2P healthy-state/token audit interval. The audit uses a DAA-rendezvous anchor behind the local selected-parent tip so peers can be checked against a stable block hash/DAA pair. |
--max-tracked-addresses=<N> |
integer | 0 |
Preallocated max addresses for UTXO change tracking. |
--testnet |
switch | false |
Use testnet. |
--netsuffix=<N> |
integer | none | Optional testnet suffix (for dedicated parallel testnet variants). |
--devnet |
switch | false |
Use devnet. |
--simnet |
switch | false |
Use simnet. |
--archival |
switch | false |
Run in archival mode (increased disk usage). |
--sanity |
switch | false |
Enable additional sanity checks. |
--yes |
switch | false |
Auto-confirm interactive prompts. |
--uacomment=<TEXT> |
string (repeatable) | empty | Append user-agent comments. |
--externalip=<IP[:PORT]> |
address | none | Advertised external P2P address. |
--perf-metrics |
switch | false |
Enable runtime perf metrics collection. |
--perf-metrics-interval-sec=<SECONDS> |
integer | 10 |
Perf metrics collection interval. |
--tx-relay-broadcast-interval-ms=<MS> |
integer | 250 |
Interval in milliseconds for batching mempool transaction INV broadcasts. |
--datacenter |
switch | false |
Enable datacenter peer filter mode (skip private/unroutable peer addresses in address manager). |
--hfa |
switch | false |
Enable HFA fast rail for this process. |
--hfa-cpu=<RATIO> |
float | 0.7 |
HFA CPU low-water ratio (0.0 < value <= 1.0). |
--hfa-drift-ms=<MS> |
integer | 5000 |
HFA clock drift window in milliseconds for fast-intent admission. |
--hfa-microblock-interval-ms-normal=<MS> |
integer | 50 |
HFA microblock interval in milliseconds while in normal mode. |
--no-hfa |
switch | false |
Force-disable HFA (overrides config). |
--autoban |
switch | false |
Enable automatic banning of repeatedly misbehaving peers. |
--no-autoban |
switch | false |
Force-disable automatic banning of repeatedly misbehaving peers (overrides config). |
--banserver |
switch | true |
Enable signed AntiFraud list synchronization from the primary seed endpoint. |
--no-banserver, --antifraud-no-seed |
switch | false |
Disable the AntiFraud seed endpoint and use peer-majority snapshots only (overrides config). |
--disable-upnp |
switch | false |
Disable UPnP. |
--nodnsseed |
switch | false |
Disable normal DNS peer seeding. Because the same DNS seed list is also used as Atomic seed-source candidates, this also disables Atomic seed sources. If you only want to disable Atomic seed sources while keeping normal P2P DNS seeding, use --no-atomic-seed instead. |
--nogrpc |
switch | false |
Disable gRPC server. |
--ram-scale=<FACTOR> |
float | 1.0 |
Scale memory-bound internal limits. |
--num-prealloc-utxos=<N> |
integer | none | Devnet preallocation count (devnet-prealloc feature only). |
--prealloc-address=<ADDR> |
string | none | Devnet preallocation target address (devnet-prealloc feature only). |
--prealloc-amount=<SOMPI> |
integer | 10000000000 |
Devnet preallocation amount per UTXO (devnet-prealloc feature only). |
RPC diagnostics example:
cryptixd --utxoindex --rpclisten-borsh=default --rpc-diagnosticsBuilding on Linux
-
Install general prerequisites
sudo apt install curl git build-essential libssl-dev pkg-config
-
Install Protobuf (required for gRPC)
sudo apt install protobuf-compiler libprotobuf-dev #Required for gRPC -
Install the clang toolchain (required for RocksDB and WASM secp256k1 builds)
sudo apt-get install clang-format clang-tidy \ clang-tools clang clangd libc++-dev \ libc++1 libc++abi-dev libc++abi1 \ libclang-dev libclang1 liblldb-dev \ libllvm-ocaml-dev libomp-dev libomp5 \ lld lldb llvm-dev llvm-runtime \ llvm python3-clang
-
Install the rust toolchain
If you already have rust installed, update it by running:
rustup update -
Install wasm-pack
cargo install wasm-pack
-
Install wasm32 target
rustup target add wasm32-unknown-unknown
-
Clone the repo
git clone https://github.com/cryptix-network/rusty-cryptix cd rusty-cryptix
Building on Windows
-
Install Git for Windows or an alternative Git distribution.
-
Install Protocol Buffers and add the
bindirectory to yourPath -
Install LLVM-15.0.6-win64.exe
Add the
bindirectory of the LLVM installation (C:\Program Files\LLVM\bin) to PATHset
LIBCLANG_PATHenvironment variable to point to thebindirectory as wellIMPORTANT: Due to C++ dependency configuration issues, LLVM
ARinstallation on Windows may not function correctly when switching between WASM and native C++ code compilation (nativeRocksDB+secp256k1vs WASM32 builds ofsecp256k1). Unfortunately, manually settingARenvironment variable also confuses C++ build toolchain (it should not be set for native but should be set for WASM32 targets). Currently, the best way to address this, is as follows: after installing LLVM on Windows, go to the targetbininstallation directory and copy or renameLLVM_AR.exetoAR.exe. -
Install the rust toolchain
If you already have rust installed, update it by running:
rustup update -
Install wasm-pack
cargo install wasm-pack
-
Install wasm32 target
rustup target add wasm32-unknown-unknown
-
Clone the repo
git clone https://github.com/cryptix-network/rusty-cryptix cd rusty-cryptix cargo build --release --bin cryptixd
Building on Mac OS
-
Install Protobuf (required for gRPC)
brew install protobuf
-
Install llvm.
The default XCode installation of
llvmdoes not support WASM build targets. To build WASM on MacOS you need to installllvmfrom homebrew (at the time of writing, the llvm version for MacOS is 16.0.1).brew install llvm
NOTE: Homebrew can use different keg installation locations depending on your configuration. For example:
/opt/homebrew/opt/llvm->/opt/homebrew/Cellar/llvm/16.0.1/usr/local/Cellar/llvm/16.0.1
To determine the installation location you can use
brew list llvmcommand and then modify the paths below accordingly:% brew list llvm /usr/local/Cellar/llvm/16.0.1/bin/FileCheck /usr/local/Cellar/llvm/16.0.1/bin/UnicodeNameMappingGenerator ...
If you have
/opt/homebrew/Cellar, then you should be able to use/opt/homebrew/opt/llvm.Add the following to your
~/.zshrcfile:export PATH="/opt/homebrew/opt/llvm/bin:$PATH" export LDFLAGS="-L/opt/homebrew/opt/llvm/lib" export CPPFLAGS="-I/opt/homebrew/opt/llvm/include" export AR=/opt/homebrew/opt/llvm/bin/llvm-ar
Reload the
~/.zshrcfilesource ~/.zshrc
-
Install the rust toolchain
If you already have rust installed, update it by running:
rustup update -
Install wasm-pack
cargo install wasm-pack
-
Install wasm32 target
rustup target add wasm32-unknown-unknown
-
Clone the repo
git clone https://github.com/cryptix-network/rusty-cryptix cd rusty-cryptix
Building WASM32 SDK
Rust WebAssembly (WASM) refers to the use of the Rust programming language to write code that can be compiled into WebAssembly, a binary instruction format that runs in web browsers and NodeJs. This allows for easy development using JavaScript and TypeScript programming languages while retaining the benefits of Rust.
WASM SDK components can be built from sources by running:
- ./build-release - build a full release package (includes both release and debug builds for web and nodejs targets)
- ./build-docs - build TypeScript documentation
- ./build-web - release web build
- ./build-web-dev - development web build
- ./build-nodejs - release nodejs build
- ./build-nodejs-dev - development nodejs build
IMPORTANT: do not use dev builds in production. They are significantly larger, slower and include debug symbols.
- NodeJs (v20+): https://nodejs.org/en
- TypeDoc: https://typedoc.org/
- Release builds: https://github.com/cryptix-network/rusty-cryptix/releases
Cryptix CLI + Wallet
cryptix-cli crate provides a cli-driven RPC interface to the node and a
terminal interface to the Rusty Cryptix Wallet runtime. These wallets are
compatible with WASM SDK Wallet API and Cryptix NG projects.
cd cli
cargo run --releaseLocal Web Wallet
Run an http server inside of wallet/wasm/web folder. If you don't have once, you can use the following:
cd wallet/wasm/web
cargo install basic-http-server
basic-http-serverThe basic-http-server will serve on port 4000 by default, so open your web browser and load http://localhost:4000
The framework is compatible with all major desktop and mobile browsers.
Start a mainnet node
cargo run --release --bin cryptixd
# opt out of the default UTXO index on low-resource nodes
cargo run --release --bin cryptixd -- --no-utxoindexStart a testnet node
cargo run --release --bin cryptixd -- --testnetOptionally, --netsuffix=<N> can be used to run an isolated suffixed testnet id when needed.
Using a configuration file
cargo run --release --bin cryptixd -- --configfile /path/to/configfile.toml
# or
cargo run --release --bin cryptixd -- -C /path/to/configfile.toml- The config file should be a list of <CLI argument> = <value> separated by newlines.
- Whitespace around the
=is fine,arg=valueandarg = valueare both parsed correctly. - Values with special characters like
.or=will require quoting the value i.e <CLI argument> = "<value>". - Arguments with multiple values should be surrounded with brackets like
addpeer = ["10.0.0.1", "1.2.3.4"].
For example:
testnet = true
utxoindex = true
disable-upnp = true
perf-metrics = true
tx-relay-broadcast-interval-ms = 250
rpc-block-scan-cache = true
rpc-block-scan-cache-days = 1.0
rpc-block-scan-cache-max-mb = 1024
appdir = "some-dir"
hfa-microblock-interval-ms-normal = 50
autoban = false
banserver = true
addpeer = ["10.0.0.1", "1.2.3.4"]
Pass the --help flag to view all possible arguments
cargo run --release --bin cryptixd -- --helpwRPC
wRPC subsystem is disabled by default in cryptixd and can be enabled via:
JSON protocol:
--rpclisten-json = <interface:port>
# or use the defaults for current network
--rpclisten-json = defaultBorsh protocol:
--rpclisten-borsh = <interface:port>
# or use the defaults for current network
--rpclisten-borsh = defaultSidenote:
Rusty Cryptix integrates an optional wRPC subsystem. wRPC is a high-performance, platform-neutral, Rust-centric, WebSocket-framed RPC implementation that can use Borsh and JSON protocol encoding.
JSON protocol messaging is similar to JSON-RPC 1.0, but differs from the specification due to server-side notifications.
Borsh encoding is meant for inter-process communication. When using Borsh both client and server should be built from the same codebase.
JSON protocol is based on Cryptix data structures and is data-structure-version agnostic. You can connect to the JSON endpoint using any WebSocket library. Built-in RPC clients for JavaScript and TypeScript capable of running in web browsers and Node.js are available as a part of the Cryptix WASM framework.
Simulation framework (Simpa)
The current codebase supports a full in-process network simulation, building an actual DAG over virtual time with virtual delay and benchmarking validation time (following the simulation generation).
To see the available commands
cargo run --release --bin simpa -- --helpThe following command will run a simulation to produce 1000 blocks with communication delay of 2 seconds and 8 BPS (blocks per second) while attempting to fill each block with up to 200 transactions.
cargo run --release --bin simpa -- -t=200 -d=2 -b=8 -n=1000Heap Profiling
Heap-profiling in cryptixd and simpa can be done by enabling heap feature and profile using the --features argument
cargo run --bin cryptixd --profile heap --features=heapIt will produce {bin-name}-heap.json file in the root of the workdir, that can be inspected by the dhat-viewer
Tests
Run unit and most integration tests
cd rusty-cryptix
cargo test --release
// or install nextest and runUsing nextest
cd rusty-cryptix
cargo nextest run --releaseLints
cd rusty-cryptix
./checkBenchmarks
cd rusty-cryptix
cargo benchLogging
Logging in cryptixd and simpa can be filtered by either:
-
Defining the environment variable
RUST_LOG -
Adding the --loglevel argument like in the following example:
(cargo run --bin cryptixd -- --loglevel info,cryptix_rpc_core=trace,cryptix_grpc_core=trace,consensus=trace,cryptix_core=trace) 2>&1 | tee ~/rusty-cryptix.logIn this command we set the
logleveltoINFO.
Join our discord server using the following link: https://discord.cryptix-network.org/