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

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

1 Answer 1

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:

2
  • What if I don't use MyContract.at(contractAddress) but instead MyContract.new() ? It spits an Error: Invalid address Dec 1, 2017 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 Dec 1, 2017 at 1:44

Your Answer

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

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