Connecting your Wallet to a Monero Node on your Local Network
This post was last edited 5 minutes ago.
I have spent the past week trying to do a relatively simple thing: connect Cake Wallet on my mobile phone to a full Monero node running on a PC on my local network.
I've experimented with Monero before, but this time I wanted to understand what I was doing, rather than just copy and paste terminal commands. I narrowed down my goal to just one thing: connecting my wallet to a node on a local network and understanding how that works.
There are different ways to manage a node, and not everyone has time to explain every detail to someone like me, trying to learn the basics. Guides and articles are good, but some have aged, and the information can be overwhelming.
So I ended up using a local AI chatbot on LM Studio to learn. That was helpful until it began giving me incorrect information.1 Luckily, by then I had learned enough to spot the hallucination. If you're interested in using the Q&A method to learn the basics about networks, I highly recommend leaning on the patience of a chatbot.
Monero Wallet CLI
The information below refers to Monero Wallet CLI. That's the program I used to download, sync and run the node. I'm doing all of this on a Linux computer, with an Ethernet cable connected to my router.
I use Monero Wallet CLI because it is efficient, and I don't need a GUI, because I connect to my Monero PC from my main PC using SSH.
Please see the Monero website for instructions on how to install Monero Wallet CLI and begin syncing your node. The information there is helpful and clear.
These notes are intended for anyone running Monero Wallet CLI on a Debian-based Linux distro on a hardware PC on your local network.
If you don't wish to use SSH to connect to your Monero PC from another computer on the network, you can also just connect a keyboard, mouse and monitor screen to the PC running the node.
All commands described below are run in the terminal.
UFW
UFW stands for uncomplicated firewall. A firewall stops other devices from connecting to your computer. As the administrator, you can use UFW to allow access to specific parts of your PC, for example, so your mobile phone can connect to your Monero node.
To get UFW up and running, you can type sudo ufw enable. This command also ensures UFW starts up each time you reboot your PC. To see if UFW is currently running, type sudo ufw status. It should say 'active'.
What are ports?
A port is a door to a specific section on your PC. While you can search for information online with your PC, the reverse—someone online searching the contents of your PC—should not be possible by default! The firewall helps ensure this is the case and that no ports are open unless you want them to be open.
Ports have numbers, like '18080' or '3333'. You could see those as the numbers on hotel room doors. When you open a port on UFW, you are unlocking that door to your PC.
What is a LAN?
LAN stands for Local Area Network. This information is key to what we are trying to do.
While there are lots of ways you can contribute to the wider Monero network to keep it going, that's not what we are trying to do here today.
As someone not familiar with networking, I want to be able to manage the Monero node just on my local network, at home. This means that when I make mistakes or copy and paste commands I don't fully understand, there is no risk of exposing my PC to the Internet.
At a later stage I hope to learn about safe, compartmentalised ways to share the node and open ports to the web, but, for now, there is nothing wrong with just keeping a Monero node to myself so I can learn.
What is a router?
Your router is the device that your Internet Service Provider installed in your home when you signed up for an Internet connection. It assigns names to all the devices on your Local Area Network (your internet at home), and it enables you to connect the whole web.
When you give someone your home Wi-Fi password, you're letting them to connect to your LAN via your router.
Monero documentation recommends optionally opening up ports on your router, or port forwarding. While this is key to sustaining the Monero network, we are not going to touch the router today. Changing settings on the router is a step for the future, because when you do that, you are opening your front door, rather than just unlocking rooms within your home.
What is an IP address?
The type of IP address we're looking at today is a number that is usually divided into four parts, like this:
127.0.0.1
It might also look like this:
192.168.1.243
The IP address is the name for a connection to a device on your Local Area Network. All your devices are given their own IP number. This is done automatically by your router.
Which IP addresses are important?
127.0.0.1
That is the address that every device gives itself. When you refer to 127.0.0.1, then nothing leaves the device; it's all happening within that computer. This can be useful, for example, when you want to connect the node to a miner or wallet on the same computer.
192.168.x.y
With the command
ip addryou can ask for the IP address that your router has assigned to your computer on the LAN. You'll see a lot of information, but look for the number that starts with 192.168 that is not the address 192.168.0.255. I'm going to call that number '192.168.x.y' for the remainder of this article, but keep in mind that 'x' and 'y' need to be replaced with the specific numbers you see when you run theip addrcommand. You can ignore '/24' at the end of the number.0.0.0.0
This is something I learned about recently. It stands for 'any connection available on this device'. If you have more than one way of connecting your PC to the internet, then 0.0.0.0 can be useful, but I'm going to use the 192.168.x.y number.
The ./monerod command
If you followed in instructions for Monero Wallet CLI, you'll know that you first need to go the directory where it is installed. You need to be in that directory. It might look like this:
/home/yourname/monero-gui-v0.18.4.7
Once you are in that folder, the command to activate the node is ./monderod.
However, we can add more instructions to this command, and we'll need to do that if we want our wallet on our phone to be able to connect to the node.
What are flags?
Flags are extra instructions that can be added to the ./monerod command. They look like this
--rpc-bind-ip
You sometimes need to add extra information, like an IP address or a port, to the flag.
There is an extensive list of flags on the Monero website.
What does RCP mean?
RCP stands for Remote Procedure Call. It is a way for a program to ask another program (in this case, on a different PC) to do something. The device doing the asking is the client, and the device responding to the request is the server.
In our case, Cake Wallet on my mobile phone is the client. It is using RCP to ask the node on my Monero PC how much XMR I have in my wallet today, or to sync to the node.
The wallet sends a JSON message to the node over the local network asking for an update or data. If the right port on the Monero PC is open, then the node (the server) will receive and process that request, and send a small JSON message back to my phone with the requested information, which, in this case, is an up-to-date account of how much I have in that wallet.
For a Monero node, port 18081 needs to be open on the Monero PC (not your router!) in order to send these JSON files back and forth between the client and the server, or your wallet and the node.
What does JSON mean?
JSON stands for JavaScript Object Notation. It's just a type of file containing text information and instructions that easily can be sent over networks.
In our case, the wallet on your phone and the node on your Monero PC will send requests and information back and forth using JSON files.
Opening port 18081 on UFW
For this to happen we need to open that port in the firewall of our Monero node PC by typing
ufw allow 18081/tcp
on that device. This will allow RCP traffic, or, in our case, the sending back and forth of JSON files between your wallet on your phone and the Monero node on your PC.
You can check what's open with the command sudo ufw status and you should now see that port 18081/tcp is set to 'ALLOW' from 'anywhere'.
What does TCP mean?
TCP stands for Transmission Control Protocol. It is a protocol that ensures that the information sent from your phone arrives at the Monero node in good order, without bits being lost, shuffled or duplicated.
A simple command to get started
The command we need to get the connection between our wallet and the node going is
./monerod --rpc-bind-ip 192.168.x.y --confirm-external-bind
where you need to replace 'x' and 'y' with the numbers of your node PC's actual IP address.
Remember that you need to be in the Monero directory on your Monero PC in order for this command to work.
--rpc-bind-ip 192.168.x.y tells the node to use your PC's IP address for sending JSON messages back and forth when RCP requests are made.
--confirm-external-bind is a flag to tell the node that you're sure you want to do it this way. If you don't add this flag, you'll get this error message:
[[ERROR] You are trying to bind RPC on an external address. Please confirm that you really want this.]
Checking that it works
You can of course check that everything is working with Cake Wallet, but you can also go to a browser on any device that is on your local network and type
http://192.168.x.y:18081/get_height
(where again you need to replace 'x' and 'y' with the actual numbers of your node PC's IP address) and you should see a JSON message that says something like
{"status":"OK","height":123456}
Connecting Cake Wallet to your node
To connect Cake Wallet on your mobile device (or another PC) to your Monero PC on the local network, you first need to add that node in Cake Wallet.
Open Cake Wallet, go a Monero wallet, and click on the Settings cog icon (in the upper right-hand corner at time of writing). Select 'Nodes' and press the '+' symbol, and enter the following information
| Node address | 192.168.x.y |
| Node port | 18081 |
Mark the node as trusted, but don't select 'Use SSL' and save the node.2
It should now appear in your list of accessible nodes in Cake Wallet with a green light in front of it. Select it, and your Monero wallet should start updating!
What if I have a VPN?
If you run a VPN on your devices, you may need to go into the settings of your VPN app and allow Local network sharing. This allows computers and phones to connect to other devices (printers, Monero nodes) on your LAN.
About the screen command in Linux
Whether you connect to your Monero PC from another PC via SSH, or just attach a mouse, keyboard and monitor screen directly to the PC, you can use the Linux command screen to run the Monero node (and later P2Pool and mining) in the background. I highly recommend learning about screen.
Concluding remarks
This is a verbose guide to connecting Cake Wallet on a mobile device to a physical computer running the full Monero node on the same network.
This same information is out there in a much more concise form, but I've written this guide for someone like me, someone who is learning. The problem that occurs when reading the existing guides is that when jargon and acronyms like RCP, TCP and JSON start stacking up, and if I haven't checked what each of these things mean, I feel like I don't understand what I'm reading anymore.
This past week, I took meticulous notes about every 'dumb' question I had, and with the help of LM-Studio, got the bottom of the acronyms. I hope the above is useful for others.
Monero is a hopeful project. I hope XMR never becomes illegal to mine or use. I am aware there are other ways of doing what I describe above (one forum member suggested I use 0.0.0.0 instead of 192.168.x.y), but as I only have one connection on my Monero PC—the Ethernet cable—the above method works for me.
I also know that some Monero purists won't approve of recommending not opening the node to the wider network by opening port 18080 on your router, but I strongly believe it's important to take small steps when you're learning. It's better to take a small step and know what it is you are doing, than to copy a bunch of instructions and hope for the best. This is also true in the case of trouble-shooting. One of my biggest frustrations with how I ran the node before is that I never understood what was wrong when, for example my wallet wouldn't sync anymore. I think I have a much better idea of the mechanics of that part now.
Documentation
Monero: lan node shows red when "use ssl" checked
-----Discuss on Mastodon-----
Find me on Mastodon.
It insisted port 18080 is now just legacy, and that 18082 is the new port everyone uses for peer-2-peer connections today.↩
There is a bug that results in the local node having a red light next to it when you try to connect over SSL. It is a bug because the wallet will still connect and sync, but the light stays red. Thanks to Privacy Guides forum user "ofrnxmr" for pointing this out and also helping me with a few other things.↩