1

So for example, I want to enable my contract 1 week after deployment, thats now() + 1 week, how could I know which block that will be so I can send my clients a countdown to that block with https://bscscan.com/block/countdown/9999999

1

3 Answers 3

1

Since block time varies, I would suggesting selecting a block that would be somewhere in that timebox. And it would make perfect sense to announce ie. contract is active from block xxxxxxxx If you need some stuff to prepare before exact timestamp give yourself some more time then calculated

0

On BSC blocks are validated every 3 seconds. So that's 201600 blocks per week. You could just add 201600 to the block number where you contract was deployed.

2
  • How accurate is this, can you please ellaborate if/how the block generation speed is going to change over time (assuming no changes on the blockchain codebase, no forks/hardforks)?
    – josue.0
    Jun 10, 2021 at 22:47
  • 1
    I this accurate as far as this is how it is described in bsc documentation, and I haven't seen a block that was not 3 sec apart from the previous block. However, I have no idea if this will change or not.
    – Undead8
    Jun 11, 2021 at 0:22
0

We built a little tool for this last year called BlockBucket:

https://blockbucket.io/block-calculator

It works by using the average block times and figuring out how many blocks it will take to get to that time. We've built it to work for most EVM chains (including BSC).

Hopefully this should do the trick?

Let me know if you have any questions :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.