Skip to main content

6.3 Running Locally (Staging)

Run C-SWON on a local blockchain for development and testing. No testnet TAO required.

Local blockchain = isolated authority nodes on your machine. Not connected to testnet or mainnet. See 6.4 Local Deploy for the recommended Docker-based approach.

Prerequisites

RequirementVersion
Python3.10–3.12
Dockerrecent (docker --version)
Gitany recent
bittensor10.x
# Pull and start local chain
docker pull ghcr.io/opentensor/subtensor-localnet:devnet-ready
docker run -d --name local_chain -p 9944:9944 -p 9945:9945 \
ghcr.io/opentensor/subtensor-localnet:devnet-ready

# Wait for block production
docker logs -f local_chain # Ctrl-C once you see blocks

Two endpoints:

PortUse
ws://127.0.0.1:9944Metagraph queries, neuron traffic
ws://127.0.0.1:9945Wallet operations (transfer, stake, register, create)

Then follow 6.4 Local Deploy for the full walkthrough.

Alternative: Build Subtensor from Source

Only needed if Docker is unavailable.

# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"

# Linux dependencies
sudo apt update && sudo apt install -y make build-essential git clang curl libssl-dev llvm libudev-dev protobuf-compiler

# Clone and build
git clone https://github.com/opentensor/subtensor.git
cd subtensor
./subtensor/scripts/init.sh
./scripts/localnet.sh # fast blocks (250ms)
# or
./scripts/localnet.sh False # normal blocks (12s)

Environment Setup

cd C-SWON
python3.12 -m venv .venv && source .venv/bin/activate
pip install bittensor && pip install -e .

# Create .env
cat > .env << 'EOF'
CSWON_MOCK_EXEC=true
CSWON_SYNTHETIC_SALT=$(python -c "import secrets; print(secrets.token_hex(32))")
EOF
set -a && source .env && set +a

Wallets, Registration, and Running

Follow 6.4 Local Deploy Steps 4–12 for the complete local workflow.

Warning: docker restart local_chain resets all chain state. You will need to redo wallet funding, registration, and staking.


← Previous6.2 Running on Mainnet
→ Next6.4 Local Deploy Guide
IndexDocumentation Index