[Ethereum] Deploying contracts in Ropsten with Truffle

contract-deploymentropstentruffletruffle-migration

I have another n00b question… sorry about that 🙁

I'm trying to deploy a smart contract to Ropsten. I have synched the Ropsten network with geth --testnet --fast --rpc --rpcapi eth,net,web3,personal, and it looks perfectly up to date.

Then I try to deploy that smart contract (which I've already deployed to my private testrpc network and it works poerfectly) to Ropsten. To do so I'm executing truffle migrate --network ropsten and I'm getting this pesky error:

Could not connect to your Ethereum client. Please check that your Ethereum client:
    - is running
    - is accepting RPC connections (i.e., "--rpc" option is used in geth)
    - is accessible over the network
    - is properly configured in your Truffle configuration file (truffle.js)

The geth instance is in fact up and running, since I can connect to it with geth attach http://127.0.0.1:8545 and it works fine. It is accepting connections, since I used the –rpc option. It is accessible over the network because I've already accessed it… and I think than my Truffle configuration file is ok, here's how it looks:

require('babel-register')

module.exports = {
  networks: {
    development: {
      host: 'localhost',
      port: 8545,
      network_id: '*' // Match any network id
    },
    ropsten: {
      host: "localhost",
      port: 8545,
      network_id: "3",
    }
  }
}

Can anyone please tell me why am I getting this error and what can I do to fix it?

Thank you so much in advance!!! 🙂

Best Answer

When I was deploying my contract through truffle in rinkeby network I too got the same error after adding from address and gas it got deployed. Try this

networks: {
  ropsten: {
    network_id: 3,
    host: '127.0.0.1',
    port: 8545,
    gas: 4000000,
    from: <your unlocked ropsten account address>
  },
Related Topic