Как я могу разместить свой контракт в сети блокчейн? - PullRequest
0 голосов
/ 20 июня 2020
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?

Это мой второй файл миграции, т.е. 2_deploy_contracts.sol

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

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

Это мой трюфельный конфиг. 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
    }
  }
};

Вот ошибка:

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 Ответ

0 голосов
/ 26 июня 2020

Я думаю, что частная сеть не подключена к вашему трюфелю. Пожалуйста, проверьте следующее:

  1. Инструмент разработки частной цепи (например, Ganache) работает.
  2. Убедитесь, что IP-адрес частной цепи (Ganache) и номера портов RP C совпадают как в файле truffle-config. js.

Это будет решение этой проблемы.

...