nageetaw / Utilities

0 stars 0 forks source link

How to connect truffle with ganache to deploy Smart Contract on linux ? #6

Open nageetaw opened 2 years ago

nageetaw commented 2 years ago

Open truffle-config.js file and uncomment the development code if commented networks: { // Useful for testing. Thedevelopmentname is special - truffle uses it by default // if it's defined here and no other network is specified at the command line. // You should run a client (like ganache-cli, geth or parity) in a separate terminal // tab if you use this network and you must also set thehost,portandnetwork_id // options below to some value. // //development: { //host: "127.0.0.1", // Localhost (default: none) // port: 8545, // Standard Ethereum port (default: none) // network_id: "*", // Any network (default: none) // }, .... }

Once done change the port number to 7545 which is default port for ganache. networks: { // Useful for testing. Thedevelopmentname is special - truffle uses it by default // if it's defined here and no other network is specified at the command line. // You should run a client (like ganache-cli, geth or parity) in a separate terminal // tab if you use this network and you must also set thehost,portandnetwork_id // options below to some value. // development: { host: "127.0.0.1", // Localhost (default: none) port: 7545, // Standard Ethereum port (default: none) network_id: "*", // Any network (default: none) }, ..}

Now run ganache first then on terminal compile you smart contracts using truffle compile then migrate using truffle migrate --network development and you will notice that the contract is deployed.