dojo.common.time_to_block

Utils for converting between block numbers and time stamps.

def time_to_block(datetime_string: str, chain: dojo.common.Chain) -> int:

Convert a datetime string to a block number.

Will return the number of the last completed block up to that timestamp.

Parameters
  • **datetime_string: String in the following format: 2020-01-01 20:42**: 02
  • chain: Enum of the chain for which this conversion should be done.