混音 |无法连接到 Web3 提供程序



我在 web3 提供程序上运行时出错(本地主机: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,我提供了一些与混音和测试网连接的选项。

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

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

无论如何,检查"web3 证明者"在混音 IDE 中的"运行"选项卡上。

然后,修改了地址,如"http://127.0.0.1:8545"而不是"http://localhost:8545"。

我不知道原因,但当我这样修复时,它无论如何都有效。我做了我的账户并做了一些事情。

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

> eth.blockNumber
0

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

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

http://remix.ethereum.org/

只需从地址栏中删除HTTPS并使用HTTP,它就可以工作:-(

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

正如上面提到的每个人,从地址栏中删除HTTPS并使用HTTP。另外,我在http://localhost:8545上运行了它

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

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

注意:如果您只使用一个节点,网络ID是无用的,无论如何,如果您只是将其留在那里,则不会造成任何伤害。如果您进一步遇到任何其他问题,请告诉我。

安装 remixd sudo npm install -g @remix-project/remixd

安装甘纳许-cli yarn global add ganache-cli

运行混音 remixd -s /tmp/ --remix-ide https://remix.ethereum.org

运行甘纳许 ganache-cli -f https://bsc-dataseed.binance.org/

转到 https://remix.ethereum.org/

现在转到混音。在此页面上,通过单击看起来像插件的图标转到插件部分。在插件中搜索"重新混合",然后单击"激活"。

En "部署和运行事务" 选择 Web3 提供商

根据此链接,有时问题在于输入参数的顺序。本地主机:8545 可以在 Geth 启动时启动,如下所示:

> geth --datadir ~/ethereum-private-network/chaindata --nodiscover --rpc
 --rpccorsdomain "*" --unlock 0 --mine 1
geth --nodiscover --networkid 2212 --unlock 0x9789c48ccf003c3a4687121087cbf83bedc5c604 --mine --rpc --rpcapi eth,net,web3,personal --rpcaddr "localhost" --rpcport 7545 --rpccorsdomain="*"

它对我有用

在"检查"工具中打开"网络"选项卡,然后在连接时尝试查看结果。就我而言,我看到了此响应

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

因此,您可以看到究竟发生了什么错误并且不猜测

Error while connecting to the provider, provider not connected

如果消息像上面一样正确,并且您没有在Chrome中运行,则情况就是如此

我已经通过了这个问题。希望对您有所帮助!

如果您甚至已经从https更改为http但仍然面临相同的问题,请确保禁用添加阻止程序(如果您正在使用任何(,如果您使用勇敢的浏览器,请关闭勇敢的盾牌。

最新更新