I have problem with invalid response to ethereum from BE NodeJS app. I got error like:
Error: Invalid JSON RPC response: ""
Below I'd attached my simple code for testing connection.
const Web3 = require("web3");
const web3 = new Web3(new Web3.providers.HttpProvider(providerUrl));
const contract_web3 = new web3.eth.Contract(abi, contractAddress);
console.log("Config Data: \n", providerUrl, "\n", config.privateKey, "\n", contractAddress);
contract_web3.methods.getDocuments().call((err, result) => {
if (err) {
// handle error here
console.log("Test call error: ", err);
}
else {
console.log("Test call: ", result);
}
})
I'v readed about HDWalletProvider, but I havent dive in it yet.
Regards!
providerUrl
, and do you have an Ethereum Node listening at this port/socket/connection? – goodvibration Nov 29 '19 at 11:27contractAddress
, and have you verified the contract at that address on etherscan (so that we can view its source code)? – goodvibration Nov 29 '19 at 12:25