Abnormally high number of eth_getBlockByNumber requests when making (call and send) request to smart contract

I’m running a simple script every 30 seconds using Infura API to make one call to a smart contract function. However, eth_blockNumber is being called like 16x as compared to eth_call

Simplified code as below:


var Web3 = require('web3');
const HDWalletProvider = require('@truffle/hdwallet-provider');

let timeout = 30000;

const start = async () => {

  var hd = new HDWalletProvider(RINKEBY_WALLET_MNEMONIC, "https://rinkeby.infura.io/v3/" + INFURA_PROJECT_ID)
  var web3 = new Web3(hd)

  const contract = await new web3.eth.Contract(abi, address)
  const accounts = await web3.eth.getAccounts()

  let result = await contract.methods.getValue().call({from:accounts[0]})
  // this successfully fetches the value from the smart contract

  for (i = 1; i <= 2; i++) {
    // make a send call to contract
    let result = await contract.methods.setValue('10').send({from: accounts[0]})
    console.log('fetched result with txnObject: ' + result)


const restart = () => {
  console.log('restart: waiting for ' + timeout/1000 + ' seconds')

const wait = (milliseconds) => {
  return new Promise((resolve, reject) => setTimeout(() => resolve(), milliseconds));


In above function, eth_call gets called only once, and eth_sendRawTransaction is called twice but eth_blocknumber gets call multiple times (like 20 or so).

eth_getBlockByNumber and eth_getTransactionReceipt also gets called multiple times (like 5 times or so compared to eth_call)

Due to unnecessary high number of eth_blocknumber, I’ve to pay a lot more for the Infura API access.

On the other hand, perhaps my understanding of Infura working is incorrect. How many API calls are made when making a simple call request to a function? And how many for making a send request? And how to change code so as to limit eth_blocknumber and other such high number of requests (which are not made explicitly but still gets counted in API count)

Any idea how to solve this?

Hello @astrodist. Welcome to the Infura community.
I hope this thread can help to provide you some insight.