I am trying to get the block between dates . for that i use web3.js . per day average block is 6172 so if i need previous day block i use below code

fromBlock: (await web3.eth.getBlockNumber()) - 12343, 
toBlock: (await web3.eth.getBlockNumber()) - 6172

then check the timestamp of the blocks in if condition .This is much time consume

is any easy way to get the blocks between dates. is any api available to get the blocks between the dates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.