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.
Quick Start (devenv)
Section titled “Quick Start (devenv)”The fastest way to get started is with devenv:
# Clone the repositorygit clone https://github.com/ashen-sh/ashen.gitcd ashen
# Enter the dev environment (installs all dependencies)devenv shell
# Build everythingjust build
# Run testsjust testPrerequisites
Section titled “Prerequisites”System Requirements
Section titled “System Requirements”| Component | Minimum | Recommended |
|---|---|---|
| CPU | 4 cores | 8+ cores |
| RAM | 8 GB | 16+ GB |
| Disk | 20 GB free | 50+ GB SSD |
| OS | Linux, macOS | Ubuntu 22.04+, macOS 13+ |
Required Tools
Section titled “Required Tools”| Tool | Version | Purpose |
|---|---|---|
| Rust | nightly-2025-11-05 | Node and contract compilation |
| Zig | 0.13+ | Zig contract compilation |
| just | 1.0+ | Task runner |
| jq | 1.6+ | JSON processing (scripts) |
| curl | any | RPC testing |
Option 1: devenv (Recommended)
Section titled “Option 1: devenv (Recommended)”devenv provides a reproducible development environment with all dependencies pinned.
Install devenv
Section titled “Install devenv”# Install Nix (if not already installed)sh <(curl -L https://nixos.org/nix/install) --daemon
# Install devenvnix-env -iA devenv -f https://github.com/NixOS/nixpkgs/tarball/nixpkgs-unstableEnter the Environment
Section titled “Enter the Environment”cd ashendevenv shellThis 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.)
Available Commands
Section titled “Available Commands”Inside devenv shell, these scripts are available:
| Command | Description |
|---|---|
build | Build entire workspace |
test | Run all tests |
fmt | Format code |
clippy | Run lints |
ashen | Run the ashen CLI |
devnet-node | Run a development node |
contract-build | Build a contract |
contract-deploy | Deploy a contract |
Option 2: Manual Installation
Section titled “Option 2: Manual Installation”If you prefer not to use Nix, install dependencies manually.
1. Install Rust
Section titled “1. Install Rust”# Install rustupcurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Install the specific nightly toolchainrustup toolchain install nightly-2025-11-05
# Set as default for this projectcd ashenrustup override set nightly-2025-11-05
# Add required componentsrustup component add rustc cargo clippy rustfmt rust-analyzer rust-src llvm-tools-preview
# Add RISC-V target for contractsrustup target add riscv64imac-unknown-none-elf2. Install Zig (for Zig contracts)
Section titled “2. Install Zig (for Zig contracts)”# Ubuntu/Debiansudo apt install zig
# macOSbrew install zig
# Or download from https://ziglang.org/download/3. Install just
Section titled “3. Install just”# Ubuntu/Debiansudo apt install just
# macOSbrew install just
# Or via cargocargo install just4. Install System Tools
Section titled “4. Install System Tools”# Ubuntu/Debiansudo apt install curl jq build-essential
# macOSbrew install curl jqBuilding from Source
Section titled “Building from Source”Build Everything
Section titled “Build Everything”# Build the entire workspace (debug)just build
# Or directly with cargocargo build --workspace --all-targets
# Release build (optimized)cargo build --workspace --all-targets --releaseBuild Individual Components
Section titled “Build Individual Components”# Build just the nodecargo build --bin node --release
# Build the CLIcargo build --bin ashen --release
# Build the devnet simulatorcargo build --bin devnetBuild Contracts
Section titled “Build Contracts”Rust Contracts
Section titled “Rust Contracts”# Build a specific Rust contractjust contract-build --manifest-path contracts/sft_v1/Cargo.toml
# With debug info (for debugging)just contract-build-debug --manifest-path contracts/sft_v1/Cargo.tomlThe contract is compiled to: target/riscv64imac-unknown-none-elf/release/<name>
Zig Contracts
Section titled “Zig Contracts”# Build a specific Zig contractcd contracts/amm_pool_v1zig build -Doptimize=ReleaseSmall
# Build all contracts (Zig and Rust)just contract-build-allVerifying Installation
Section titled “Verifying Installation”1. Check the Build
Section titled “1. Check the Build”# Verify workspace compilescargo check --workspace --all-targets2. Run Tests
Section titled “2. Run Tests”# Run all testsjust test
# Or specific test suitescargo test -p ashen # Core chain testscargo test -p vm-conformance # VM conformancecargo test -p vm-runtime # Runtime tests3. Run a Quick Smoke Test
Section titled “3. Run a Quick Smoke Test”# Fast verification of core functionalityjust agent-smokeThis runs:
- Workspace compilation check
- 4-node consensus simulation (100 steps)
- Core application tests
- Execution unit tests
4. Start a Local Node
Section titled “4. Start a Local Node”# Initialize node data with a funded accountjust ed25519-keygen > ./target/dev.key.jsonexport ASHEN_PRIVATE_KEY=@./target/dev.key.jsonADDR=$(jq -r .address ./target/dev.key.json)
just devnet-node init --data-dir ./node-data --alloc "$ADDR=1000000000000"
# Run the nodejust nodeIn another terminal:
# Check statusjust rpc-status
# Check your accountjust rpc-account $ADDRDevelopment Workflow
Section titled “Development Workflow”Useful just Commands
Section titled “Useful just Commands”# List all available commandsjust
# Format codejust fmt
# Run clippy lintsjust clippy
# Run a single chain test (fast)just ashen-single
# Run devnet simulationjust devnet-small # 4 nodes, 200 stepsjust devnet-chaos # 7 nodes, lossy network
# Show verification guidejust robotIDE Setup
Section titled “IDE Setup”VS Code
Section titled “VS Code”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" ]}Neovim
Section titled “Neovim”Use nvim-lspconfig with rust-analyzer:
require('lspconfig').rust_analyzer.setup { settings = { ['rust-analyzer'] = { check = { command = 'clippy', }, }, },}Environment Variables
Section titled “Environment Variables”Set these in your shell or .env file:
| Variable | Default | Description |
|---|---|---|
NODE_RPC_URL | http://127.0.0.1:3030 | RPC endpoint for CLI tools |
NODE_AUTH_TOKEN | none | Bearer token for authenticated RPC |
ASHEN_PRIVATE_KEY | none | Signing key for transactions |
NODE_DATA_DIR | ./node-data | Default data directory |
Key Formats
Section titled “Key Formats”The ASHEN_PRIVATE_KEY can be:
# Raw hex (64 chars)export ASHEN_PRIVATE_KEY="abcd1234..."
# 0x-prefixed hexexport ASHEN_PRIVATE_KEY="0xabcd1234..."
# File reference (JSON with secret_key_hex field)export ASHEN_PRIVATE_KEY="@./path/to/key.json"
# Keystore referenceexport ASHEN_PRIVATE_KEY="keystore:my-key"Troubleshooting
Section titled “Troubleshooting”Rust Target Not Found
Section titled “Rust Target Not Found”error: target 'riscv64imac-unknown-none-elf' not foundFix: Install the RISC-V target:
rustup target add riscv64imac-unknown-none-elfLinker Not Found
Section titled “Linker Not Found”error: linker `cc` not foundFix: Install a C toolchain:
# Ubuntu/Debiansudo apt install build-essential
# macOS (Xcode command line tools)xcode-select --installZig Not Found
Section titled “Zig Not Found”zig: command not foundFix: Install Zig or enter devenv shell:
devenv shell# Or install Zig manually: https://ziglang.org/download/Out of Memory During Build
Section titled “Out of Memory During Build”Large workspaces can exhaust memory during parallel compilation.
Fix: Limit parallelism:
cargo build -j 4 # Limit to 4 parallel jobsdevenv Shell Fails
Section titled “devenv Shell Fails”error: getting status of '/nix/store/...': No such file or directoryFix: Rebuild the Nix store:
devenv gc # Garbage collectdevenv shell # Re-enterNext Steps
Section titled “Next Steps”- Quickstart — Run a local node and deploy a contract
- Running a Node — Detailed node operation guide
- Deploying Contracts — Build and deploy smart contracts
- Using the CLI — Complete CLI reference