CryptoGrampy / android-termux-monero-node

Run a Low Power Monero Node on Android through Termux
51 stars 11 forks source link
android monero monero-node shell termux xmr

Monerod-in-Termux

Run a Monero Node on Android using Termux

Monero Node Status in Android Notifications

Table of Contents

Background

The goal of this project is to give newbs a stupid-easy way to run an energy-efficient, full or pruned Monero node on Android.

Ideally, this is an older device that's currently sitting in a drawer, doing nothing.
Why not set it up as a Monero node?

Battery Life

Data Usage

Running a Monero node allows you to connect your wallet (Feather, CakeWallet, Monerujo etc) to your node. While Monero is private, using a remote node (one operated by a 3rd party) involves some level of trust. A remote node receives certain information from you, such as the date, time of a tx and the IP that sent it to the node.
Running a node on Android is an easy and more decentralized way to both use and improve Monero and the Monero network.

TLDR / Install

Prerequisites:

- Android 7.0+ with ARMv8/v7 architecture
  - The script will check the architecture before running
- 50GB min free space (64GB+ Recommended) for Pruned node
- 150GB min free space (256GB+ Preferred) for Full Node
- External Storage is recommended.

Steps:

  1. Install the F-Droid App Store

  2. Install these Apps from F-Droid:

    (Do NOT install from Play store. If any of these are already installed from gplay, uninstall them)

  3. Set app permissions:

    Go to:

    1. Android Settings > search for ”Special Access"
    2. Select "Battery Optimization" > All Apps Then disable battery optimization for
      • Termux
      • Termux:Boot
    3. Return to "Special Access" screen
    4. Select "Draw over other apps" Enable draw over apps aka draw on top for:
      • Termux
  4. In termux, issue the command

    sh -c "$(curl -fsSL https://github.com/CryptoGrampy/android-termux-monero-node/raw/main/src/install-monerod-in-termux.sh)" 
  5. Follow the prompts.

    All Users:

    Press Y when/if asked to use package maintainers version of sources.list

  6. Add the 2x2 Termux widget to your home screen.

  7. SUCCESS

NOTE: YOU WILL NOT BE ABLE TO TRANSACT UNTIL YOUR NODE IS 100% SYNCED.

Extras

  1. Run on Boot: Open the "Termux:Boot" app (once).
  2. Run in Fore/Background: "Stop" then "Start" the node from widget.
  3. Connect to your Node: Wallet Connections.
  4. Enable P2P seeding (distributing) of the Blockchain Forwarding P2P (seeding) port.

More info on running a Monero Node:

https://www.reddit.com/r/Monero/comments/kkr04n/infographic_running_a_node_which_ports_should_i/ https://www.reddit.com/r/Monero/comments/kkgly6/message_to_all_monero_users_we_need_more_public/ https://www.reddit.com/r/Monero/comments/ko0xd1/i_put_together_a_new_guide_for_running_a_monero/

WARNINGS...

  1. Ideally you should store the blockchain on external storage (MicroSD etc). Regardless of whether the blockchain is stored on SD or Internal.. You should run this AT YOUR OWN RISK and READ THE CODE. Feel free to make or suggest improvements.

  2. Monero is mostly writes and reads - not rewrites - which are what kill storage the fastest.

  3. You may risk your data or the lifespan of your microSD / Internal storage may be shortened.

    It is recommended to backup before running, and preferably to run on a dedicated / spare / old device.

  4. Do NOT forward port 18081 (the UNRESTRICTED RPC port)

Controls Overview

Using the Termux Widget, you can: 'Start XMR Node' (foreground or background), 'Stop XMR Node', 'Update XMR Node', and check the 'XMR Node Status'.

From the notification, you can: Shutdown the node, release/acquire wakelock and refresh the notification.

The notification will be automatically be updated every 15 minutes.

Connecting to your Node / Seeding the Network

Following are a few ip addresses and ports to make note of.

Wallet Connections

NOTE: YOU WILL NOT BE ABLE TO TRANSACT UNTIL YOUR NODE IS 100% SYNCED.

Wallet relationship to node: IP: Port: (Why?) Forward?
The same device 127.0.0.1 18081 (Unrestricted RPC Port) Yes
Different devices on the same local network Check Notification 18089 (Restricted RPC Port) No
Different devices on seperate networks Public / Internet facing IP. Search DuckDuckGo for ”my ip" 18089 (Restricted RPC Port) Yes

These are the default ports set in the config file. You can edit the config file (located at crypto/monero-cli). Here is a nice Monerod reference guide

P2P Seeding

If you want to seed (help distribute) the Monero network (Recommended) Port: (Why?) Forward?
18080 (P2P Port) Yes

The process for port forwarding may vary slightly depending on the router used. If you DuckDuckGo "port forwarding" and add the name / brand of your router, you should find a guide.

Example:

If you decide, for whatever reason, that you want to stop seeding the network, simply stop forwarding port 18080 in your router/remove the port forwarding rule.

Troubleshooting:

Updates

TODO's:

Donate:

If you enjoy this software, please feel free to send a tip to: