0

I deployed a contract through remix and then I run the following code

MyContract.deployed()
    .then(instance => {
    c = instance;
    return c.getCreator();
})
    .then(result => {
    console.log(result);
})
    .catch(error => {
    console.log(`${error}`);
})

It spits an error saying Error: HelloWorld has not been deployed to detected network (network/artifact mismatch)

HelloWorld is just a JSON file that contains my ABI/Binary/etc generated from truffle

  • Is the contract deployed to a local network i.e testrpc or to a different netwok ? – Rangesh Dec 1 '17 at 2:41
0

Make sure that:

  • the truffle web3 provider is connected to the same network which you deployed to.
  • the ABI file contains the deployed contract address.

You can also specify the contract address to use:

MyContract.at(contractAddress)
.then(instance => {
  // ...
})

If deploying make sure that:

  • What if I don't use MyContract.at(contractAddress) but instead MyContract.new() ? It spits an Error: Invalid address – JorahFriendzone Dec 1 '17 at 0:42
  • @JorahFriendzone that error is because it's not detecting a connected wallet. If you have one connected, then also include the {from: account} option – Miguel Mota Dec 1 '17 at 1:44

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.