# Any reason why block number or timestamp is not accessible via contract?

**URL:** <https://forum.flow.com/t/any-reason-why-block-number-or-timestamp-is-not-accessible-via-contract/397>\
**Category:** 🏄🏻‍♀️ Cadence\
**Created:** [July 15, 2020, 3:53pm UTC](https://forum.flow.com/t/any-reason-why-block-number-or-timestamp-is-not-accessible-via-contract/397 "2020-07-15T15:53:17Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![makoto](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.flow.com/makoto/32/5_2.png) [@makoto](https://forum.flow.com/u/makoto)\
**Post date:** [July 15, 2020, 3:53pm UTC](https://forum.flow.com/t/any-reason-why-block-number-or-timestamp-is-not-accessible-via-contract/397/1 "2020-07-15T15:53:17Z")

</div>

According to [https://docs.onflow.org/docs/faq#how-do-i-access-block-information-like-timestamp-and-block-number-in-cadence](https://docs.onflow.org/docs/faq#how-do-i-access-block-information-like-timestamp-and-block-number-in-cadence) , they are currently not supported.

Could you give us a technical explanation of why this is the case? I can understand that Cadence is so new that many building blocks such as Oracle or Stable coins are missing (and other blockchain like Ethereum didn’t have it from day one) . However, block number and its associated timestamp probably existed from very early on. I feel like this is a deal breaker for many dapp ideas which requires some notion of time, and prefer not to roll out my own Oracle service just for this purpose.

---

<div class="post-metadata">

**Author:** ![jsd](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.flow.com/jsd/32/61_2.png) [@jsd](https://forum.flow.com/u/jsd)\
**Post date:** [July 15, 2020, 4:12pm UTC](https://forum.flow.com/t/any-reason-why-block-number-or-timestamp-is-not-accessible-via-contract/397/2 "2020-07-15T16:12:54Z")

</div>

Hi @makoto I’m totally with you on that. The TimeStamp is the proof that you had that asset at this time and a transaction without timestamp it is no good for traceability/transactional history of the asset ownership transfer.

---

<div class="post-metadata">

**Author:** ![flowjosh](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.flow.com/flowjosh/32/362_2.png) [@flowjosh](https://forum.flow.com/u/flowjosh)\
**Post date:** [July 15, 2020, 4:14pm UTC](https://forum.flow.com/t/any-reason-why-block-number-or-timestamp-is-not-accessible-via-contract/397/3 "2020-07-15T16:14:52Z")

</div>

@makoto, the block number and timestamp actually are available in Cadence right now. We just have been slow about adding the documentation for it to the language reference and FAQ. I’m finding the syntax for it now…

---

<div class="post-metadata">

**Author:** ![makoto](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.flow.com/makoto/32/5_2.png) [@makoto](https://forum.flow.com/u/makoto)\
**Post date:** [July 15, 2020, 4:38pm UTC](https://forum.flow.com/t/any-reason-why-block-number-or-timestamp-is-not-accessible-via-contract/397/4 "2020-07-15T16:38:39Z")

</div>

This is great news!!!

---

<div class="post-metadata">

**Author:** ![flowjosh](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.flow.com/flowjosh/32/362_2.png) [@flowjosh](https://forum.flow.com/u/flowjosh)\
**Post date:** [July 15, 2020, 4:49pm UTC](https://forum.flow.com/t/any-reason-why-block-number-or-timestamp-is-not-accessible-via-contract/397/5 "2020-07-15T16:49:43Z")

</div>

@makoto and @jsd

- Get the current block:  
`fun getCurrentBlock(): Block`
- Get a block at a given height:  
`fun getBlock(at height: UInt64): Block?`
- The block info is:

```auto
struct Block {
      let id: [UInt8; 32]
      let height: UInt64
      let timestamp: UFix64
}

```

---

<div class="post-metadata">

**Author:** ![ebreuers](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.flow.com/ebreuers/32/42_2.png) [@ebreuers](https://forum.flow.com/u/ebreuers)\
**Post date:** [July 17, 2020, 9:01pm UTC](https://forum.flow.com/t/any-reason-why-block-number-or-timestamp-is-not-accessible-via-contract/397/6 "2020-07-17T21:01:07Z")

</div>

Nice! I used getCurrentBlock in this week’s assignment, but it looks like the Playground is having issues with Block.height

[![](https://us1.discourse-cdn.com/flex022/uploads/flow/original/1X/4066fcafe3551e9cedb3558538d0c27e527d565f.png) ](https://dl.dropboxusercontent.com/s/xvtoa5kc6nufkav/Screenshot%202020-07-17%2013.57.04.png?dl=0)

---

<div class="post-metadata">

**Author:** ![flowjosh](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.flow.com/flowjosh/32/362_2.png) [@flowjosh](https://forum.flow.com/u/flowjosh)\
**Post date:** [July 17, 2020, 10:00pm UTC](https://forum.flow.com/t/any-reason-why-block-number-or-timestamp-is-not-accessible-via-contract/397/7 "2020-07-17T22:00:52Z")

</div>

@ebreuers did you try a different one of the fields? I think Cadence might still be a little out of data in the playground so that might be why that is missing

---

<div class="post-metadata">

**Author:** ![ebreuers](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.flow.com/ebreuers/32/42_2.png) [@ebreuers](https://forum.flow.com/u/ebreuers)\
**Post date:** [July 17, 2020, 10:31pm UTC](https://forum.flow.com/t/any-reason-why-block-number-or-timestamp-is-not-accessible-via-contract/397/8 "2020-07-17T22:31:51Z")

</div>

@flowjosh I’ve only tried the height field. No problem though!

I just wanted to point that out here in case anyone else runs into it

---

<div class="post-metadata">

**Author:** ![MaxStarka](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.flow.com/maxstarka/32/56_2.png) [@MaxStarka](https://forum.flow.com/u/MaxStarka)\
**Post date:** [July 18, 2020, 3:08pm UTC](https://forum.flow.com/t/any-reason-why-block-number-or-timestamp-is-not-accessible-via-contract/397/9 "2020-07-18T15:08:58Z")

</div>

Right now Playground version of **getCurrentBlock** will return you a struct with 2 fields: **number** and **hash** :

> Block(number: 1, hash: 0x0000000000000000000000000000000000000000000000000000000000000001)
