leo devnet command launches and manages a local Aleo development network using snarkOS, providing a full-featured environment for testing Leo programs.
Syntax
Options
Network Configuration
number
default:4
Number of validator nodes to run.
number
default:2
Number of client nodes to run.
string
default:"testnet"
Network type:
mainnet, testnet, or canary.Storage Options
string
default:"./"
Ledger and log root directory.
boolean
default:false
Remove existing devnet storage before starting.
boolean
default:false
Only clean devnet storage (ledgers, node data, logs) without starting.
snarkOS Configuration
string
Path to snarkOS binary. If not found, use
--install to build it at this path.string[]
Required features for snarkOS (comma-separated). Example:
test_networkstring
Required version of snarkOS. Defaults to latest version on crates.io.
boolean
default:false
(Re)install snarkOS at the provided
--snarkos path with --snarkos-features.Port Configuration
number
Base REST port. Each node uses base + node_index.Default for validator 0:
3030number
Base node port. Each node uses base + node_index.
number
Base BFT port. Each node uses base + node_index.
number
Base metrics port. Each validator uses base + node_index.
Consensus Options
string
Custom consensus heights (comma-separated). The
test_network feature must be enabled.Can also be set via CONSENSUS_VERSION_HEIGHTS environment variable.Display Options
boolean
default:false
Run nodes in tmux (Unix only). Allows easy monitoring of individual nodes.
number
default:1
snarkOS verbosity level (0-4):
- 0: Error only
- 1: Warn
- 2: Info
- 3: Debug
- 4: Trace
Additional Options
boolean
default:false
Skip confirmation prompts and proceed with devnet startup.
Examples
Start Default Devnet
- 4 validators
- 2 clients
- Testnet configuration
- REST endpoint at
http://localhost:3030
Start with Custom Node Count
Start with tmux
Start with Custom Storage
Clear Storage Before Starting
Clean Storage Only
Install and Use Specific snarkOS Version
- Install snarkOS 4.1.0 with
test_networkfeature - Save binary to
./bin/snarkos - Use it to start the devnet
Start with Custom Ports
- REST:
4000 - Node:
5000 - BFT:
6000
- REST:
4001 - Node:
5001 - BFT:
6001
Start with Custom Consensus Heights
Custom consensus heights require the
test_network feature in snarkOS.Start with High Verbosity
Using the Devnet
Once running, use the devnet with Leo commands:Deploy Programs
Execute Transactions
Query Network State
Devnet Architecture
Validators
- Validate and propose blocks
- Participate in consensus
- Maintain full ledger state
- Expose REST API
Clients
- Broadcast transactions
- Query network state
- Do not participate in consensus
Communication
Storage Structure
Default Private Keys
Devnet uses deterministic private keys:Monitoring the Devnet
View Logs
Check Node Status
Query REST API:View Metrics
If metrics are enabled:Stopping the Devnet
PressCtrl+C to stop all nodes:
Troubleshooting
Port Already in Use
- Stop existing devnet
- Use different ports:
--rest-port 4000 - Kill processes using the port
snarkOS Not Found
- Install snarkOS:
--install --snarkos ./bin/snarkos - Provide correct path:
--snarkos /path/to/snarkos
Nodes Not Connecting
Check:- Firewall allows local connections
- Port configuration is correct
- Node logs for connection errors
Storage Issues
- Clean storage:
--clean-only - Use different directory:
--storage ./new-devnet - Check disk space
Performance Tips
- Reduce Nodes: Use fewer validators for faster consensus
- SSD Storage: Use SSD for
--storagedirectory - Lower Verbosity: Use
--verbosity 0for less logging - Dedicated Storage: Use separate disk for storage
Comparison with Devnode
Use
leo devnet for realistic testing and leo devnode for rapid iteration.