我正在使用松露开发一个Dapp,我需要连接到我使用truffle migrate --network rinkeby上传到rinkeby上的合同。问题是我无法从web3接口连接到rinkeby网络。我运行一个rinkeby本地节点
geth --rinkeby --rpc --rpcapi db,eth,net,web3,personal --rpcport 8545 --rpcaddr localhost --rpccorsdomain "*" --unlock="0x4A1b47b0b119AFD421ec4E3b5B54D8EF5141b59c"前端代码是
if (typeof web3 !== 'undefined'){
web3 = new Web3(web3.currentProvider);
}else{
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
}但代码总是打我耳光
Error: Provider not set or invalid.如何解决这个问题,以及如何从合同abi创建一个新的合同实例?
发布于 2018-02-10 07:20:01
Dapp使用块菌和本地服务器运行此推荐程序:
geth --rinkeby --rpc --rpcapi db,eth,net,web3,personal --rpcport 8545 --rpcaddr "http://localhost:8000" --rpccorsdomain "*" --unlock="0x4A1b47b0b119AFD421ec4E3b5B54D8EF5141b59c"试试吧,http://localhost:8000
Rpc域--rpccorsdomain "http://localhost:8000“然后运行项目
https://ethereum.stackexchange.com/questions/39154
复制相似问题