FAQ #1 - How to get the height of the current block?

In order to get current block height you need to call method getCurrentBlock() it will return you a struct with following signature:

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

Current version of Playground have this method implemented, though it returns you a struct with two fields number (which should represent block height) and hash. We would advice to mock this method for now and then replace it with actual call of native method. Sorry for inconvenience :bowing_man:

3 Likes

Iā€™d really like to be able do do this using a REST endpoint. Does that exist?

Sure thing! :slight_smile:

https://rest-testnet.onflow.org/v1/blocks?height=final

You can get other HTTP endpoints on Developer Portal: