I posted this issue to the MetaMask Mobile github, but perhaps the community here will be able to provide some insight.
Describe the bug
I have a Expanse Node running on my desktop computer. The node listens on the machines local I-Pv4 Address 192.168.1.2:8545 Chain ID 1998 (“0x7ce”) I can add the local RPC through the non-localhost endpoint in the browser extension just fine as you see in the picture, and MetaMask Mobile plays nice with Expanse’s mainnet RPC which runs the same node version I am using for my test net.
So when I launched my local private test net I got on my phone which is connected to the same network @192.168.1.5
In the node flags and enter:
Expanse Test Net
http192.168.1.2:8545
0x7ce
-blank-
It claims that it cannot fetch the Chain ID.
This lead me to believe possibly my phone cannot access the JSON RPC endpoint, so, I opened up a http1.1 request app on my phone and requested the Chain ID from the node successfully using the same endpoint entered in MetaMask Mobile, and was able to see the inbound connections in the logs of my node from doing so. This proves that my node will reply proper requests from the device that is acting like it cannot connect.
However if I try to connect to this endpoint in MetaMask Mobile I get the error cannot fetch chain id. Now because the chain ID is 0x7ce (1998) I then decided to try it in hex as when I made the http request from the app it returned a chain ID of “0x7ce” which is expected. The problem still persists.
Ultimately when I checked my node logs after spamming a few Add RPC button clicks… The node never received the requests as there aren’t any logged.
Here is what my node outputs into logs upon starting:
DEBUG[11-07|11:17:26.296] Sanitizing Go’s GC trigger percent=50
INFO [11-07|11:17:26.298] Maximum peer count ETH=0 LES=0 total=0
DEBUG[11-07|11:17:26.298] FS scan times list=0s set=0s diff=0s
TRACE[11-07|11:17:26.298] Handled keystore changes time=0s
INFO [11-07|11:17:26.343] Starting peer-to-peer node instance=Gexp/v1.9.10-stable-d57c0cd6/windows-amd64/go1.13.6
INFO [11-07|11:17:26.343] Allocated trie memory caches clean=512.00MiB dirty=512.00MiB
INFO [11-07|11:17:26.343] Allocated cache and file handles database=P:\Expanse-Test-Net-Datadir\gexp\chaindata cache=1024.00MiB handles=8192
DEBUG[11-07|11:17:26.654] Chain freezer table opened database=P:\Expanse-Test-Net-Datadir\gexp\chaindata\ancient table=receipts items=0 size=0.00B
DEBUG[11-07|11:17:26.677] Chain freezer table opened database=P:\Expanse-Test-Net-Datadir\gexp\chaindata\ancient table=diffs items=0 size=0.00B
DEBUG[11-07|11:17:26.679] Chain freezer table opened database=P:\Expanse-Test-Net-Datadir\gexp\chaindata\ancient table=headers items=0 size=0.00B
DEBUG[11-07|11:17:26.689] Chain freezer table opened database=P:\Expanse-Test-Net-Datadir\gexp\chaindata\ancient table=hashes items=0 size=0.00B
DEBUG[11-07|11:17:26.691] Chain freezer table opened database=P:\Expanse-Test-Net-Datadir\gexp\chaindata\ancient table=bodies items=0 size=0.00B
INFO [11-07|11:17:26.691] Opened ancient database database=P:\Expanse-Test-Net-Datadir\gexp\chaindata\ancient
DEBUG[11-07|11:17:26.691] Current full block not old enough number=0 hash=727fd5…92ae81 delay=90000
INFO [11-07|11:17:26.692] Initialised chain configuration config=“{ChainID: 1998 Homestead: 0 DAO: DAOSupport: false EIP150: 0 EIP155: 0 EIP158: 0 Byzantium: 0 Constantinople: 0 Petersburg: 0 Istanbul: 0, Muir Glacier: , Engine: unknown, PirlGuard: 0}”
INFO [11-07|11:17:26.692] Disk storage enabled for ethash caches dir=P:\Expanse-Test-Net-Datadir\gexp\ethash count=3
INFO [11-07|11:17:26.692] Disk storage enabled for ethash DAGs dir=C:\Users\Keith\AppData\Local\Ethash count=2
INFO [11-07|11:17:26.692] Initialising Expanse protocol versions=“[64 63]” network=1998 dbversion=7
INFO [11-07|11:17:26.692] Loaded most recent local header number=5 hash=061fd5…2d73cf td=788995 age=37m25s
INFO [11-07|11:17:26.692] Loaded most recent local full block number=0 hash=727fd5…92ae81 td=131072 age=53y7mo1w
INFO [11-07|11:17:26.692] Loaded most recent local fast block number=5 hash=061fd5…2d73cf td=788995 age=37m25s
DEBUG[11-07|11:17:26.692] Reinjecting stale transactions count=0
INFO [11-07|11:17:26.692] Loaded local transaction journal transactions=0 dropped=0
INFO [11-07|11:17:26.693] Regenerated local transaction journal transactions=0 accounts=0
WARN [11-07|11:17:26.693] Switch sync mode from full sync to fast sync
INFO [11-07|11:17:26.702] Allocated fast sync bloom size=1024.00MiB
INFO [11-07|11:17:26.702] Initialized fast sync bloom items=0 errorrate=0.000 elapsed=0s
DEBUG[11-07|11:17:26.703] Recalculated downloader QoS values rtt=20s confidence=1.000 ttl=1m0s
DEBUG[11-07|11:17:26.864] TCP listener up addr=[::]:42786
DEBUG[11-07|11:17:26.864] InProc registered namespace=admin
DEBUG[11-07|11:17:26.864] InProc registered namespace=admin
DEBUG[11-07|11:17:26.864] InProc registered namespace=debug
DEBUG[11-07|11:17:26.864] InProc registered namespace=web3
DEBUG[11-07|11:17:26.864] InProc registered namespace=eth
DEBUG[11-07|11:17:26.864] InProc registered namespace=eth
INFO [11-07|11:17:26.864] New local node record seq=20 id=ee1bd34bf1a7a4b2 ip=127.0.0.1 udp=0 tcp=42786
DEBUG[11-07|11:17:26.864] InProc registered namespace=eth
INFO [11-07|11:17:26.864] Started P2P networking self=“enode://de1c6014835f9f213ad27a3e489263a381f36c762262448876b6b7598678f6f6f59a40a5f0e80701a929ca3f7c42a376d5ef87d5e5b772678edf6a7b6a1dfa06@127.0.0.1:42786?discport=0”
DEBUG[11-07|11:17:26.865] InProc registered namespace=txpool
DEBUG[11-07|11:17:26.865] InProc registered namespace=debug
DEBUG[11-07|11:17:26.865] InProc registered namespace=debug
DEBUG[11-07|11:17:26.865] InProc registered namespace=eth
DEBUG[11-07|11:17:26.865] InProc registered namespace=personal
DEBUG[11-07|11:17:26.865] InProc registered namespace=eth
DEBUG[11-07|11:17:26.865] InProc registered namespace=ethash
DEBUG[11-07|11:17:26.865] InProc registered namespace=eth
DEBUG[11-07|11:17:26.865] InProc registered namespace=eth
DEBUG[11-07|11:17:26.865] InProc registered namespace=eth
DEBUG[11-07|11:17:26.865] InProc registered namespace=miner
DEBUG[11-07|11:17:26.865] InProc registered namespace=eth
DEBUG[11-07|11:17:26.865] InProc registered namespace=admin
DEBUG[11-07|11:17:26.865] InProc registered namespace=debug
DEBUG[11-07|11:17:26.865] InProc registered namespace=debug
DEBUG[11-07|11:17:26.865] InProc registered namespace=net
DEBUG[11-07|11:17:26.865] InProc registered namespace=exp
DEBUG[11-07|11:17:26.865] InProc registered namespace=exp
DEBUG[11-07|11:17:26.865] InProc registered namespace=exp
DEBUG[11-07|11:17:26.865] InProc registered namespace=exp
DEBUG[11-07|11:17:26.865] IPC registered namespace=admin
DEBUG[11-07|11:17:26.865] IPC registered namespace=admin
DEBUG[11-07|11:17:26.865] IPC registered namespace=debug
DEBUG[11-07|11:17:26.865] IPC registered namespace=web3
DEBUG[11-07|11:17:26.865] IPC registered namespace=eth
DEBUG[11-07|11:17:26.865] IPC registered namespace=eth
DEBUG[11-07|11:17:26.865] IPC registered namespace=eth
DEBUG[11-07|11:17:26.865] IPC registered namespace=txpool
DEBUG[11-07|11:17:26.865] IPC registered namespace=debug
DEBUG[11-07|11:17:26.865] IPC registered namespace=debug
DEBUG[11-07|11:17:26.865] IPC registered namespace=eth
DEBUG[11-07|11:17:26.865] IPC registered namespace=personal
DEBUG[11-07|11:17:26.865] IPC registered namespace=eth
DEBUG[11-07|11:17:26.865] IPC registered namespace=ethash
DEBUG[11-07|11:17:26.865] IPC registered namespace=eth
DEBUG[11-07|11:17:26.865] IPC registered namespace=eth
DEBUG[11-07|11:17:26.865] IPC registered namespace=eth
DEBUG[11-07|11:17:26.865] IPC registered namespace=miner
DEBUG[11-07|11:17:26.865] IPC registered namespace=eth
DEBUG[11-07|11:17:26.865] IPC registered namespace=admin
DEBUG[11-07|11:17:26.865] IPC registered namespace=debug
DEBUG[11-07|11:17:26.865] IPC registered namespace=debug
DEBUG[11-07|11:17:26.865] IPC registered namespace=net
DEBUG[11-07|11:17:26.865] IPC registered namespace=exp
DEBUG[11-07|11:17:26.865] IPC registered namespace=exp
DEBUG[11-07|11:17:26.865] IPC registered namespace=exp
DEBUG[11-07|11:17:26.866] IPC registered namespace=exp
INFO [11-07|11:17:26.866] IPC endpoint opened url=\.\pipe\gexp.ipc
DEBUG[11-07|11:17:26.866] HTTP registered namespace=debug
DEBUG[11-07|11:17:26.866] HTTP registered namespace=web3
DEBUG[11-07|11:17:26.866] HTTP registered namespace=eth
DEBUG[11-07|11:17:26.866] HTTP registered namespace=eth
DEBUG[11-07|11:17:26.866] HTTP registered namespace=eth
DEBUG[11-07|11:17:26.866] HTTP registered namespace=debug
DEBUG[11-07|11:17:26.866] HTTP registered namespace=debug
DEBUG[11-07|11:17:26.866] HTTP registered namespace=eth
DEBUG[11-07|11:17:26.866] HTTP registered namespace=personal
DEBUG[11-07|11:17:26.866] HTTP registered namespace=eth
DEBUG[11-07|11:17:26.866] HTTP registered namespace=eth
DEBUG[11-07|11:17:26.866] HTTP registered namespace=eth
DEBUG[11-07|11:17:26.866] HTTP registered namespace=eth
DEBUG[11-07|11:17:26.866] HTTP registered namespace=eth
DEBUG[11-07|11:17:26.866] HTTP registered namespace=debug
DEBUG[11-07|11:17:26.866] HTTP registered namespace=debug
DEBUG[11-07|11:17:26.866] HTTP registered namespace=net
INFO [11-07|11:17:26.866] HTTP endpoint opened url=http192.168.1.2:8545 cors=* vhosts=*
TRACE[11-07|11:17:27.243] Accepted RPC connection conn=\.\pipe\gexp.ipc
DEBUG[11-07|11:17:27.245] Served eth_syncing reqid=8393419984563830 t=0s
DEBUG[11-07|11:17:28.243] Served eth_syncing reqid=8393419984563831 t=0s
DEBUG[11-07|11:17:28.964] Couldn’t add port mapping proto=tcp extport=42786 intport=42786 interface=“UPnP or NAT-PMP” err=“no UPnP or NAT-PMP router discovered”
To Reproduce
Steps to reproduce the behavior
- Launch GEXP 1.9.10 with following flags
[ '--ipcpath ' + "gexp.ipc", '--allow-insecure-unlock', '--syncmode full', '--verbosity 5', '--cache=1048', '--datadir '+ Datadir, '--maxpeers 0','--rpc', '--rpcapi web3,eth,debug,personal,net',"--rpccorsdomain='*'",'--rpcaddr "192.168.1.2"',"--rpcvhosts='*'", '--rpcport 8545', '--networkid 1998', '--nodiscover','--miner.threads 1','--miner.etherbase 0xb670bb2c3f4929125334908a54d3d9e4fc47a4db','2>testnet-log.log']
- Replace --rpcaddr with your machine’s I-Pv4 address the node is running on.
- Open MetaMask Mobile
- Add Custom RPC:
Expanse Test Net <— name
http192.168.1.2:8545<— endpoint (replace with the same address you put in --rpcaddr flag
0x7ce <---- lowercase hex of chain Id (The error happens if 1998 or hex version)
- Get could not fetch Chain ID error.
Expected behavior
I expect that I should be able to connect to my private test net with MetaMask Mobile as long as my phone is connected to the same network as the private test net
Smartphone (please complete the following information):
- Device: Samsung S22 Ultra
- OS: Android
- App Version v5.9.0