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 of validator nodes to run.
Number of client nodes to run.
Network type:
mainnet, testnet, or canary.Storage Options
Ledger and log root directory.
Remove existing devnet storage before starting.
Only clean devnet storage (ledgers, node data, logs) without starting.
snarkOS Configuration
Path to snarkOS binary. If not found, use
--install to build it at this path.Required features for snarkOS (comma-separated). Example:
test_networkRequired version of snarkOS. Defaults to latest version on crates.io.
(Re)install snarkOS at the provided
--snarkos path with --snarkos-features.Port Configuration
Base REST port. Each node uses base + node_index.Default for validator 0:
3030Base node port. Each node uses base + node_index.
Base BFT port. Each node uses base + node_index.
Base metrics port. Each validator uses base + node_index.
Consensus Options
Custom consensus heights (comma-separated). The
test_network feature must be enabled.Can also be set via CONSENSUS_VERSION_HEIGHTS environment variable.Display Options
Run nodes in tmux (Unix only). Allows easy monitoring of individual nodes.
snarkOS verbosity level (0-4):
- 0: Error only
- 1: Warn
- 2: Info
- 3: Debug
- 4: Trace
Additional Options
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
| Feature | leo devnet | leo devnode |
|---|---|---|
| Nodes | Multiple validators + clients | Single node |
| Consensus | Full BFT consensus | Instant block creation |
| Use Case | Realistic testing | Rapid development |
| Speed | Slower (consensus) | Faster (instant) |
| Resources | Higher | Lower |
Use
leo devnet for realistic testing and leo devnode for rapid iteration.