3

I have a transactional function that can only be called every few blocks, and I would like to create a view function that returns the number of blocks until the transactional function can be called again, in other words, current block minus block number of the last time the transactional function was called (which I keep track of in my contract state).

Is it possible to access the block.number inside a view function or can I only access it in a transactional function?

3
  • 1
    Wouldn't it have been easier to just try it rather than write this question?
    – user19510
    Commented Aug 23, 2018 at 16:23
  • If everybody tries every undocumented feature, no wonder why those languages and frameworks are so poorly documented.
    – Sebastien
    Commented Aug 23, 2018 at 16:37
  • Most team accept pull request to add more documentation.
    – Ismael
    Commented Aug 24, 2018 at 5:31

1 Answer 1

2

So indeed, after having tried this undocumented feature, I can confirm it is possible.

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.