I'm new to Ethereum Blockchain. I have been trying to send ether using web3.js npm. Here's my code
const testnet = `https://ropsten.infura.io/${process.evn.ACCESS_TOKEN}`;
let web3 = new Web3(new Web3.providers.HttpProvider(testnet));
web3.eth.personal.unlockAccount(adminWalletAddress, password, 1000)
.then(data => console.log(data))
.catch(err => console.log(err))
I'm getting an error response -
Error: Invalid JSON RPC response: ""
at Object.InvalidResponse (/home/rplanx/Dwip/node_ethereum/web3-1-x-x-contract-transaction/node_modules/web3-core-helpers/src/errors.js:42:16)
at XMLHttpRequest.request.onreadystatechange (/home/rplanx/Dwip/node_ethereum/web3-1-x-x-contract-transaction/node_modules/web3-providers-http/src/index.js:73:32)
at XMLHttpRequestEventTarget.dispatchEvent (/home/rplanx/Dwip/node_ethereum/web3-1-x-x-contract-transaction/node_modules/xhr2/lib/xhr2.js:64:18)
at XMLHttpRequest._setReadyState (/home/rplanx/Dwip/node_ethereum/web3-1-x-x-contract-transaction/node_modules/xhr2/lib/xhr2.js:354:12)
at XMLHttpRequest._onHttpResponseEnd (/home/rplanx/Dwip/node_ethereum/web3-1-x-x-contract-transaction/node_modules/xhr2/lib/xhr2.js:509:12)
at IncomingMessage.<anonymous> (/home/rplanx/Dwip/node_ethereum/web3-1-x-x-contract-transaction/node_modules/xhr2/lib/xhr2.js:469:24)
at IncomingMessage.emit (events.js:185:15)
at endReadableNT (_stream_readable.js:1106:12)
at process._tickCallback (internal/process/next_tick.js:178:19)
The response is same for web3.eth.sendTransaction method. I'm using [email protected]. Faced the same issue when using [email protected]
var web3 = new Web3(); web3.setProvider(new web3.providers.HttpProvider(testnet));