Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ src/
- Use tables and bullet points over prose paragraphs
- Mermaid diagrams where they clarify architecture
- Source claims from the codebase, DeepWiki exports, or quantusContext.md -- do not hallucinate
- Mining guide follows chain `MINING.md` as source of truth (https://github.com/Quantus-Network/chain/blob/main/MINING.md)
- Mining guide targets Quantus mainnet (`--chain mainnet`, data under `chains/mainnet/`). Chain `MINING.md` may still mention Planck; do not revert public docs to the testnet.
- Do NOT publish internal AI audit findings (quantus-audit/ is internal only)
- Theme tokens follow the main website design system (void `#0e0e0e`, flare `#ff6b35`, content `#e8e6e0`, Geist + Geist Mono); dark mode only

Expand Down
6 changes: 3 additions & 3 deletions docs/deep-dives/miner-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,14 @@ Miner Node
# Auth token + TLS cert/fingerprint are created on first run under
# <base-path>/chains/<chain>/ (token is not logged — read miner-auth-token;
# fingerprint is logged; override auth path with --miner-auth-token-file).
quantus-node --validator --chain planck --miner-listen-port 9833
quantus-node --validator --chain mainnet --miner-listen-port 9833
```

### Miner

```bash
CHAIN_DIR="$HOME/Library/Application Support/quantus-node/chains/planck"
# Linux: CHAIN_DIR="$HOME/.local/share/quantus-node/chains/planck"
CHAIN_DIR="$HOME/Library/Application Support/quantus-node/chains/mainnet"
# Linux: CHAIN_DIR="$HOME/.local/share/quantus-node/chains/mainnet"
quantus-miner serve \
--node-addr 127.0.0.1:9833 \
--auth-token-file "$CHAIN_DIR/miner-auth-token" \
Expand Down
12 changes: 6 additions & 6 deletions docs/deep-dives/qpow.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ flowchart TD

| Parameter | Value | Description |
|-----------|-------|-------------|
| Block Time | ~12 seconds target | Planck testnet |
| Block Time | ~12 seconds target | Quantus mainnet |
| Max Reorg Depth | 100 blocks | `MaxReorgDepth` |
| Difficulty Adjustment | +/-10% per block | `DifficultyAdjustPercentClamp` |
| EMA Smoothing | alpha = 0.1 | `EmaAlpha = 100/1000` |
| Finalization | 100 blocks behind best | `MaxReorgDepth` |
| Native Token | QUAN (12 decimals) | Max supply 21,000,000 |
| Native Token | QTC (12 decimals) | Max supply 21,000,000 |
| SS58 Prefix | 189 | Addresses start with `qz...` |

## Difficulty Adjustment
Expand Down Expand Up @@ -88,7 +88,7 @@ The node binary includes a basic CPU-only miner for testing and small-scale mini
```bash
./quantus-node \
--validator \
--chain planck \
--chain mainnet \
--node-key-file ~/.quantus/node_key.p2p \
--rewards-inner-hash <YOUR_INNER_HASH>
```
Expand All @@ -103,14 +103,14 @@ For higher performance, a separate miner process offloads the PoW computation. T
# Start the node with the miner listen port open
RUST_LOG=info ./quantus-node \
--validator \
--chain planck \
--chain mainnet \
--node-key-file ~/.quantus/node_key.p2p \
--rewards-inner-hash <YOUR_INNER_HASH> \
--miner-listen-port 9833

# In a separate terminal, start the external miner (auth token + TLS pin required)
CHAIN_DIR="$HOME/.local/share/quantus-node/chains/planck"
# macOS: CHAIN_DIR="$HOME/Library/Application Support/quantus-node/chains/planck"
CHAIN_DIR="$HOME/.local/share/quantus-node/chains/mainnet"
# macOS: CHAIN_DIR="$HOME/Library/Application Support/quantus-node/chains/mainnet"
RUST_LOG=info ./quantus-miner serve \
--node-addr 127.0.0.1:9833 \
--auth-token-file "$CHAIN_DIR/miner-auth-token" \
Expand Down
41 changes: 28 additions & 13 deletions docs/guides/mining.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,23 @@ title: Mining and Running a Node

# Mining and Running a Node

This guide covers connecting to the Quantus Planck testnet and mining. Works on macOS and Linux (including WSL2 on Windows).
This guide covers connecting to Quantus **mainnet** and mining. Works on macOS and Linux (including WSL2 on Windows).

Use `--chain mainnet` (not `planck` — that is the retired public testnet). You need node **v1.0.1 or newer**; older binaries do not include the mainnet chain spec.

Use the **Copy Context** button at the top of this page to copy everything as Markdown -- the full guide plus an AI mining skill. Paste it to an agent like Claude Code to be walked through setup interactively, or keep it as an offline reference.

## Migrating from Planck

Planck is a different chain. Mainnet does not share its history, database, or rewards.

1. Install a node **v1.0.1+** from [Releases](https://github.com/Quantus-Network/chain/releases/latest).
2. Change `--chain planck` to `--chain mainnet`, or `./quantus-mining.sh config set CHAIN mainnet`.
3. Sync from genesis into `.../chains/mainnet/`. Do not copy or reuse `.../chains/planck/`.
4. Keep the same wormhole inner hash if you want rewards at the same address. The installer `--force` path does this automatically — do not generate a new keypair.

Do not pass `--force-authoring` to join mainnet. That flag is only for bootstrapping a brand-new network.

## Prerequisites

Before starting, you will need:
Expand Down Expand Up @@ -56,7 +69,9 @@ chmod +x quantus-mining.sh
./quantus-mining.sh start
```

The script generates your wormhole inner hash, node identity, and a config file at `~/quantus-mining/mining.conf`. It downloads native `quantus-node` and `quantus-miner` binaries into `~/quantus-mining/bin/`. GPU mining is recommended; the miner runs on the host so it can use Metal / Vulkan / DirectX.
The script generates your wormhole inner hash, node identity, and a config file at `~/quantus-mining/mining.conf` (`CHAIN=mainnet`). It downloads native `quantus-node` and `quantus-miner` binaries into `~/quantus-mining/bin/`. GPU mining is recommended; the miner runs on the host so it can use Metal / Vulkan / DirectX.

If you already have a Planck-era `mining.conf`, switch with `./quantus-mining.sh config set CHAIN mainnet`, then `./quantus-mining.sh setup --force` to download a v1.0.1+ node. `--force` refreshes binaries only — it keeps your existing `INNER_HASH` and wormhole address. Confirm with `./quantus-mining.sh config show` (`CHAIN=mainnet`, same masked inner hash). Planck chain data is not reused.

The script checks the downloaded pair's `--help` output and only passes auth/TLS flags when **both** binaries support miner QUIC auth (`quantus-miner/2`). Mixing an auth-capable node with a pre-auth miner (or the reverse) is rejected. Pin a matching pair with `NODE_VERSION` / `MINER_VERSION` in `mining.conf` (or `./quantus-mining.sh config set NODE_VERSION <tag>`), then run `./quantus-mining.sh setup --force` to download those tags. Environment variables of the same name override the file. Unset pins fetch GitHub `releases/latest` independently and may not match.

Expand Down Expand Up @@ -147,7 +162,7 @@ Replace the two placeholders before running:
--name <YOUR_NODE_NAME> \
--validator \
--miner-listen-port 9833 \
--chain planck \
--chain mainnet \
--node-key-file node_key.p2p \
--rewards-inner-hash <YOUR_INNER_HASH> \
--max-blocks-per-request 64 \
Expand All @@ -172,8 +187,8 @@ Default chain directory:

| Platform | Path |
|----------|------|
| Linux | `~/.local/share/quantus-node/chains/planck/` |
| macOS | `~/Library/Application Support/quantus-node/chains/planck/` |
| Linux | `~/.local/share/quantus-node/chains/mainnet/` |
| macOS | `~/Library/Application Support/quantus-node/chains/mainnet/` |

Wait until logs show the miner server is listening (and the auth/TLS file paths) before starting the miner. If miner-server startup fails, the node exits -- it does not fall back to local mining.

Expand All @@ -192,8 +207,8 @@ xattr -d com.apple.quarantine quantus-miner-macos-aarch64 && chmod u+x quantus-m
Wait for the node logs to show the miner server is listening, then run the following in the **separate terminal**. Quote `CHAIN_DIR` — the macOS path contains a space. If not on Apple Silicon, replace `quantus-miner-macos-aarch64` with your platform's binary name.

```bash
CHAIN_DIR="$HOME/Library/Application Support/quantus-node/chains/planck"
# Linux: CHAIN_DIR="$HOME/.local/share/quantus-node/chains/planck"
CHAIN_DIR="$HOME/Library/Application Support/quantus-node/chains/mainnet"
# Linux: CHAIN_DIR="$HOME/.local/share/quantus-node/chains/mainnet"

./quantus-miner-macos-aarch64 serve \
--cpu-workers 4 \
Expand All @@ -212,8 +227,8 @@ The above command is fairly conservative for most modern hardware.
For example if you want to use your GPU and have many CPU cores available you could run

```bash
CHAIN_DIR="$HOME/Library/Application Support/quantus-node/chains/planck"
# Linux: CHAIN_DIR="$HOME/.local/share/quantus-node/chains/planck"
CHAIN_DIR="$HOME/Library/Application Support/quantus-node/chains/mainnet"
# Linux: CHAIN_DIR="$HOME/.local/share/quantus-node/chains/mainnet"

./quantus-miner-macos-aarch64 serve \
--cpu-workers 8 \
Expand Down Expand Up @@ -243,10 +258,10 @@ Rewards accumulate at your wormhole address as you mine. The wallet app supports

```bash
# Linux
tail -f ~/.local/share/quantus-node/chains/planck/network/quantus-node.log
tail -f ~/.local/share/quantus-node/chains/mainnet/network/quantus-node.log

# macOS
tail -f ~/Library/Application\ Support/quantus-node/chains/planck/network/quantus-node.log
tail -f ~/Library/Application\ Support/quantus-node/chains/mainnet/network/quantus-node.log

# Or run with verbose logging
RUST_LOG=info ./quantus-node [options]
Expand All @@ -272,9 +287,9 @@ RUST_LOG=info ./quantus-node [options]
- **Updates:** Check [GitHub Releases](https://github.com/Quantus-Network/chain/releases/latest) for new versions regularly. Node and miner must ship the same miner protocol (`quantus-miner/2`).
- **Monitoring:** Watch for unusual peer counts, sync stalls, or dropped miner connections

### Testnet Disclaimer
### Mainnet notes

Planck is testnet software for testing purposes only. Tokens have no monetary value. The network may be reset periodically, and breaking changes are expected between releases.
This is the live Quantus network. Tokens (QTC) have value. Back up your seed phrase, keep miner auth files private, and run the node version the network is on. Planck testnet data and PLK balances do not carry over.


### Getting Help
Expand Down
81 changes: 81 additions & 0 deletions scripts/test-quantus-mining.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/usr/bin/env bash
# Regression tests for quantus-mining.sh identity preservation.
set -euo pipefail

ROOT="$(cd "$(dirname "$0")/.." && pwd)"
export QUANTUS_MINING_DIR
QUANTUS_MINING_DIR="$(mktemp -d "${TMPDIR:-/tmp}/quantus-mining-test.XXXXXX")"
trap 'rm -rf "$QUANTUS_MINING_DIR"' EXIT

# shellcheck source=../static/scripts/quantus-mining.sh
source "$ROOT/static/scripts/quantus-mining.sh"

fail() {
echo "FAIL: $*" >&2
exit 1
}

assert_eq() {
local label="$1" expected="$2" actual="$3"
[ "$expected" = "$actual" ] || fail "${label}: expected '${expected}', got '${actual}'"
}

PRESERVED_HASH="0xabc123def456abc123def456abc123def456abc123def456abc123def456abcd"
PRESERVED_ADDRESS="qzExistingRewardAddress"
PRESERVED_NAME="old-planck-node"

write_existing_config() {
cat > "$CONFIG_FILE" <<EOF
RUN_MODE="binary"
NODE_NAME="${PRESERVED_NAME}"
INNER_HASH="${PRESERVED_HASH}"
WORMHOLE_ADDRESS="${PRESERVED_ADDRESS}"
NODE_KEY_FILE="node_key.p2p"
CHAIN="mainnet"
MINER_LISTEN_PORT=9833
CPU_WORKERS=4
GPU_DEVICES=1
NODE_VERSION="v0.9.0"
MINER_VERSION="v3.3.1"
MINER_PROTOCOL="auth"
EOF
chmod 600 "$CONFIG_FILE"
mkdir -p "$BIN_DIR"
: > "$NODE_KEY_PATH"
}

download_binaries() {
NODE_VERSION="v1.0.1"
MINER_VERSION="v4.1.0"
MINER_PROTOCOL="auth"
}

detect_platform() {
OS="linux"
ARCH="x86_64"
NODE_TARGET="x86_64-unknown-linux-gnu"
}

generate_wormhole_keys() {
fail "generate_wormhole_keys must not run when refreshing an existing identity"
}

prompt_resource_allocation() {
fail "prompt_resource_allocation must not run when refreshing an existing identity"
}

write_existing_config
cmd_setup --force

# shellcheck source=/dev/null
source "$CONFIG_FILE"
assert_eq "INNER_HASH" "$PRESERVED_HASH" "$INNER_HASH"
assert_eq "WORMHOLE_ADDRESS" "$PRESERVED_ADDRESS" "$WORMHOLE_ADDRESS"
assert_eq "NODE_NAME" "$PRESERVED_NAME" "$NODE_NAME"
assert_eq "CPU_WORKERS" "4" "$CPU_WORKERS"
assert_eq "GPU_DEVICES" "1" "$GPU_DEVICES"
assert_eq "CHAIN" "mainnet" "$CHAIN"
assert_eq "NODE_VERSION" "v1.0.1" "$NODE_VERSION"
assert_eq "MINER_VERSION" "v4.1.0" "$MINER_VERSION"

echo "ok: setup --force preserves existing reward identity"
4 changes: 2 additions & 2 deletions static/scripts/mining.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Never store your 24-word mnemonic in this file — only INNER_HASH is persisted.

# Node name shown on https://telemetry.quantus.cat/
NODE_NAME="my-planck-node"
NODE_NAME="my-quantus-node"

# 32-byte wormhole preimage — required for --rewards-inner-hash
INNER_HASH="0x..."
Expand All @@ -17,7 +17,7 @@ WORMHOLE_ADDRESS="..."
NODE_KEY_FILE="node_key.p2p"

# Chain spec
CHAIN="planck"
CHAIN="mainnet"

# QUIC miner server port (node listens; miner connects via --node-addr)
# Auth files live in the node's chain dir (not this file):
Expand Down
Loading