将 Metamask 连接到 Azure 中的私有区块链

Connecting Metamask to private blockchain in Azure

我正在尝试连接到 Metamask 中的 rpc。 Metamask 一直在尝试连接未知的专用网络。 Geth 运行正在 Linux Azure 网络中。 它的 public IP 是 AzureIP
我 sshing 到服务器,然后我 运行 以下命令:

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

除其他外,我得到以下输出:

HTTP endpoint opened: http://127.0.0.1:8080

我然后运行miner.start()

我尝试通过转到自定义 RPC 并输入地址 http://AzureIP:8080

来连接到 Metamask 中的这个私有网络

它只是闲置在那里。在天蓝色中,我有以下网络入站端口规则

从我自己的笔记本电脑(不是通过 sshed 进入服务器)我然后 运行 命令:

ping http://*AzureIP*:8080  

然后我收到请求超时 icmp_seq ...

我该如何解决这个问题或连接到专用网络的任何建议?

127.0.0.1是循环地址,服务只在VM内部运行。

在您的场景中,您需要在 VM 的私有 IP 上侦听 0.0.0.0 上的服务。您可以添加 --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

我已经以如下格式成功连接到服务器私有链:geth --identity "xxx" --rpc --rpcaddr "0.0.0.0" --rpccorsdomain "*" --datadir /home/xxx --port "30303" --rpcapi "db,eth,personal,net,web3" --networkid xxx --targetgaslimit xxx,你可以试试