我一直在尝试设置我的dapp,但没有找到任何详细解释它的资源。我想使用Geth和web3将我的应用程序连接到以太坊。到目前为止,我的index.js文件如下所示:
var Web3 = require('web3')
if (typeof web3 !== 'undefined') {
web3 = new Web3(web3.currentProvider)
} else {
web3 = new Web3(new
Web3.providers.HttpProvider('http://localhost:8545'))
}然后我输入:
geth --testnet --rpc在我的命令行中启动节点。我有一个npm脚本,可以同时运行geth和编译index.js。我是不是漏掉了什么?我还有另一个问题。使用ES6模块导入web3的正确方法是什么(导入...出自……)?非常感谢您的支持!
发布于 2018-01-18 15:16:32
我推荐这个命令
geth --rpc --rpcaddr 0.0.0.0 --rpcport 8545 --rpccorsdomain "*" consolegeth有很多选项,所以你应该阅读geth文档。
https://stackoverflow.com/questions/47345061
复制相似问题