How are requests counted?

Hi everyone,
I am new here :grinning:, just used the example in Infura for Python :

def watch():
while True:
block = web3.eth.get_block(‘latest’)
print("Searching in block " + str(block.number))

    if block and block.transactions:
        for transaction in block.transactions:
            tx_hash = transaction.hex() # the hashes are stored in a hexBytes format
            tx = web3.eth.get_transaction(tx_hash)
            if tx.to != None:
                if tx.to == account:
                    print("Transaction found in block {} :".format(block.number))
                    print({
                        "hash": tx_hash,
                        "from": tx["from"],
                        "value": web3.fromWei(tx["value"], 'ether')
                        })
    time.sleep(5)

watch()

Since I wanted to create a Watcher for an Address.
My question is, how the Infura Requests are counted?

I thought it counts one Request for getting the last Block:
block = web3.eth.get_block(‘latest’)

But it seems the Requests are counting for each Transaction in that Block:
for transaction in block.transactions:
tx = web3.eth.get_transaction(tx_hash)

I got like ~1400 Requests for Today, for ~20 Scans. Am I right, that it counts for every Transaction in the Block?

Thank you.

3 Likes

Hey, yes because this is a different request, eg eth_getTransactionByHash - Infura Docs

2 Likes