I have created a new consortium on Azure Blockchain Service and set up Visual Studio Code using Azure Blockchain Development Kit extension. I have my consortium set up in VSCode and also created a new solidity project. I compiled/built the default HelloBlockchain smart contract successfully. But when I deployed the contract, it gave me this error:

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

Here is my 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"
    }
  }
};

Here is 2_deploy_contracts.js file in migrations folder:

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

A screenshot of my VSCode Window

Any help would be greatly appreciated.

1

There are 1 best solutions below

0
On

I was experiencing the same error. I guess the blockchain services are not permitted on your college's wifi/LAN. Just use VPN or Mobile Hotspot, not your college's wifi/LAN.