6

我在 web3 提供程序 (localhost:8545) 上运行时出错

Not possible to connect to the Web3 provider. Make sure the provider is running and a connection is open (via IPC or RPC).

所以我想出如下。

我在本地运行 geth,并提供了一些连接 remix 和 testnet 的选项。

$ geth —testnet —rpc —rpcapi “db, net, web3, personal” —rpccorsdomain “https://remix.ethereum.org” console

我给了 -rpccorsdomain 因为混音是在 https 上。

无论如何,请检查 remix IDE 中“运行”选项卡上的“web3 证明者”。

然后,将地址修改为“ http://127.0.0.1:8545 ”而不是“ http://localhost:8545 ”。

我不知道为什么,但是当我这样修复时它仍然有效。我做了我的帐户并做了一些事情。

但是,由于某种原因,我不得不再次重新下载 geth。(我已经改变了我的电脑)。我现在正在同步块。我认为同步尚未完成,因为 blockNumber 为 0。

> eth.blockNumber
0

所以...我现在正在等待,但我想知道当 eth.syncing 未完全完成时可能会发生错误。

4

6 回答 6

9

HTTPS 不允许您连接到在 HTTP 上运行的 TestRPC。因此,您需要使用 HTTP 运行 IDE。

http://remix.ethereum.org/
于 2018-03-27T16:01:28.800 回答
3

只需从地址栏中删除 HTTPS 并使用 HTTP,它就会起作用:-)

参考:https ://ethereum.stackexchange.com/users/32516/cryptoparticle

于 2018-02-16T12:07:39.627 回答
1

如上所述,从地址栏中删除 HTTPS 并使用 HTTP。另外,我运行它http://localhost:8545

geth --datadir . --port <your_port_no> --networkid 1234 --rpc --rpcport "8545" --rpccorsdomain "*" console 2>console.log

我使用它,它总是对我有用。

注意:如果你只使用一个节点,网络 ID 是没有用的,无论如何,如果你把它留在那里也没有什么坏处。如果您进一步遇到任何其他问题,请告诉我。

于 2018-04-03T18:27:52.680 回答
0

根据此链接,有时问题出在输入参数的顺序上。 localhost:8545可以在 geth 启动时启动,例如:

> geth --datadir ~/ethereum-private-network/chaindata --nodiscover --rpc
 --rpccorsdomain "*" --unlock 0 --mine 1
于 2018-03-04T15:20:13.390 回答
0
geth --nodiscover --networkid 2212 --unlock 0x9789c48ccf003c3a4687121087cbf83bedc5c604 --mine --rpc --rpcapi eth,net,web3,personal --rpcaddr "localhost" --rpcport 7545 --rpccorsdomain="*"

这个对我有用

于 2019-03-22T04:07:37.243 回答
0

在检查工具中打开网络选项卡,然后在连接上尝试查看结果。在我的情况下,我看到了这个回复

jsonrpc "2.0"
id  16057
error   
 code   -32601
 message    "the method net_listening does not exist/is not available"

因此你可以看到究竟发生了什么错误,不要猜测

于 2021-11-09T13:11:53.110 回答