Running an Ethereum node on a phone

Whenever you are using a cryptocurrency to transact with someone, you are trusting the node to provide you with correct details and properly executing the trade. When using Metamask, by default you use the Ethereum node provided by infura. In general they are not rogue and will not 'scam' you, but for several reasons you might want to run your own node.

Ethereum coin on computer (decor image)

These reasons:

'Solution'

Just run your own node. This unfortunately is quite difficult for most people. Ethereum requires 500 GB+ in storage, good internet connection and a decent machine. People don't have that nor do they carry it with them. Ethereum hence provides an option with its geth client called “light” sync mode. A light node basically, stores the headers of all blocks. It can verify the validity all of the data against the roots in the chain. For everything else (like requesting data, sending a transaction, executing a smart contract, signing a transaction, etc) it contacts a full node and asks the node to do it for you. If a node goes rogue, then based on the changes of Merkle tree, it will invalidate the chain.

This basically provides you with ability to personally verify whatever these node providers are saying, with several sources of information and use the chain. With zK-SNARKS this could be taken to a whole new trustless model, which is already being researched on.

You can simply run a light node on your PC, without a lot of problem. But, what if you run it on your phone...

Running Ethereum light node on an android phone

# Installing openSSH
pkg install openssh

# Get the username
whoami

# Setup a password
passwd

# Get IP address of your phone 
ifconfig

# Run openSSH server
sshd

# It will be running and accessible on <ip-address>:8022 by default

geth will start syncing the node, although it won't take time and will consume way less space. You can now add http://127.0.0.1:8545 as a new RPC endpoint on your Metamask app on phone. One could also use something like fast reverse proxy to access it remotely by tunneling it via a VPS.

ummm...

Here you are still trusting the nodes from where your light node is syncing data from to provide you with correct data. Very often then not only a few nodes will be shown connected and those which you are syncing with. So verifying the state is still important, but this reduces the chances of any of above mentioned problems.

#crypto #tutorial Thanks to Krish and Aryan for helping with this post.


If you found any typo, wanna reach out, or get in touch – Please email me at hi@vimarsh.info