0

I'm new to DApp programming an I'm struggling with this problem since two days now.

Cloned this github example: https://github.com/dappuniversity/election I deployed the smart contract to ropsten with remix.ethereum. The deployment works and I can interact with it in remix. Now I want to interact with my local frontend with the smart contract on the testnet. I can not get this to work.

I'm using the exact same frontend from the repo. In the chrome console I get the message "Error: Contract has not been deployed to detected network (network/artifact mismatch)"

I changed the contract address in the Election.json and in the Migration.json to the new correct one which I had deployed. Also copyd the abi from remix.ethereum and replaced it in Election.json and Migration.json

MetaMask is on the correct network.

What did I miss out? Do I need to rebuild something with truffle or change the network in truffle.js? I hope someone can help me.

2
  • Did you add the deployed contract addresses under ropsten network id? ropsten network id is 3, truffle testnet is 5777.
    – Ismael
    Apr 9, 2021 at 5:13
  • this worked thank you. if you post it as answer i accept it
    – user70479
    Apr 9, 2021 at 10:32

1 Answer 1

0

The solution was to edit json artifacts to add a new section with ropsten network id (= 3) in "networks"

  "networks": {
    "5777": {
      "events": {},
      "links": {},
      "address": "0x30753e4a8aad7f8597332e813735def5dd395028"
    },
    "3": {
      "events": {},
      "links": {},
      "address": "<ROPSTEN_ADDRESS>"
    }
  },

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.