I want to deploy my contract on live testnet ( rinkeby) using private key instead of mnemonic of my account and truffle.
I have some configurations in truffle.js
but I am getting error on migrate :
require('dotenv').config();
const Web3 = require("web3");
const web3 = new Web3();
const WalletProvider = require("truffle-wallet-provider");
const Wallet = require('ethereumjs-wallet');
var rinkebyPrivateKey = new Buffer(process.env["RINKEBY_PRIVATE_KEY"], "hex");
var rinkebyWallet = Wallet.fromPrivateKey(rinkebyPrivateKey);
var rinkebyProvider = new WalletProvider(rinkebyWallet, "https://rinkeby.infura.io/dLqHiBy4LivAhq6bHTiS");
module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*" // Match any network id
},
rinkeby: {
provider: rinkebyProvider,
network_id: 4
},
},
solc: {
optimizer: {
enabled: true,
runs: 200
}
}
};
I am getting follow error :
/home/rails/Desktop/DeveloperCrowdsale/node_modules/web3/lib/web3/errors.js:35
return new Error(message);
^
Error: Invalid JSON RPC response: ""
at Object.InvalidResponse (/home/rails/Desktop/DeveloperCrowdsale/node_modules/web3/lib/web3/errors.js:35:16)
at XMLHttpRequest.request.onreadystatechange (/home/rails/Desktop/DeveloperCrowdsale/node_modules/web3/lib/web3/httpprovider.js:115:32)
at XMLHttpRequestEventTarget.dispatchEvent (/home/rails/Desktop/DeveloperCrowdsale/node_modules/xhr2/lib/xhr2.js:64:18)
at XMLHttpRequest._setReadyState (/home/rails/Desktop/DeveloperCrowdsale/node_modules/xhr2/lib/xhr2.js:354:12)
at XMLHttpRequest._onHttpRequestError (/home/rails/Desktop/DeveloperCrowdsale/node_modules/xhr2/lib/xhr2.js:544:12)
at ClientRequest.<anonymous> (/home/rails/Desktop/DeveloperCrowdsale/node_modules/xhr2/lib/xhr2.js:414:24)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at TLSSocket.socketErrorListener (_http_client.js:387:9)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at emitErrorNT (internal/streams/destroy.js:64:8)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
Is there any another way to deploy your contract using private key of your account ?
or any update needed in my truffle.js
file .