Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

contract has not been deployed to detected network (network/artifact mismatch) on Rinkeby Network

I have been running into the specified in the title.

I have developed a smart contract and have successfully compiled and deployed it to the network as follows: 1. Run testrpc 2. truffle compile 3. truffle migrate

However, the error above is still being shown. I then tried deleting the build file and followed the steps below: 1. Run testrpc 2. truffle compile 3. truffle migrate --network rinkeby

The error was still being shown.

Below is the truffle.js file

module.exports = {
  migrations_directory: "./migrations",
  networks: {
development: {
  host: "localhost",
  port: 8545,
  network_id: "*" // Match any network id
},
rinkeby: {
  host: "localhost", // Connect to geth on the specified
  port: 8545, 
  network_id: "*",
}

} };

If anybody has faced any similar issues and have resolved it, I would greatly appreciate it if you could share how you have resolved it.

Thanks in advance

like image 1000
Sho0310 Avatar asked Feb 08 '18 20:02

Sho0310


2 Answers

For me, the following steps worked: create the file 2_deploy_contract.js in the migration folder with the code

var myContract = artifacts.require("myContract");

module.exports = function(deployer){
  deployer.deploy(myContract);
}

And run on terminal

$ truffle migrate --reset

I didn't need to change any settings in the truffle-config.js

like image 73
Ericksan Pimentel Avatar answered Sep 30 '22 11:09

Ericksan Pimentel


I had the same issue and created the file 2_deploy_contract.js in the migration folder with the code:

var myContract = artifacts.require("myContract");

module.exports = function(deployer){
  deployer.deploy(myContract);
}

I also checked the truffle-config.js at the root of the folder with the default settings:

rinkeby: {
  host: "localhost", 
  port: 8545, 
  from: "0x0085f8e72391Ce4BB5ce47541C846d059399fA6c", // default address to use for any transaction Truffle makes during migrations
  network_id: 4,
  gas: 4612388 // Gas limit used for deploys
}
like image 44
Hel Avatar answered Sep 30 '22 10:09

Hel