【发布时间】:2020-09-29 08:25:59
【问题描述】:
我正在尝试使用 React Native(Android 模拟器)连接到 Ganache-GUI。这是我的代码:
const Web3 = require('web3');
const HDWalletProvider = require('truffle-hdwallet-provider');
const mnemonic =
'gorilla color farm divert finish swim naive profit birth build scrub various'; // 12 word mnemonic
const provider = new HDWalletProvider(mnemonic, 'http://127.0.0.1:7545');
但我收到以下错误:
错误:无效的 Json RPC 响应:“无法连接 127.0.0.1:7545”
我已经在我的项目中安装了 web3.js 和 trufflehdwallet。
我还错过了什么其他步骤?我需要更改我的安卓模拟器的端口号和主机设置吗?
任何帮助将不胜感激。
【问题讨论】:
标签: react-native mobile web3js ganache