1

we are creating a game which give the player a 60 seconds rounds to play. How can we set a timer of 60 seconds in a substrate pallet?

1 Answer 1

0

Always consider using the block number first at runtime.

trait Config {
  RoundTime: Get<BlockNumberFor<T>>,
}

If your chain's block time is 12 seconds, then approximately 1 minute passes for every 5 blocks.

impl Config for Runtime {
  RoundTime = ConstU32<5>,
}

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.