Prerequisites
System Dependencies
Before building Avail, ensure you have the required system packages installed:Rust Toolchain
Avail requires a specific Rust version as defined inrust-toolchain.toml.
Verify Installation
The project uses Rust 1.82.0 with the following components:
rustfmt- Code formattingclippy- Lintingrust-src- Source code for the standard librarywasm32-unknown-unknowntarget - WebAssembly compilation
rust-toolchain.toml:Avail is built on the Substrate framework and uses Polkadot SDK version polkadot-1.7.1-patch-13.
Building the Node
Development Build
For development and testing, build without optimizations:target/debug/avail-node.
Release Build
Build an optimized production binary:--locked flag ensures dependencies match Cargo.lock exactly. The binary will be at target/release/avail-node.
Building Specific Packages
Build only the node binary without workspace dependencies:Build Features
Avail supports several conditional compilation features:Runtime Benchmarks
Enable runtime benchmarking capabilities:Try Runtime
Enable the try-runtime feature for testing runtime migrations:Fast Runtime
For development and testing, use a faster block time:The
fast-runtime feature is required when running E2E tests.Combined Features
Build with multiple features:Build Optimization
Using sccache
Speed up rebuilds by caching compilation artifacts with sccache:Skipping WASM Build
For faster iteration during development, skip WebAssembly runtime compilation:Workspace Structure
The Avail repository is organized as a Cargo workspace with these key members:node/- Node implementation and CLIruntime/- Blockchain runtime logicpallets/- Custom pallets (dactr, mandate, system, vector)base/- Core primitives and utilitiesclient/basic-authorship/- Block authorshiprpc/- RPC implementations (kate-rpc, testing-rpc)e2e/- End-to-end tests
Build Profiles
Development Profile
The development profile includes optimizations for cryptographic dependencies:Release Profile
Release builds use:- Panic strategy:
unwind(required by Substrate runtime) - Optimization level: 3 (maximum)
- LTO: Disabled by default (can be enabled for smaller binaries)
Troubleshooting
Linker Errors
If you encounter linker errors, ensure you have the required development packages:Out of Memory
If compilation fails due to memory constraints, limit parallel jobs:Protobuf Errors
Ensure protobuf compiler is installed:OpenSSL Errors
On some systems, you may need to explicitly set OpenSSL paths:Next Steps
Running Tests
Learn how to run unit, integration, and E2E tests
Contributing
Guidelines for contributing to Avail