I am getting this error:
Error: Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced.
const Web3 = require("web3");
const MyContract = require("./build/contracts/MyContract.json");
const init = async () => {
const web3 = new Web3("http://127.0.0.1:9545");
const id = await web3.eth.net.getId();
const deployedNetwork = MyContract.networks[id];
const contract = new web3.eth.Contract(
MyContract.abi,
deployedNetwork.address
);
const addresses = await web3.eth.getAccounts();
await contract.methods.setData(10).send({
from: addresses[0]
});
const data = await contract.methods.getData().call();
console.log(data)
};
init();