Local Devnet
Overview
Section titled “Overview”Ashen provides three ways to run a local development environment:
- Single node — one validator with RPC, fastest iteration loop
- Multi-node testnet — multiple validators with P2P, tests consensus
- Deterministic simulation — in-memory consensus sim, no network needed
Quick Start (Single Node)
Section titled “Quick Start (Single Node)”# Generate a keypairjust ed25519-keygen > dev.key.json
# Initialize with a pre-funded accountjust node init --data-dir ./node-data \ --alloc "493615aa1e16a24f618d3ab6dd93a9250ca76e19996e46493a372c5994862e8c=13370000000000"
# Start the node (RPC on port 3030)just node run --data-dir ./node-data --block-time-ms 1000Verify it’s running:
just rpc-statusKey Generation
Section titled “Key Generation”# Random keyjust ed25519-keygen
# Deterministic key (reproducible)just ed25519-keygen --seed 12345Output:
{ "seed": 12345, "secret_key": "0x...", "public_key": "0x...", "address": "0x493615aa..."}Use --seed for reproducible test accounts across runs.
Genesis Configuration
Section titled “Genesis Configuration”Genesis is created during node init. Pre-fund accounts with --alloc:
# Multiple accountsjust node init --data-dir ./node-data \ --alloc "ADDR1=1000000" \ --alloc "ADDR2=2000000"
# Auto-generate N seed accountsjust node init --data-dir ./node-data \ --seed 42 --seed-count 10 --seed-balance 1000000000The resulting genesis.json:
{ "allocations": [ { "address": "493615aa...", "balance": 13370000000000 } ]}Multi-Node Testnet
Section titled “Multi-Node Testnet”Generate and run a local validator set:
# Generate configs for 3 validatorsjust testnet-local-generate N_VALIDATORS=3 TESTNET_DIR=./testnet-local
# Start all validators + archive node with RPCjust testnet-local-run N_VALIDATORS=3 TESTNET_DIR=./testnet-localOr use the setup binary for more control:
cargo run --bin setup -- local \ --validators 4 \ --seed 12345 \ --initial-balance 1000000000 \ --output ./testnetThis creates: validator keys, BLS shares, peers.yaml, genesis.json, and a
start-validators.sh script.
Deterministic Simulation
Section titled “Deterministic Simulation”The devnet binary runs an in-memory consensus simulation — no network, fully
deterministic:
# Default: 4 nodes, 200 stepsjust devnet-small
# Chaos: 7 nodes, packet loss, latencyjust devnet-chaosCustom Parameters
Section titled “Custom Parameters”cargo run --bin devnet -- \ --nodes 4 \ --steps 500 \ --step-ms 10 \ --link-latency-ms 5 \ --link-jitter-ms 2 \ --success-rate 1.0 \ --state-backend cached-journal| Parameter | Env Var | Default | Description |
|---|---|---|---|
--nodes | DEVNET_N | 4 | Number of validators |
--steps | DEVNET_STEPS | 200 | Simulation steps |
--step-ms | DEVNET_STEP_MS | 10 | Milliseconds per step |
--link-latency-ms | DEVNET_LINK_LATENCY_MS | 5 | Baseline link latency |
--link-jitter-ms | DEVNET_LINK_JITTER_MS | 2 | Latency jitter |
--success-rate | DEVNET_SUCCESS_RATE | 1.0 | Packet delivery rate (0.0-1.0) |
--state-backend | DEVNET_STATE_BACKEND | cached-journal | State backend |
--report-every-steps | DEVNET_REPORT_EVERY_STEPS | 50 | Report interval |
Chaos Testing
Section titled “Chaos Testing”Simulate degraded network conditions:
DEVNET_SUCCESS_RATE=0.9 \DEVNET_LINK_LATENCY_MS=25 \DEVNET_LINK_JITTER_MS=10 \cargo run --bin devnet -- --nodes 7 --steps 500This tests consensus resilience under 10% packet loss and variable latency.
Interacting with a Running Node
Section titled “Interacting with a Running Node”RPC Commands
Section titled “RPC Commands”just rpc-status # Chain statusjust rpc-manifest # Method IDL (JSON)just rpc-idl # Raw IDL textjust rpc-account ADDR # Account balance/noncejust rpc-predict-address DEPLOYER OFFSET # Predict deploy addressjust rpc-tx-submit TX_HEX # Submit signed transactionjust rpc-tx HASH # Look up transactionjust rpc-view CONTRACT CALLDATA GAS # Read-only contract calljust rpc-call METHOD PARAMS # Arbitrary RPC callDirect curl
Section titled “Direct curl”curl -s http://127.0.0.1:3030/v2/rpc \ -H 'Content-Type: application/json' \ -d '{"jsonrpc":"2.0","id":1,"method":"status","params":{}}' | jq .resultSmoke Tests
Section titled “Smoke Tests”just agent-smoke # Quick consensus + application testsjust agent-report # Bundle metrics, health, and logsNode Modes
Section titled “Node Modes”| Mode | Command | Description |
|---|---|---|
| Validator | node run | Full consensus + RPC |
| RPC-only | node rpc | Serves RPC from shared data-dir |
| Follower | node follower | P2P sync, no consensus participation |
Useful Flags
Section titled “Useful Flags”| Flag | Default | Description |
|---|---|---|
--block-time-ms | 1000 | Block production interval |
--archive-mode | off | Retain all historical state |
--prune-keep-epochs | 10 | Epochs to keep when pruning |
--checkpoint-interval | — | Emit snapshots every N blocks |
--produce-empty | true | Produce blocks with empty mempool |
ashen-dev Tool
Section titled “ashen-dev Tool”Thin wrapper for common dev workflows:
ashen-dev build [args] # Build contractsashen-dev test [args] # Run vm-runtime tests (default)ashen-dev simulate --tx "0x..." --pretty # Simulate transaction via RPCEnvironment Variables
Section titled “Environment Variables”# RPC connectionNODE_RPC_URL=http://127.0.0.1:3030NODE_AUTH_TOKEN=optional_bearer_token
# Node configurationNODE_DATA_DIR=./node-dataNODE_LISTEN=127.0.0.1:3030NODE_BLOCK_TIME_MS=1000
# Trace output (debugging)ASHEN_TRACE_OUTPUT=1ASHEN_TRACE_OUTPUT_DIR=target/feedbackRelated
Section titled “Related”- Running a Node — production node setup
- Transaction Simulation — simulating transactions
- Contract Testing — testing without a node
- Debugging — trace output and debugging tools
- Troubleshooting — common issues