This question already has an answer here:
The only option I can think of, is by using
web3.eth.getBlock(web3.eth.blockNumber, true) in a for loop and subtracting the blockNumber till you find an object in the
However, this can take a very long time, because in our case, we have our blockchain on an Azure server and a lot of empty blocks are created by nodes.
EDIT: Not a duplicate of this. I want to know how to find the latest transactions in an efficient way, without using a for loop that takes ages to complete.