0

我在 Azure 区块链服务上创建了一个新联盟,并使用 Azure 区块链开发工具包扩展设置了 Visual Studio Code。我在 VSCode 中建立了我的联盟,并且还创建了一个新的 Solidity 项目。我成功编译/构建了默认的 HelloBlockchain 智能合约。但是当我部署合同时,它给了我这个错误:

Get version for required apps: truffle
[Execute command] 
Working dir: /home/manul/securevoting/blockchain
Running command
npx truffle migrate --reset --network electionmanagement
[Execute command] 
Compiling your contracts...
[Execute command] ===========================
[Execute command] > Everything is up to date, there is nothing to             
compile.
[Execute command] 
[Execute command] Finished running command
[Azure Blockchain] HttpService.sendRPCRequest has done with error:      
RequestError: Error: connect ECONNREFUSED 127.0.0.1:8545
[Azure Blockchain] HttpService.sendRPCRequest has done with error:    
RequestError: Error: connect ECONNREFUSED 52.168.92.164:3200

这是我的 truffle-config.js:

const HDWalletProvider = require('truffle-hdwallet-provider');
const fs = require('fs');
module.exports = {
  networks: {
    development: {
      host: "127.0.0.1",
      port: 8545,
      network_id: "*"
    },
    electionmanagement: {
      network_id: "*",
      gas: 0,
      gasPrice: 0,
      provider: new HDWalletProvider(fs.readFileSync('/home/manul/securevoting/blockchain/administrator.env', 'utf-8'), "https://administrator.blockchain.azure.com:3200/5GJ3H0vdRuvo6AkPDFRRbxL0"),
      consortium_id: 1565975083891
    }
  },
  mocha: {},
  compilers: {
    solc: {
      version: "0.5.0"
    }
  }
};

这是迁移文件夹中的 2_deploy_contracts.js 文件:

var HelloBlockchain = artifacts.require("HelloBlockchain");
var Arg = "Hello world";
module.exports = deployer => {
    deployer.deploy(HelloBlockchain, Arg);
};

我的 VSCode 窗口的屏幕截图

任何帮助将不胜感激。

4

1 回答 1

0

我遇到了同样的错误。我猜你大学的 wifi/LAN 上不允许使用区块链服务。只需使用 VPN 或移动热点,而不是您大学的 wifi/LAN。

于 2019-08-17T17:12:31.600 回答