Skip to main content
The 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_network
string
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: 3030
number
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

Starts a devnet with:
  • 4 validators
  • 2 clients
  • Testnet configuration
  • REST endpoint at http://localhost:3030
Output:

Start with Custom Node Count

Start with tmux

Each node runs in a separate tmux pane for easy monitoring:

Start with Custom Storage

Clear Storage Before Starting

This deletes all existing ledger data. Use with caution.

Clean Storage Only

Removes devnet storage without starting nodes.

Install and Use Specific snarkOS Version

This will:
  1. Install snarkOS 4.1.0 with test_network feature
  2. Save binary to ./bin/snarkos
  3. Use it to start the devnet

Start with Custom Ports

Validator 0 will use:
  • REST: 4000
  • Node: 5000
  • BFT: 6000
Validator 1 will use:
  • REST: 4001
  • Node: 5001
  • BFT: 6001
And so on…

Start with Custom Consensus Heights

Or via environment variable:
Custom consensus heights require the test_network feature in snarkOS.

Start with High Verbosity

Shows detailed debug logs from snarkOS.

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:
These keys are for testing only. Never use devnet keys on mainnet.

Monitoring the Devnet

View Logs

Check Node Status

Query REST API:

View Metrics

If metrics are enabled:

Stopping the Devnet

Press Ctrl+C to stop all nodes:

Troubleshooting

Port Already in Use

Solutions:
  1. Stop existing devnet
  2. Use different ports: --rest-port 4000
  3. Kill processes using the port

snarkOS Not Found

Solutions:
  1. Install snarkOS: --install --snarkos ./bin/snarkos
  2. Provide correct path: --snarkos /path/to/snarkos

Nodes Not Connecting

Check:
  1. Firewall allows local connections
  2. Port configuration is correct
  3. Node logs for connection errors

Storage Issues

Solutions:
  1. Clean storage: --clean-only
  2. Use different directory: --storage ./new-devnet
  3. Check disk space

Performance Tips

  1. Reduce Nodes: Use fewer validators for faster consensus
  2. SSD Storage: Use SSD for --storage directory
  3. Lower Verbosity: Use --verbosity 0 for less logging
  4. Dedicated Storage: Use separate disk for storage

Comparison with Devnode

Use leo devnet for realistic testing and leo devnode for rapid iteration.

Next Steps