通过 rpc 从 Remix 连接到本地区块链时出错

Error while connecting from Remix via rpc to local blockchain

geth --datadir  ./accnt1   --port 30306 --networkid 2018 --rpc --rpcport 8545 --rpccorsdomain=”*” --nodiscover --rpcapi “db,personal,eth,net,web3,debug”  --rpcaddr="127.0.0.1" --rpcport 8545 console

使用上面的命令启动控制台,将 remix 连接到私有区块链。甚至尝试了 rpcaddr 的本地主机。还使用了 remix 的 http 版本。仍然低于错误。

无法连接到 Web3 提供商。确保提供程序是 运行 并且连接已打开(通过 IPC 或 RPC)。

  • 确保您已将 remix 中的环境更改为 Web3 provider
  • 在启动 geth 时,如果你想将它连接到 remix,那么你需要允许远程连接到 ethereum 节点。这可以通过添加 --rpccorsdomain "URL OF THE WEBSITE "
  • 来完成
  • 以下命令中的大写字母表示您需要根据需要指定。

    geth --datadir="DIRECTORY OF THE GENESIS BLOCK" --rpc --rpcport PORTNUMBER --rpccorsdomain "URL OF THE WEBSITE"

示例: geth --datadir="." --rpc --rpcport 8545 --rpccorsdomain="*" --rpcapi="miner,web3,debug,net,eth" 控制台 2>>logger.log

  • rpc 允许通过 HTTP 而不是 HTTPS,因此在 url 中将 https 更改为 http://remix.ethereum.org/ 并且 ide 应该通过 http 而不是通过 https 连接。使用此行中的 link provided 连接到 ide.