Below is the simple programme which I wrote to use EVM compatible functions in VS code.
let web3 = require('web3');
const tr = new web3(web3.givenProvider || "ws://localhost:8545"); // Line 1
discuss();
async function discuss()
{
const latest = await tr.eth.getBlock(1);
console.log(latest);
}
I used the value present in Line 1 from reading documentationhere .
However , I am getting the below error :-
I have installed web3 package using npm i web3
. Is there anything else I need to do . In the documentation it was written that "Port 8545 is the default listening port for the Remote Procedure Call (RPC) interface of Ethereum clients" . Is there any more configuration which I am missing or like what is wrong here ?