One thing I need to do in my smart contract is to calculate the current epoch's round. The reason why I need it is that my smart contract should not do anything in the first 5-10 minutes of an epoch (so the first 50-100 rounds?).
For this I thought that I could use the current block round, divide it by the rounds per epoch and what's over is the current round in the current epoch.
So far so good? BUT that's not working. Take this example from the devnet:
Round: 5017252 Rounds per epoch: 1200 Epoch = 5017252 / 1200 = ~4181.04333 But the actual epoch is: 4150
On mainnet this calculation DOES work. Anyone has a better idea?
Short answer: There are 2400 rounds per epoch on the devnet, not 1200.
Explanations
On the current devnet (which started the 6th September 2024) an epoch lasts 4 hours rather than 24 hours on the mainnet or 2 hours on the previous devnet.
To check how much rounds are in an epoch you can query this: https://devnet-gateway.multiversx.com/network/config
Response:
You can see there are 2400 rounds per epoch on the devnet.
Now let's do the same on the mainnet by querying https://gateway.multiversx.com/network/config
Response:
You can see there are 14400 rounds per epoch on the mainnet.
Please be aware that the round duration might change in a future network upgrade. So be careful and don't hardcode it in your contract, especially if it isn't upgradeable