Warning: Work in progress. Do not use.
Rust implementation of the Hyperscale protocol: a sharded smart-contract network that scales linearly — add shards, get proportional throughput — while keeping the properties sharding usually destroys: atomic composability (a transaction touching state on many shards commits everywhere or nowhere) and synchronous, single-chain semantics with BFT finality. No bridges, no optimistic rollback, no user-visible intermediate states.
What makes it distinctive:
- Three consensus mechanisms, one clock. Independent HotStuff-2 shard chains order transactions; execution certificates agree on their results; a slow beacon chain governs validators and topology. All three are harmonized by weighted time — a BFT-attested clock — which binds every artifact to exactly one governing committee.
- Deterministic atomic commitment. Cross-shard transactions run a provision–execute–certify pipeline: state moves between shards as merkle-proven facts about committed blocks, every shard executes deterministically on identical inputs, and quorum certificates attest outcomes rather than vote on them. No coordinator, no blocking, and locks that structurally cannot deadlock.
- Dynamic sharding. Shards split under load and merge when it recedes — live, without halting the network. State is one binary Jellyfish Merkle Tree and a shard is a prefix subtree, so resharding is a tree operation with a one-hash continuity proof; transactions straddling a reshape boundary settle atomically via attested settled sets.
- A self-regulating validator economy. The minimum activation stake is a market-clearing price recomputed every epoch from topology demand — rising when validator supply is abundant, falling when splits need staffing — while vnodes let one host run many validator identities, so a seat's marginal cost is its stake, not hardware.
- Determinism as the spine. The entire protocol stack is sans-io pure state machines. The same code runs under production I/O (tokio, libp2p, RocksDB) and under a deterministic simulator where whole multi-shard networks — fault injection included — replay byte-identically from a seed.
Architecture documentation → docs/ — the whole story in a five-page overview, per-subsystem deep dives, and a consolidated invariant register intended as the starting point for formal verification. The execution engine — an effect-typed VM whose every state access is declared before execution — lives in the vm/ submodule with its own documentation suite.
Formal models → specs/ — an in-progress track of machine-checked Quint models (verified with Apalache) of the critical safety properties. Each is transcribed from the implementation it models and cross-checked against it by the deterministic scenario suite.
| Crate | Purpose |
|---|---|
beacon |
Beacon-chain coordinator (PC/SPC/MSC consensus, validator-set + topology source) |
core |
The StateMachine and SubStateMachine traits that everything implements |
crypto |
Consensus crypto interface: Signer/Verifier traits and related abstractions |
crypto-bls |
Production BLS12-381 signing, verification, and certificate aggregation |
crypto-mock |
Deterministic keyed-hash scheme for simulation with constant-cost sign and verify |
demo |
Browser-drivable session over the deterministic simulation |
dispatch |
Abstract trait for scheduling CPU-intensive work across priority-isolated pools |
dispatch-pooled |
Production dispatch using rayon thread pools with core allocation and pinning |
dispatch-sync |
Deterministic inline dispatch for simulation (runs closures on calling thread) |
effects-bridge |
The workspace's binding to the VM effect vocabulary: decode, admit, and route transactions |
engine |
Batch executor over the VM kernel: tick execution, fee settlement, receipt projection |
execution |
Transaction execution with cross-shard coordination |
jmt |
Jellyfish Merkle Tree with generic hasher and batched multiproofs |
mempool |
Transaction pool management |
metrics |
Metrics facade with domain-specific trait and global singleton recorder |
metrics-memory |
In-memory metrics backend for tests and simulation assertions |
metrics-prometheus |
Prometheus metrics backend with counters, gauges, and histograms |
network |
Shared network protocol logic: Network trait, handler registry, wire framing |
network-libp2p |
Production libp2p transport with gossipsub broadcast and QUIC/TCP streams |
network-memory |
Deterministic in-memory network for simulation with configurable latency and partitions |
node |
Composes all sub-state machines into the main NodeStateMachine |
production |
Production runner: async event loop, RPC server, telemetry |
provisions |
Centralized provision coordination for cross-shard transactions |
remote-headers |
Centralized remote block header coordination for cross-shard verification |
scenarios |
Portable node-behavioral scenarios run on both the simulation and production harnesses |
shard |
Shard consensus (HotStuff-2): block proposal, voting, QC formation, view changes |
simulation |
Deterministic simulation runner with event queue and multi-node orchestration |
simulator |
CLI tool for running simulations with metrics |
spammer |
Transaction spammer CLI and library for load testing |
storage |
Storage trait abstractions (SubstateStore, CommitStore, ConsensusStore) and JMT integration |
storage-memory |
In-memory storage using persistent data structures for deterministic simulation |
storage-rocksdb |
Production RocksDB storage with JMT state roots and snapshot isolation |
types |
Core wire types — hashes, blocks, votes, QCs, transactions, topology — and their verification predicates |
Pre-built binaries for Linux (x86_64) and macOS (ARM64) are available on the Releases page.
You can pull the latest Docker image from the GitHub Container Registry:
docker pull ghcr.io/flightofthefox/hyperscale-rs:latestInstall Rust using rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shYou will need clang, lld, protobuf, and openssl.
brew install llvm protobuf openssl pkg-configsudo apt-get update && sudo apt-get install -y \
clang \
lld \
pkg-config \
protobuf-compiler \
git \
build-essential \
libssl-dev \
libc6-devRequired only if you plan to run the launch-docker-compose.sh script or use the provided Dockerfile.
Recommended: Docker Desktop or Rancher Desktop.
Install the Docker Engine and Docker Compose plugin: Install on Ubuntu | Install on Debian | Install on Fedora
Ensure your user is in the docker group to run commands without sudo:
sudo usermod -aG docker $USER
newgrp dockerThe execution engine is consumed as the vm/ git submodule. When cloning, use:
git clone --recurse-submodules https://github.com/flightofthefox/hyperscale-rs.gitIf you've already cloned the repository without submodules, initialize them with:
git submodule update --init --recursivecargo build --releasecargo run --release --bin hyperscale-simcargo testFor development and testing, you can launch a local cluster using the provided scripts.
The launch-cluster.sh script launches a cluster of validator nodes as background processes on your host machine. This is faster and easier for quick iteration.
./scripts/launch-cluster.shOptions:
--shards <N>: Number of shards (default: 2)--validators-per-shard <M>: Validators per shard (default: 4)--clean: Clean data directories before starting--monitoring: Start Prometheus and Grafana for metrics
The launch-docker-compose.sh script launches a full cluster inside Docker containers using Docker Compose. This more closely mimics a production environment.
Important
Memory Requirement: Please ensure your Docker VM/Desktop is configured with at least 8-10GB of RAM. The validator nodes require significant memory for the high-throughput consensus simulation.
./scripts/launch-docker-compose.shOptions:
--build <true|false>: Whether to build the docker image (default: true). Set to false to use existing image for much faster startup.--use-ghcr-image: Use the latest pre-built image from GHCR instead of building locally.--shards <N>: Number of shards (default: 1)--validators-per-shard <M>: Validators per shard (default: 8)--memory <limit>: Memory limit per validator (e.g.1g,512m)--cpus <limit>: CPU limit per validator (e.g.0.5)--latency <ms>: Artificial network latency per validator--latency-nodes <N>: Number of nodes to apply latency to (default: 1)
To stop the Docker cluster and remove volumes:
./scripts/stop-docker-compose.shTo run load tests against your local cluster, use the hyperscale-spammer binary.
Important
Check Ports: You MUST use the ports outputted by the launch script at the end of its execution. These ports may vary depending on the number of validators and sharding configuration.
Example command (adjust ports as needed):
./target/release/hyperscale-spammer run \
--endpoints "http://localhost:8080,http://localhost:8081" \
--num-shards 2 \
--validators-per-shard 4 \
--tps 100 \
--duration 30sRocksDB (librocksdb-sys) uses bindgen, which needs LLVM/libclang and MSVC
headers (stdbool.h from the Windows SDK). Both are required — LLVM alone is not
enough unless you run from a Developer Command Prompt.
- Install LLVM (
choco install llvm) and protobuf (choco install protobuf). - Install Visual Studio Build Tools with the Desktop development with C++
workload (provides
vcvars64.batand SDK headers). - Set
LIBCLANG_PATHpermanently, e.g.C:\Program Files\LLVM\bin.
Run from Developer PowerShell for VS (loads vcvars64.bat) or set
LIBCLANG_PATH manually before cargo build:
$env:LIBCLANG_PATH = "C:\Program Files\LLVM\bin"Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.