2

I try to migrate a Smart Contract to a private network running in Azure. It works fine with testrpc but when I try to migrate it to the (remote) private network I always get the following error:

Error: Invalid JSON RPC response: ""
    at Object.InvalidResponse (C:\Users\xxx\AppData\Roaming\npm\node_modules\truffle\node_modules\web3\lib\web3\errors.js:35:16)
    at XMLHttpRequest.request.onreadystatechange (C:\Users\xxx\AppData\Roaming\npm\node_modules\truffle\node_modules\web3\lib\web3\httpprovider.js:116:32)
    at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\xxx\AppData\Roaming\npm\node_modules\truffle\node_modules\xhr2\lib\xhr2.js:64:18)
    at XMLHttpRequest._setReadyState (C:\Users\xxx\AppData\Roaming\npm\node_modules\truffle\node_modules\xhr2\lib\xhr2.js:354:12)
    at XMLHttpRequest._onHttpRequestError (C:\Users\xxx\AppData\Roaming\npm\node_modules\truffle\node_modules\xhr2\lib\xhr2.js:544:12)
    at ClientRequest.<anonymous> (C:\Users\xxx\AppData\Roaming\npm\node_modules\truffle\node_modules\xhr2\lib\xhr2.js:414:24)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at Socket.socketErrorListener (_http_client.js:310:9)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at emitErrorNT (net.js:1278:8)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)

What I did so far was creating and compiling the contract and modifying truffle.js to

module.exports = {
  networks: {
    azure: {
      network_id: xxx,
      host: "xxx.westeurope.cloudapp.azure.com",
      port: 8545   
    },
    development: {
      host: "localhost",
      port: 8545,
      network_id: "*" // Match any network id
    }
  }
};

When I run migrate --network azure in the truffle console the error occurs.

Does someone know how to do it correctly? Respectively why the error occurs?

Thanks

  • Run this for me curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' xxx.westeurope.cloudapp.azure.com. This will tell me whether you have or not access to your server RPC. – Herman Junge Mar 10 '17 at 19:24
  • And maybe is westerNeurope, with an N ? – Herman Junge Mar 10 '17 at 19:24
  • 1
    It seems to work as far as the error does not occur any more. I closed the truffle console and started it again and now I come one step further. Now I get the error Error: authentication needed: password or unlock. Do you know how I provide the authentication / password for the account provided in the configuration file via "from"? – quervernetzt Mar 10 '17 at 22:15
2

I had this same issue I managed to get this running by geth 'OtherOptions' --unlock 0 Which will unlock the coinbase for us.

PS: This not a good practice.

You can also unlock the coinbase using web3.personal.unlockAccount from the DAPP itself.

1

you need to unlock your coin base to do so use

personal.unlockAccount(eth.coinbase,"your_pass_phrase",time_in_miliseconds)

if you specify time 0(zero) then the account was unlocked permanently, you can lock it manually.

refer this link for more options to manage your accounts

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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