📔
Liberland Wiki
  • 📖Public Documents
  • 👍Primers
    • 🙋‍♀️Congress
    • 💂Executive
    • 👨‍⚖️Judiciary
    • 🤴Senate
  • 🚦Regulations
    • ✍️Drafts
      • 👮Internal Regulation of the Security Commission on the Structural and Functional Organization of the
    • 👩‍⚖️In Force
      • 🏰Orders
        • 👨Order of the President of Liberland no. 1/2021, on the Decisions of the Cabinet.
        • 👩Order of the President of Liberland no. 2/2021, on the Interim Legislature
  • ✅Policies
    • 🧑‍⚖️In Force
      • ⚖️Justice
        • 🔏Privacy policy
  • 👨‍💻Blockchain
    • 💫White Paper
    • 👨Tokenomics Primer
    • 💫Roadmap
    • 👨API
      • ⌨️Chain Explorer API
      • For CEXes
    • 🌐Ecosystem
      • 🌉How to Bridge to Ethereum
      • 🌉How to Bridge to Solana
      • How to Bridge to TRON
      • 🔁Liberland Exchange
      • How to Acquire LLD
      • How to Use Polkadot.js
      • How to use SubWallet
      • How to use Talisman
      • Known Issues
    • 🪪For Citizens and E-Residents
      • 🗳️Voting
      • Senate
      • Onboarding
      • Claiming Residency
      • Congress
      • Governance
      • Companies
    • 🖥️For Validators, Nominators & Stakers
      • Run a validator
      • Non-technical run a validator
      • Staking
      • ETH Liquidity Staking
      • SOL Liquidity Staking
      • Update node
      • Resync node
    • For Developers & Testers
      • Build, run & test using source code
      • Run in Docker
      • Manual testing guide
      • Runtime upgrade
      • Rust API docs
      • Bootstrapping new testnet
      • Chain Crash Recovery Procedure
  • Media
    • Press Kit
Powered by GitBook
On this page
  • Install dependencies
  • Fetch latest source code
  • Minimum requirements
  • Build the node
  • Run and interact with development instance
  • Run automated tests
  1. Blockchain
  2. For Developers & Testers

Build, run & test using source code

PreviousFor Developers & TestersNextRun in Docker

Last updated 1 year ago

This guide will walk you through:

  • building the blockchain node from source code,

  • running a local development instance, which spawns a new single-node testnet,

  • interacting with development instance,

  • running automated tests.

Install dependencies

For Ubuntu & Debian derivatives:

sudo apt update
sudo apt install build-essential git clang curl libssl-dev llvm libudev-dev make protobuf-compiler pkg-config

Next install Rust itself. Run and follow prompts:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup default stable

And install WASM target:

rustup target add wasm32-unknown-unknown

See for detailed guide and other platforms.

Fetch latest source code

Development of Liberland Blockchain Node happens in two branches:

  • main, which contains latest stable release

  • develop, which contains latest, not yet released as stable changes

To fetch source code, run the following (you may replace main with develop if desired):

git clone https://github.com/liberland/liberland_substrate.git -b main
cd liberland_substrate

Minimum requirements

Build the node

To build the node, run:

cargo build --release

Note that this will likely take a long time. If everything goes correctly, you'll see:

    Finished release [optimized] target(s)

And will be able to run the node using built executable (output might differ slightly):

user@machine:~/liberland_substrate$ ./target/release/substrate --version
substrate 3.0.0-dev-41cd30e9e7d

Run and interact with development instance

To run a development instance of Liberland node, execute:

cargo run --release -- --dev

Run automated tests

Liberland Blockchain node is comprehensively covered with automated unit tests. To run them, execute:

cargo test --features runtime-benchmarks

As these typically take a long time, you can also choose to run tests only for specific pallets. Here's example for the legislation pallet:

cargo test --features runtime-benchmarks -p pallet-liberland-legislation --lib

Make sure you have at least 4 GB of RAM available. If you dont, add whats missing to swap. Note that this will fix some out of memory build errors, but will significantly prolong the build.

Development instance is a single-node testnet, in which standard development accounts (Alice, Bob, etc.) are endowed with assets. To interact with it, visit .

👨‍💻
Substrate docs
Adding swap for ubuntu
Polkadot.js Apps