How to run the Nimiq Rust node on Android

How to run the Nimiq Rust node on Android

Mat

I tried it with Android 9, can't guarantee it will work with previous versions.

To make things easier I'd recommend running the SSH server from Termux and doing the rest remotely from your desktop. Follow the instructions to setup the server: https://wiki.termux.com/wiki/Remote_Access#OpenSSH


  • Ensure everything is up-to-date
pkg upgrade
  • Install necessary packages
pkg install -y pkg-config openssl-tool git wget nano
  • Install Rust
pkg install -y rust
  • Add Rust nightly
pkg install -y unstable-repo
pkg install -y rustc-nightly
  • Clone the Nimiq repo
git clone https://github.com/nimiq/core-rs.git nimiq-rs/
cd nimiq-rs/
  • Prepare the environment
# use Rust nightly
export RUSTC=$PREFIX/opt/rust-nightly/bin/rustc
# Android lacks robust mutex support
export CFLAGS=-DMDB_USE_ROBUST=0
  • Apply ARM patch
sed -i s/opt\.c/ref\.c/ libargon2-sys/build.rs
wget -O libargon2-sys/native/ref.c https://github.com/nimiq/core-js/raw/master/src/native/ref.c
  • Build and install the client
cargo build --release
cargo install --path client/
  • Add Cargo binaries to your path (put to .profile to make changes permanent)
export PATH="$HOME/.cargo/bin:$PATH"
  • Prepare the configuration
cd ~
mkdir .nimiq
cp nimiq-rs/client/client.example.toml .nimiq/client.toml
nano .nimiq/client.toml

Change the host parameter to match your IP address (or a domain name if you have one), save and exit.

  • Run the client
nimiq-client

It will start synchronizing, the process will take several hours or more depending on your network speed.