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
Best Answer
I had this same issue I managed to get this running by
geth 'OtherOptions' --unlock 0
Which will unlock the coinbase for us.You can also unlock the coinbase using
web3.personal.unlockAccount
from the DAPP itself.