Search code examples
azureazure-virtual-machineethereumgethmetamask

Connecting Metamask to private blockchain in Azure


I'm trying to connect to rpc in Metamask. Metamask keeps idling in the trying to connect unknown private network. Geth is running in a Linux Azure network. Its public IP is AzureIP
Im sshing into the server, then I run the following command:

geth --identity “TestNode” --rpc --rpcport "8080" --rpccorsdomain "*" --datadir testprivareDir --port "30303" --nodiscover --rpcapi "db,eth,net,web3" --networkid 1999 console

I get the following output among other things:

HTTP endpoint opened: http://127.0.0.1:8080

I then run miner.start()

I try to connect to this private network in Metamask by going to custom RPC and putting the address http://AzureIP:8080

And it just idles there. In azure I have the following network inbound port rules enter image description here

From my own laptop (not sshed into the server) I then run the command:

ping http://*AzureIP*:8080  

And I get Request timeout for icmp_seq ...

How can I fix this or any advice to connect to the private network?


Solution

  • 127.0.0.1 is a loop address, the service only works inside VM.

    On your scenario, you need listen the service on 0.0.0.0 on VM's private IP. You could add --rpcaddr "10.0.0.4".

    geth --identity “TestNode” --rpc --rpcport "8080" --rpcaddr "10.0.0.4" --rpccorsdomain "*" --datadir testprivareDir --port "30303" --nodiscover --rpcapi "db,eth,net,web3" --networkid 1999 console