leo devnode command runs a single-node local development server with instant block creation, ideal for rapid testing and iteration.
Syntax
Subcommands
start
Start the devnode server.advance
Advance the ledger by a specified number of blocks.Start Options
string
Private key to use for the devnode. Defaults to test private key.
string
default:"testnet"
Network type:
mainnet, testnet, or canary.string
Endpoint override (for configuration purposes).
Advance Options
number
required
Number of blocks to advance.
string
default:"http://localhost:3030"
Devnode endpoint URL.
Examples
Start Devnode
- Listens on
http://localhost:3030 - Creates blocks instantly on transaction receipt
- Maintains in-memory ledger state
- Provides REST API compatible with snarkOS
Start with Custom Private Key
Advance Blocks
In a separate terminal:- Testing time-dependent logic
- Advancing past block height thresholds
- Simulating network progression
Advance Custom Number of Blocks
Using the Devnode
Once running, interact with it like any Aleo node:Deploy Programs
Execute Transactions
Query State
REST API
The devnode provides a REST API compatible with snarkOS:Get Latest Block
Get Latest Height
Get Block by Height
Get State Root
Get Program
Broadcast Transaction
Devnode vs Devnet
Use
leo devnode for rapid development and iteration. Use leo devnet for more realistic testing.Block Creation Behavior
The devnode creates blocks instantly when:- A transaction is broadcast
leo devnode advanceis called
State Persistence
The devnode maintains state only in memory:- State is lost when the devnode stops
- No persistence to disk
- Fast startup with clean state
For persistent storage, use
leo devnet instead.Default Configuration
The devnode uses:Development Workflow
Typical workflow with devnode:Environment Variables
Configure devnode via.env:
Logging
Devnode logs to stdout:Stopping the Devnode
PressCtrl+C to stop:
Troubleshooting
Port Already in Use
- Stop existing devnode
- Kill process using port 3030:
Transaction Not Confirmed
If a transaction doesnβt confirm:- Check devnode is running
- Verify endpoint is
http://localhost:3030 - Check devnode logs for errors
- Ensure transaction is valid
State Mismatch
If state is inconsistent:- Restart devnode (clears state)
- Redeploy programs
- Re-execute transactions
Advanced Usage
Custom REST Endpoints
The devnode supports standard Aleo REST endpoints:Programmatic Interaction
Interact programmatically via HTTP:Testing Strategies
Unit Testing
Useleo test for unit tests: