I am trying to deploy a contract to the mainnet. My truffle.js looks like this:
require('babel-register')
module.exports = {
networks: {
"live": {
network_id: 1,
host: 'localhost',
port: 8546
}
},
rpc: {
host: "localhost",
port: 8545
}
};
I have connected to the mainnet in geth (just with geth
and geth attach
though I've also tried geth --rpcport 8546 --rpcaddr 127.0.0.1
for example). My blockchain is fully up to date (running eth.blockNumber
will show I'm at the latest block or close to it).
Running the following command to deploy my contract:
truffle migrate --network live
Will result in the following error:
Invalid JSON RPC response: ""
This problem is truffle isn't connecting to the mainnet at all. I've successfully deployed to the ropsten test network using truffle when geth is connected to that, so am not sure why the mainnet isn't working (when deploying to ropsten I have basically the same truffle.js as above except network_id: 3 instead of network_id: 1, and the same command to deploy the contract except with –network ropsten instead of –network live).
Best Answer
Running
netstat -an
showed the port I though I was running the mainnet on (8546 here) wasn't active. Running the mainnet in geth on port 8545 (like the testnet) and changing truffle.js to look at port 8545 allowed truffle to connect to it.