Skip to content

Installation

This guide covers building Ashen from source. There are two paths: devenv (recommended) for a reproducible Nix-based environment, or manual installation if you prefer managing dependencies yourself.

The fastest way to get started is with devenv:

Terminal window
# Clone the repository
git clone https://github.com/ashen-sh/ashen.git
cd ashen
# Enter the dev environment (installs all dependencies)
devenv shell
# Build everything
just build
# Run tests
just test

ComponentMinimumRecommended
CPU4 cores8+ cores
RAM8 GB16+ GB
Disk20 GB free50+ GB SSD
OSLinux, macOSUbuntu 22.04+, macOS 13+
ToolVersionPurpose
Rustnightly-2025-11-05Node and contract compilation
Zig0.13+Zig contract compilation
just1.0+Task runner
jq1.6+JSON processing (scripts)
curlanyRPC testing

devenv provides a reproducible development environment with all dependencies pinned.

Terminal window
# Install Nix (if not already installed)
sh <(curl -L https://nixos.org/nix/install) --daemon
# Install devenv
nix-env -iA devenv -f https://github.com/NixOS/nixpkgs/tarball/nixpkgs-unstable
Terminal window
cd ashen
devenv shell

This automatically provides:

  • Rust nightly (2025-11-05) with all components
  • RISC-V cross-compilation target
  • Miri for memory safety checks
  • All required system tools (jq, curl, etc.)

Inside devenv shell, these scripts are available:

CommandDescription
buildBuild entire workspace
testRun all tests
fmtFormat code
clippyRun lints
ashenRun the ashen CLI
devnet-nodeRun a development node
contract-buildBuild a contract
contract-deployDeploy a contract

If you prefer not to use Nix, install dependencies manually.

Terminal window
# Install rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Install the specific nightly toolchain
rustup toolchain install nightly-2025-11-05
# Set as default for this project
cd ashen
rustup override set nightly-2025-11-05
# Add required components
rustup component add rustc cargo clippy rustfmt rust-analyzer rust-src llvm-tools-preview
# Add RISC-V target for contracts
rustup target add riscv64imac-unknown-none-elf
Terminal window
# Ubuntu/Debian
sudo apt install zig
# macOS
brew install zig
# Or download from https://ziglang.org/download/
Terminal window
# Ubuntu/Debian
sudo apt install just
# macOS
brew install just
# Or via cargo
cargo install just
Terminal window
# Ubuntu/Debian
sudo apt install curl jq build-essential
# macOS
brew install curl jq

Terminal window
# Build the entire workspace (debug)
just build
# Or directly with cargo
cargo build --workspace --all-targets
# Release build (optimized)
cargo build --workspace --all-targets --release
Terminal window
# Build just the node
cargo build --bin node --release
# Build the CLI
cargo build --bin ashen --release
# Build the devnet simulator
cargo build --bin devnet
Terminal window
# Build a specific Rust contract
just contract-build --manifest-path contracts/sft_v1/Cargo.toml
# With debug info (for debugging)
just contract-build-debug --manifest-path contracts/sft_v1/Cargo.toml

The contract is compiled to: target/riscv64imac-unknown-none-elf/release/<name>

Terminal window
# Build a specific Zig contract
cd contracts/amm_pool_v1
zig build -Doptimize=ReleaseSmall
# Build all contracts (Zig and Rust)
just contract-build-all

Terminal window
# Verify workspace compiles
cargo check --workspace --all-targets
Terminal window
# Run all tests
just test
# Or specific test suites
cargo test -p ashen # Core chain tests
cargo test -p vm-conformance # VM conformance
cargo test -p vm-runtime # Runtime tests
Terminal window
# Fast verification of core functionality
just agent-smoke

This runs:

  • Workspace compilation check
  • 4-node consensus simulation (100 steps)
  • Core application tests
  • Execution unit tests
Terminal window
# Initialize node data with a funded account
just ed25519-keygen > ./target/dev.key.json
export ASHEN_PRIVATE_KEY=@./target/dev.key.json
ADDR=$(jq -r .address ./target/dev.key.json)
just devnet-node init --data-dir ./node-data --alloc "$ADDR=1000000000000"
# Run the node
just node

In another terminal:

Terminal window
# Check status
just rpc-status
# Check your account
just rpc-account $ADDR

Terminal window
# List all available commands
just
# Format code
just fmt
# Run clippy lints
just clippy
# Run a single chain test (fast)
just ashen-single
# Run devnet simulation
just devnet-small # 4 nodes, 200 steps
just devnet-chaos # 7 nodes, lossy network
# Show verification guide
just robot

Install these extensions:

  • rust-analyzer — Rust language support
  • Even Better TOML — Cargo.toml editing
  • Zig Language — Zig support (for contracts)

Add to .vscode/settings.json:

{
"rust-analyzer.cargo.target": null,
"rust-analyzer.check.command": "clippy",
"rust-analyzer.check.extraArgs": [
"--",
"-D", "clippy::panic",
"-D", "clippy::unwrap_used",
"-D", "clippy::expect_used"
]
}

Use nvim-lspconfig with rust-analyzer:

require('lspconfig').rust_analyzer.setup {
settings = {
['rust-analyzer'] = {
check = {
command = 'clippy',
},
},
},
}

Set these in your shell or .env file:

VariableDefaultDescription
NODE_RPC_URLhttp://127.0.0.1:3030RPC endpoint for CLI tools
NODE_AUTH_TOKENnoneBearer token for authenticated RPC
ASHEN_PRIVATE_KEYnoneSigning key for transactions
NODE_DATA_DIR./node-dataDefault data directory

The ASHEN_PRIVATE_KEY can be:

Terminal window
# Raw hex (64 chars)
export ASHEN_PRIVATE_KEY="abcd1234..."
# 0x-prefixed hex
export ASHEN_PRIVATE_KEY="0xabcd1234..."
# File reference (JSON with secret_key_hex field)
export ASHEN_PRIVATE_KEY="@./path/to/key.json"
# Keystore reference
export ASHEN_PRIVATE_KEY="keystore:my-key"

error: target 'riscv64imac-unknown-none-elf' not found

Fix: Install the RISC-V target:

Terminal window
rustup target add riscv64imac-unknown-none-elf
error: linker `cc` not found

Fix: Install a C toolchain:

Terminal window
# Ubuntu/Debian
sudo apt install build-essential
# macOS (Xcode command line tools)
xcode-select --install
zig: command not found

Fix: Install Zig or enter devenv shell:

Terminal window
devenv shell
# Or install Zig manually: https://ziglang.org/download/

Large workspaces can exhaust memory during parallel compilation.

Fix: Limit parallelism:

Terminal window
cargo build -j 4 # Limit to 4 parallel jobs
error: getting status of '/nix/store/...': No such file or directory

Fix: Rebuild the Nix store:

Terminal window
devenv gc # Garbage collect
devenv shell # Re-enter