0

我有一个带有以下代码的简单 HTML 文件,试图从 Chrome 连接到我的智能合约。

if (typeof web3 !== 'undefined') {
    web3 = new Web3(web3.currentProvider);
            console.log(web3);
        } else {
            // set the provider you want from Web3.providers
            web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
        }

使用我的 localhost:8545 代码可以完美运行,但是当我停止 localhost 时,它只是没有通过 MetaMask 插件连接。我尝试了一切,关闭浏览器,退出 MetaMask 并重新登录新页面,重新安装 MetaMask。没有任何效果。我的刷新页面一直在寻找本地主机连接。

4

1 回答 1

0

这可能是同一个问题。 https://ethereum.stackexchange.com/a/16133/45875

于 2018-10-04T06:54:03.263 回答