The documentation of the Timestamp pallet states that the result of Timestamp::now() is undefined until Timestamp::set is called for the first time. Looking at the implementation details, you can see that Timestamp::now() returns zero otherwise. I would expect Timestamp::now() to be usable sometime during block #1.

When calling Timestamp::now() during on_initialize of a custom pallet on block #1, it returns zero, but during on_finalize it returns the correct time. It's my understanding that the time is set using an inherent extrinsic. Is there any guarantee where the time stamp is set?

1 Answer 1


Timestamp::set is indeed an inherent extrinsic as defined:

fn is_inherent(call: &Self::Call) -> bool {
    matches!(call, Call::set { .. })

Inherent extrinsics are guaranteed to execute before regular extrinsics, so you should have access to it during any normal extrinsic call during the first block.

Of course after it is set, then you will always have a value there, but it might be one block behind if you use it at the on_initialize.

Inherent extrinsic order should be defined by the order of the pallets, so you should also get access to it if you make sure Timestamp pallet is ordered before any other relevant pallet.

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.