A Bittensor subnet for MASA's Subnet 42.
- A registered hotkey on subnet 165 on the test network, or 42 on finney (mainnet)
- Docker and Docker Compose installed
- Your coldkey and hotkey mnemonics
- Clone and configure:
git clone https://github.com/masa-finance/subnet-42.git
cd subnet-42
cp .env.example .env- Edit
.envwith your keys:
# Your coldkey mnemonic
COLDKEY_MNEMONIC="your coldkey mnemonic here"
# Your hotkey mnemonic (must be already registered on subnet 165)
HOTKEY_MNEMONIC="your hotkey mnemonic here"- Run as a validator or miner:
# Run as a validator
docker compose --profile validator up
# Run as a miner
docker compose --profile miner upThe containers will automatically pull the latest images from Docker Hub.
Required environment variables in .env:
COLDKEY_MNEMONIC # Your coldkey mnemonic
HOTKEY_MNEMONIC # Your hotkey mnemonic (must be registered on subnet 165)
ROLE # Either "validator" or "miner"Optional environment variables in .env:
NETUID=165 # Subnet ID (default: 165)
SUBTENSOR_NETWORK=test # Network (default: test)
VALIDATOR_PORT=8092 # Port for validator API (default: 8092)
MINER_PORT=8091 # Port for miner API (default: 8091)View logs:
# All logs
docker compose logs -f
# Specific service logs
docker compose logs subnet42 -f # Main service
docker compose logs tee-worker -f # TEE worker (miner only)To verify your node is running correctly:
- Check if your hotkey is registered:
btcli s metagraph --netuid 165 --network test- Check the logs:
docker compose logs subnet42 -fYou should see:
- Successful connection to the test network
- Your hotkey being loaded
- For validators: Connection attempts to miners (note: on testnet, many miners may be offline which is normal)
- For miners: TEE worker initialization and connection to validators
This project supports cookie refresh systems for updating Twitter authentication cookies across different deployment environments.
To generate fresh Twitter cookie files without uploading them:
# Generate cookies only (creates JSON files in ./cookies/)
docker compose up cookies-generatorUse this when your miners are running in Docker containers:
# Generate cookies and update Docker-based miners
docker compose up cookies-updater-dockerThis will:
- Generate fresh Twitter cookies using the
cookies-generatorservice (automatic dependency) - Update all Docker containers with
cookies-volumevolumes using SSH
Requirements:
key.pemfile in the project root for SSH access to remote Docker hosts- Environment variables in
.env:COOKIES_REMOTE_HOSTS=host1,host2,host3 # Comma-separated list of Docker hosts COOKIES_REMOTE_USER=azureuser # SSH username COOKIES_REMOTE_DIR=/tmp/cookies-upload # Temporary directory on remote hosts
Use this when your miners are running in Kubernetes:
# Generate cookies and update Kubernetes-based miners
docker compose up cookies-updater-kubernetesThis will:
- Generate fresh Twitter cookies using the
cookies-generatorservice (automatic dependency) - Update all Kubernetes pods using
kubectl cp
Requirements:
kubeconfig.yamlkubeconfig file in the project root- Environment variables in
.env:DEPLOYMENTS=deployment1,deployment2,deployment3 # Comma-separated list of deployments NAMESPACE=your-namespace # Kubernetes namespace
If you already have cookie files and want to upload them without regenerating:
# Upload existing cookies to Docker-based miners (skip generation)
docker compose up cookies-updater-docker --no-deps
# Upload existing cookies to Kubernetes-based miners (skip generation)
docker compose up cookies-updater-kubernetes --no-depsThe --no-deps flag skips the cookies-generator dependency and uploads whatever cookie files are already present in the ./cookies/ directory.
For all cookie operations, configure your Twitter accounts in .env:
TWITTER_ACCOUNTS="username1:password1,username2:password2"
TWITTER_EMAIL="[email protected]" # Required for verification- Pull latest images:
docker compose pull- Clean start:
# Stop and remove everything
docker compose down -v
# Start fresh as validator
docker compose --profile validator up
# Or start fresh as miner
docker compose --profile miner up- Common issues:
- Ensure your hotkey is registered on subnet 165 (glagolitic_yu) on the test network
- Check logs for any initialization errors
- Verify your mnemonics are correct
- For validators: Connection errors to miners on testnet are normal as many may be offline
- For miners: Ensure TEE worker is running and accessible
- Cookie refresh issues:
- For Docker: Ensure
key.pemSSH key has correct permissions and access to remote hosts - For Kubernetes: Ensure
k8s.ymlkubeconfig is valid and has access to the specified namespace - Check that
TWITTER_ACCOUNTSandTWITTER_EMAILare properly configured in.env