Skip to main content

6.1 Running on Testnet

Deploy C-SWON on the Bittensor test network. We recommend trying 6.4 Local Deploy first.

Security
  • Do not expose your private keys.
  • Only use your testnet wallet for testing.
  • Do not reuse mainnet wallet passwords.

Prerequisites

RequirementVersionCheck
Python3.10–3.12 (bt SDK has issues with 3.14)python3 --version
bittensor10.xpython -c "import bittensor; print(bittensor.__version__)"
btclilatestbtcli --version
Test TAOrequest from Discord#testnet-faucet

1. Install C-SWON

git clone https://github.com/adysingh5711/C-SWON.git
cd C-SWON
python3.12 -m venv .venv && source .venv/bin/activate
pip install bittensor && pip install -e .

2. Create Wallets

btcli wallet new_coldkey --wallet.name owner
btcli wallet new_hotkey --wallet.name owner --wallet.hotkey default

btcli wallet new_coldkey --wallet.name vali
btcli wallet new_hotkey --wallet.name vali --wallet.hotkey default

btcli wallet new_coldkey --wallet.name miner
btcli wallet new_hotkey --wallet.name miner --wallet.hotkey default

Fund all three coldkeys with Test TAO from the Discord faucet.

3. Create the Subnet

# Check burn cost
btcli subnet burn-cost --network test

# Create subnet
btcli subnet create --network test --wallet.name owner

Note the netuid from the output (C-SWON testnet: 26).

4. Register Validator and Miner

btcli subnet register --netuid 26 --wallet.name vali --wallet.hotkey default --network test
btcli subnet register --netuid 26 --wallet.name miner --wallet.hotkey default --network test

5. Start the Subnet

Newly created subnets are inactive by default — start emissions before staking:

btcli subnet start --netuid 26 --wallet.name owner --network test

6. Stake

# Validator — needs enough stake for validator permit (top 64 by stake)
btcli stake add --netuid 26 --wallet.name vali --wallet.hotkey default --network test --amount 50 --unsafe

# Miner — small stake for registration
btcli stake add --netuid 26 --wallet.name miner --wallet.hotkey default --network test --amount 15 --unsafe

Use --unsafe to bypass slippage protection on testnet's thin AMM pool.

7. Disable Commit-Reveal Weights

Testnet defaults to commit_reveal_weights_enabled=true, which causes bad signature errors:

btcli sudo set --netuid 26 --param commit_reveal_weights_enabled --value false --network test --wallet.name owner

Verify:

btcli subnet hyperparameters --netuid 26 --network test

8. Set Environment Variables

# Create .env file
cat > .env << 'EOF'
CSWON_MOCK_EXEC=true
CSWON_SYNTHETIC_SALT=<generate-with: python -c "import secrets; print(secrets.token_hex(32))">
EOF

# Load in every terminal
set -a && source .env && set +a

CRITICAL: Both variables are required. Save the salt — reuse it across restarts.

9. Run Miner and Validator

CLI flag note: btcli uses --network test. Neuron scripts use --subtensor.network test. These are different frameworks.

Start the miner first in one terminal:

python neurons/miner.py \
--netuid 26 \
--subtensor.network test \
--wallet.name miner \
--wallet.hotkey default \
--axon.port 8091 \
--logging.debug

Then the validator in a second terminal:

python neurons/validator.py \
--netuid 26 \
--subtensor.network test \
--wallet.name vali \
--wallet.hotkey default \
--axon.port 8092 \
--logging.debug

10. Verify

Expected miner log:

Axon created with synapses: ['Synapse', 'WorkflowSynapse']
C-SWON Miner initialised
Miner starting at block: ...
Received task: code_001 type=code
Returning workflow plan for code_001: 1 nodes, est_cost=0.0010τ

Expected validator log:

Selected task: code_001 type=code synthetic=False at block ...
Received 12 responses from 12 miners
Validated 1 responses
Scored 1 miners: mean=0.XXXX

Check on-chain state:

btcli subnet metagraph --netuid 26 --network test
btcli wallet overview --wallet.name vali --netuid 26 --network test

11. Enable Emissions (Root Registration)

For emissions to flow to your subnet:

btcli root register --subtensor.network test --wallet.name owner
btcli root weights --subtensor.network test --wallet.name owner

Scaling to Multiple Miners

Register additional hotkeys under the same coldkey:

for hk in miner2 miner3 miner4 miner5; do
btcli wallet new_hotkey --wallet.name miner --wallet.hotkey $hk
btcli subnet register --netuid 26 --wallet.name miner --wallet.hotkey $hk --network test
btcli stake add --netuid 26 --wallet.name miner --wallet.hotkey $hk --network test --amount 15 --unsafe
done

Troubleshooting

SymptomFix
SubtokenDisabled on stakeRun btcli subnet start before staking
SlippageTooHigh on stakeUse --unsafe flag
bad signature on set_weightsDisable commit-reveal (Step 7)
No serving miners foundStart miner first, wait 30s for metagraph sync
CSWON_SYNTHETIC_SALT errorSet in .env file and source it
All scores 0.1Check miner capability inference matches task keywords
Weights never submittedOn small testnets all UIDs may have validator_permit=True — code handles this automatically

← Previous5.6 Immunity & Warm-Up
→ Next6.2 Running on Mainnet
IndexDocumentation Index