0

I've developed a smart contract using truffle and testrpc, which can be found on GitHub here.

At this point I want to deploy it to ropsten, but I can't figure out how to do that.

After consulting this question/answer, I attempted to concoct a deployment for my smart contract as follows:

module.exports = {
  networks: {
    localhost: {
      host: "localhost", 
      port: 8546, // for ropsten expose this one
      //port: 8545, // expose this one for testrpc
      network_id: "*" // Match any network id
    },  
// for ropsten uncomment all of this
// for testrpc comment it all out
    ropsten: {
      host: "localhost",
      port: 8545,
      network_id: "3"
    }
  }
};

and here's how I tried to execute the deployment:

> truffle migrate --network ropsten

Using network 'ropsten'.

Running migration: 1_initial_migration.js
    Deploying Migrations...
    ... undefined
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: exceeds block gas limit

This is a screenshot of the full terminal output:

enter image description here

My question is, how can I deploy this simple contract to ropsten?


EDIT:

Found this:

enter image description here

but it didn't seem to help, i.e. still getting an error:

enter image description here

0

The part of the error message that you need to pay attention to is the:

Error: exceeds block gas limit

you can fix that by modifying you truffle.js to contain the line gas: 500000 like so:

module.exports = {
  networks: {
    localhost: {
      host: "localhost", 
      port: 8546, // for ropsten expose this one
      //port: 8545, // expose this one for testrpc
      network_id: "*" // Match any network id
    },  
    ropsten: {
      host: "localhost",
      port: 8545,
      network_id: "3",
      gas: 500000
    }
  }
};

then deploy it like this:

truffle migrate --network ropsten --reset 

and for me that seemed to work, as you can see here:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.