Android Node: Arch Linux via proot (RocksDB/UTXO Mode)#
This guide details the more advanced method for running an Ergo node on Android using an Arch Linux environment within Termux via proot. This method is necessary if you need to run the node with stateType="utxo" (which uses RocksDB for state storage) or if you encounter database issues (e.g., LevelDB failures) with the direct Termux setup.
Why is this needed?
- The Ergo node uses database engines (LevelDB by default, RocksDB as an option, especially for
stateType="utxo") to store blockchain state. - The Java bindings for RocksDB often rely on the standard GNU C Library (
glibc). - Android/Termux typically use a different C library (
musl libcvia Bionic). - Running the RocksDB-enabled node JAR directly in Termux can lead to incompatibility errors.
proot-distroallows running a Linux distribution (like Arch Linux, which usesglibc) within Termux, providing the necessary environment for RocksDB.
Disclaimer: This is a more complex setup than the direct Termux method and adds overhead. It's primarily required for specific use cases needing RocksDB/UTXO mode. For most mobile users, the direct Termux setup with stateType="digest" is recommended.
Prerequisites:
- Android device meeting the requirements (Note: UTXO mode requires significantly more storage than digest mode).
- Termux installed from F-Droid.
Steps:
- Install
proot-distroin Termux: * Open Termux and run:pkg update && pkg upgrade -y pkg install proot-distro -y - Install Arch Linux via
proot-distro:* This will download the Arch Linux root filesystem.proot-distro install archlinux - Login to Arch Linux Environment:
* Each time you want to run the node using this method, you first need to log into the Arch environment:
* Your terminal prompt should change, indicating you are now inside Arch Linux within Termux.
proot-distro login archlinux - Inside Arch Linux: Install Dependencies (First Time Only):
* Update package lists:
* Install Java (OpenJDK 17 recommended),
pacman -Syu --noconfirmwget, andnano:pacman -S jdk-openjdk wget nano --noconfirm - Inside Arch Linux: Download RocksDB Ergo Node JAR:
* You must download the JAR variant specifically built with RocksDB support. Find the correct
.jarfile (often namedergo-<version>-rocksdb.jar) on the Ergo Releases page. * Get the download URL for the specific RocksDB JAR you need. * Usewgetto download it within the Arch environment:# Example (replace URL with the actual RocksDB JAR URL): ROCKSDB_JAR_URL="https://github.com/ergoplatform/ergo/releases/download/vX.Y.Z/ergo-X.Y.Z-rocksdb.jar" echo "Downloading RocksDB Ergo node JAR from: $ROCKSDB_JAR_URL" wget -q --show-progress "$ROCKSDB_JAR_URL" -O ergo-rocksdb.jar - Inside Arch Linux: Create Configuration File (
ergo.conf): * Create the file usingnano:* Paste a configuration suitable fornano ergo.confstateType="utxo"with pruning (adjustblocksToKeepbased on your storage capacity):* Save (ergo { node { stateType = "utxo" // Use UTXO state with RocksDB // Keep ~1 week of blocks (~3-5GB?), adjust based on storage // WARNING: -1 (archival) is likely impractical on mobile storage blocksToKeep = 10080 mining = false # Enable faster bootstrapping (both recommended) nipopow.nipopowBootstrap = true utxoBootstrap = true } } scorex { restApi { apiKeyHash = "324dcf027dd4a30a932c441f365a25e86b173defa4b8e58948253471b81b72cf" // Example, change this } network { # Optional: Add known reliable peers # knownPeers = ["ip:port", "ip:port"] } }CTRL+O,Enter) and Exit (CTRL+X). - Inside Arch Linux: Launch the Node:
* Run the RocksDB JAR, allocating sufficient memory (UTXO mode generally needs more than digest mode):
* (Adjust
java -Xmx2G -jar ergo-rocksdb.jar --mainnet -c ergo.conf-Xmx2Gbased on your device's available RAM. You might need more or less). - Monitor Synchronization:
* Open a web browser on your Android device and go to
http://127.0.0.1:9053/panel. * Synchronization, especially the initial UTXO snapshot download, will take time and consume significant storage.
Exiting: To stop the node, press CTRL + C in the Arch Linux terminal. To exit the Arch Linux environment back to the main Termux shell, type exit.
Refer back to the main Android guide for general tips, disk space clarification, and troubleshooting. Remember this method adds complexity and resource overhead compared to the direct Termux approach.