6

I'm using Truffle v4.0.1 (core: 4.0.1) with the default configuration (ganache-cli aka TestRPC) on Ubuntu and it works fine, but I'd like to use the Ganache GUI. However, I can't find any instructions on how to configure them to work together. The Truffle documentation has a nice page explaining what it is and how it install and configure it, but not how to configure Truffle to take advantage of it. Thanks!

2
  • 1
    always feel free to make a PR to the official docs instead of just posting a self answered question here. thanks!
    – 0TTT0
    Feb 20, 2018 at 18:42
  • nice. can we bind ganache server to public ip of my instance, to access it from anywhere.
    – Harsh
    May 31, 2018 at 7:58

2 Answers 2

8

You'll need to add a development section to the networks section in your project's truffle.js:

module.exports = {
  networks: {
    development: {
      host: "localhost",
      port: 7545,
      network_id: "5777"
    }
  }
};

Make sure you get the port and network ID correct. Those are the defaults, so if you change them in Ganache you will need to change them here as well.

To use this specified network, after building the contract files, you'd use the command

truffle migrate --network development
2
  • I tried doing this and failed. Maybe there is bitrot. I found that editing truffle.js made no difference, and I had to edit the client js in the truffle library to get it to use the right port. Jan 23, 2018 at 19:40
  • my transactions are failing though. Calling a setter is throws Error: connection not open
    – srinivas
    Apr 26, 2020 at 11:35
0

Download ganache from https://truffleframework.com/ganache/

Open Terminal from your ganache file directory. Type the following and enter.

chmod a+x ganacheVersion.AppImage

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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