When this code runs, it throws an error "RpcResponseException: header not found", and I don't understand why or how to fix it. Any advice?
Notes: I am using Nethereum in C#.net and using Infura API
[Function("balanceOf", "uint256")]
public class BalanceOfFunction : FunctionMessage
{
[Parameter("address", "_owner", 1)]
public string Owner { get; set; }
}
public void QueryingForBalanceAtBlockNumberWorksAsExpected()
{
HexBigInteger blockNumber = new HexBigInteger("10933333");
var web3 = new Nethereum.Web3.Web3("https://mainnet.infura.io/v3/" + _InfuraAPIKey);
string contractAddress = "0x514910771af9ca656af840dff83e8264ecf986ca"; //chainlink
string accountAddress = "0x56d065849ef9c59c1bc5ba54b9f96caba5c88812";
var balanceOfFunctionMessage = new BalanceOfFunction()
{
Owner = accountAddress,
};
var balanceHandler = web3.Eth.GetContractQueryHandler<BalanceOfFunction>();
//THIS WILL THROW AN ERROR "RpcResponseException: header not found":
var balanceInBaseUnits = balanceHandler.QueryAsync<BigInteger>(contractAddress, balanceOfFunctionMessage, new Nethereum.RPC.Eth.DTOs.BlockParameter(blockNumber)).Result;
}