[SOLVED] Moralis skips blocks

Dear colleagues!

We are on Pro Plan $49 per month and using Moralis NodeJS SDK v2.0.3 to interact with Binance Smart Chain through Moralis API.

Our goal is to know when new block is released as fast as possible.

We invoke in loop the “Moralis.EvmApi.native.getDateToBlock()” method and provide as parameter a date which one day later than now.
This request takes 300 milliseconds and 100 milliseconds of pause so it takes approx 400 milliseconds between cycles. BSC releases blocks every 3000 milliseconds.
It works but very often we face with issue when we are waiting for block N+1 for a long time then we got response that the latest block is N+2 or even N+3.
So the issue is the blocks are skiped by Moralis API and we can not to trigger our logic which must work with blockchain state on the N+1 block.

Could you please help us to resolve the issue?

Try with a different timestamp every time you make that request

Thnaks for your reply. Allready doing this

This method worked in the past for you or is the first time that you try it?

What information you need from those blocks?

Maybe you can use streams api

This is my first project with Moralis API.

When new block is released I do several calls to PancakeSwapPair contract to get reserves and cumulativePrices. I need to know on which block we are interacting with smart contract and we need to do it on every new block.
From my understanding streams api can not provide us functionality like this.

You are interacting with a smart contract?

You could try to use a RPC node to get latest block number. We don’t provide nodes any more.

Yes I’m interacting with smart contracts which implements IPancakeSwapPair interface.

Got it. Thank you cryptokid!