PySubnet is a beginner-friendly tool that automates the complex process of setting up multi-node Substrate blockchain networks. Whether you're a blockchain developer learning Substrate or deploying production networks, PySubnet handles all the tedious setup work for you.
- ๐ Generates all cryptographic keys for your validator authorities (AURA, BABE, GRANDPA)
- ๐ Creates proper directory structure for your network nodes
- โ๏ธ Prepares a chainspec with bootnodes and validator keys
- ๐ Sets up p2p keys (libp2p keys for bootnodes list)
- ๐ธ Funds starting balances for any number of accounts for you without having to manually edit chainspec files. (See example in nodes.toml)
- ๐โโ๏ธ Launches your network with a single command (
-r
) - ๐จ Interactive CLI with beautiful, colorful output (
-i
)
- Blockchain Developers learning the Substrate framework with multi-node setups
- DevOps Teams for managing multiple sets of keys for separate nodes
- Rapid Prototyping of blockchain applications
uv pip install pysubnet
# or install it as a tool
uv tool install pysubnet
pip install git+https://github.com/weezy20/pysubnet.git
uvx git+https://github.com/weezy20/pysubnet.git
๐ก Tip: If you get Python header errors during installation:
- Ubuntu/Debian:
sudo apt install python3-dev
- RHEL/Fedora:
sudo dnf install python3-devel
- macOS:
xcode-select --install
pysubnet
That's it! PySubnet will automatically start in interactive mode and guide you through the setup.
PySubnet will present you with 5 commonly used consensus options:
- ๐ข PoA (Proof-of-Authority) - Perfect for learning and simple development
- ๐ก PoA + ValidatorSet - PoA with sessions pallet and substrate-validator-pallet for dynamic authority management
Note: To use this pallet (substrate-validator-set) it's recommended to clone it locally and add it to your runtime because as of this writing, it's dependecies seem outdated, but its functionality is unaffected
- ๐ต BABE + GRANDPA - Production-ready consensus (like Polkadot)
- ๐ฃ BABE + GRANDPA + Staking - Full production setup with economic security
- ๐ด Development Mode - Single node for rapid development
When you run pysubnet
, it automatically detects if you have a substrate binary and provides:
- ๐จ Beautiful CLI interface with colors and progress bars
- ๐ค Smart substrate detection - automatically switches to interactive mode if no binary found
- โ Helpful prompts - clear explanations for each option
- ๐ง Flexible configuration - choose exactly what you need
- ๐ Real-time feedback - see your network being built step by step
# Quick setup with defaults
pysubnet --clean --run
# Or a shorter version
pysubnet -cr
# Custom binary location
pysubnet --bin ./target/release/my-node --run
# Using Docker
pysubnet --docker substrate:latest --run
# Custom chainspec
pysubnet --chainspec ./my-chainspec.json --run
Create advanced network configurations:
pysubnet --config ./network-config.toml --run
See docs/config.md for configuration examples.
PySubnet creates organized directories:
./network/ # Default root directory
โโโ pysubnet.json # Network configuration & keys
โโโ chainspec.json # Generated chainspec
โโโ raw_chainspec.json # Raw chainspec for nodes
โโโ alice/ # Node directories
โ โโโ alice-node-private-key
โ โโโ chains/<chain folder based on running chainspec>/keystore/
โโโ bob/
โโโ charlie/
Flag | Description | Example |
---|---|---|
-i , --interactive |
Force interactive mode (default when no substrate binary) | pysubnet -i |
-r , --run |
Launch network after setup | pysubnet -r |
-c , --clean |
Clean existing network directory | pysubnet -c |
--root |
Custom network directory | --root ./my-network |
--bin |
Path to substrate binary | --bin ./substrate |
--docker |
Use Docker image | --docker substrate:latest |
--chainspec |
Base chainspec (dev , local , or file path) |
--chainspec dev |
--config |
Network configuration file | --config ./config.toml |
--account |
Account type (ecdsa or sr25519 ) |
--account ecdsa |
--poa |
Force basic PoA mode (bypass interactive selection) | --poa |
The first tutorial on substrate is about running a PoA node with 2 or 3 nodes. You can replicate that entire tutorial with pysubnet by running pysubnet -icr --poa --bin <your poa enabled node>
.
- ๐ Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
- All node data (crypto keys, Account keys, libp2p keys, node IDs) is stored in
pysubnet.json
. - The script auto-generates keystores compatible with Substrateโs expected format.
- ๐งน Always use
--clean/-c
when restarting development to avoid issues. - ๐ Save your pysubnet.json - After having a proper setup, save this file for your future reference, it contains all your network keys and configuration
- ๐ฏ 5 Consensus Options (upgraded from 2)
- ๐จ Enhanced Interactive Mode with beautiful CLI
- ๐ค Smart Binary Detection with automatic fallback
- ๐ฆ Modular Architecture for easier customization
Made with โค๏ธ for the Substrate community