2

I have deployed a contract to the ropsten test network with Truffle and can interact with the app at http://localhost:8080 (after running npm run dev and with geth connected to ropsten). However, if I wanted to host the app on a normal webserver for example, how should it be done? copying the files from the /build folder (including the /contracts folder in that) and viewing index.html (as is loaded in localhost) gives the following error:

MyContract has not been deployed to detected network (network/artifact mismatch)

2

In truffle.js I had do the following to deploy to ropsten and avoid the "network/artifact mismatch" error:

require('babel-register')

    module.exports = {
      networks: {
        "ropsten": {
          host: 'localhost',
          port: 8545,
          network_id: 3, // 3 is the network ID for ropsten
        }
      }
    }

And deploy the contract with truffle migrate --network ropsten

Before I was using the default truffle.js:

require('babel-register')

module.exports = {
  networks: {
    development: {
      host: 'localhost',
      port: 8545,
      network_id: '*', // Match any network id
    }
  }
}

When running truffle migrate this would still deploy the contract to the ropsten network (when I had it running in geth), but probably the truffle build files didn't point to it properly.

0

if you want to interact with the main network(The ethereum blockchain or EVM) you need to do the same you did on your local machine,, except this time geth will be attached to the main network not a testnet,, same goes with a private blockchain.

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