Network config for Truffle / Ganache
mattdunndc opened this issue · comments
Just starting out. Can't seem to connect to Ganache on 7545. Does network_id need to be 5777 for Ganache? What unlocked acccount needs to be in the from property?
module.exports = {
...
networks: {
development: {
host: "localhost",
port: 7545,
network_id: "*", // Match any network id. You may need to replace * with your network Id
from: "", // Add your unlocked account within the double quotes
gas: 4444444
}
}
Getting this :
Uncaught TypeError: Cannot read property 'isListening' of undefined
at eval (webpack-internal:///./src/util/web3/getWeb3.js:13)
Hi @mattdunndc
Getting the same error, were you able to solve it ??
same error here
It has several reasons
- Box do not integrate well with new metamask which requires website approval to expose web3
Code like
if (window.ethereum) {
var web3 = new Web3(ethereum);
try {
var ret = ethereum.enable();
ret.then(()=>{
res(window.web3);
}).catch((err)=>{
rej(err);
})
} catch (error) {
rej(error);
}
} else if (window.web3) { // Legacy dapp browsers...
var web3 = new Web3(web3.currentProvider);
res(web3);
} else { // Non-dapp browsers...
console.log('Non-Ethereum browser detected. You should consider trying MetaMask!');
}
Is required instead of currently existing
I see no dependency on web3 1.0 in package.json
Currently running the box against my local ganache testnet and your config looks good.
The from
address is the address you'd like to deploy the contracts from, this will consume ETH via gas costs so you will need to be auth'd with a web3 provider like metamask against your local testnet in order to deploy the contracts.
You can set up metamask to connect to your private ganache testnet by clicking the dropdown at the top of metamask where you'll be able to select Custom RPC
and plug in your ganache server values. In Ganache under accounts, you should be able to grab an address and use the private key to access it. Once you're logged in via metamask, add your address to the from
field in truffle.js, and try running truffle migrate
again.