Skip to main content
The 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.
Default test key: APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH is for development only.
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

Output:
The 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:
Output:
This creates 10 empty blocks, useful for:
  • 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

The devnode instantly creates a block with the deployment.

Execute Transactions

The devnode instantly creates a block with the execution.

Query State

REST API

The devnode provides a REST API compatible with snarkOS:

Get Latest Block

Get Latest Height

Response:

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:
  1. A transaction is broadcast
  2. leo devnode advance is called
No waiting for consensus or block time.

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:
Never use the default devnode private key on mainnet or testnet.

Development Workflow

Typical workflow with devnode:

Environment Variables

Configure devnode via .env:
Then simply:

Logging

Devnode logs to stdout:
For verbose logging:

Stopping the Devnode

Press Ctrl+C to stop:

Troubleshooting

Port Already in Use

Solutions:
  1. Stop existing devnode
  2. Kill process using port 3030:

Transaction Not Confirmed

If a transaction doesn’t confirm:
  1. Check devnode is running
  2. Verify endpoint is http://localhost:3030
  3. Check devnode logs for errors
  4. Ensure transaction is valid

State Mismatch

If state is inconsistent:
  1. Restart devnode (clears state)
  2. Redeploy programs
  3. 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

Use leo test for unit tests:

Integration Testing

Use devnode for integration tests:

End-to-End Testing

Use devnet for E2E tests:

Next Steps