0
votes
I've being trying to create a basic smart contract and deploy it on blockchain using truffle,ganache.When i put this command on my truffle console it throws an error.I've looked for the solution but can't seem to understand where i am going wrong!Can anyone help me out?

This is my migrations 2nd file i.e 2_deploy_contracts.sol

var Election = artifacts.require("./Election.sol");

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

This is my truffle-config.js

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // for more about customizing your Truffle configuration!
  networks: {
    development: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*" // Match any network id
    },
    develop: {
      port: 8545
    }
  }
};

Here's the error:

Uncaught:
Error: Election has not been deployed to detected network (network/artifact mismatch)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at Function.deployed (C:\Users\harshad\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\contract\lib\contract\constructorMethods.js:84:1)
    at Object.checkNetworkArtifactMatch (C:\Users\harshad\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\contract\lib\utils\index.js:249:1)
1
A user has requested that you post more code that can help clarify what the issue is. This user does not have the required reputation to request this in a comment, and so posted it using the answer function instead. As their "answer" will be deleted for not being an answer, I'm reposting their request here, so that they'll be able to help you. Please be aware that if your question lacks the necessary information to fix your problem, it will be closed. I myself have no knowledge of this topic, and cannot judge if the error message is sufficient.Andreas detests censorship
Done all the required data is posted.Hrishikesh Deshpande

1 Answers

0
votes

I think the private network is not connected to your truffle. Please check the following:

  1. Private chain development tool (ex.Ganache) is running.
  2. Check the private chain (Ganache) IP and RPC port numbers are the same as in the truffle-config.js file.

It will be the solution of this problem.