Skip to main content
Version: 1.0

Environment Information

Transaction Information​

To get the addresses of the signers of a transaction, use the address field of each signing AuthAccount that is passed to the transaction's prepare phase.

There is currently no API that allows getting other transaction information. Please let us know if your use-case demands it by request this feature in an issue.

Block Information​

To get information about a block, the functions getCurrentBlock and getBlock can be used:


  • _10
    view fun getCurrentBlock(): Block

    Returns the current block, i.e. the block which contains the currently executed transaction.


  • _10
    view fun getBlock(at: UInt64): Block?

    Returns the block at the given height. If the given block does not exist the function returns nil.

The Block type contains the identifier, height, and timestamp:


_35
access(all)
_35
struct Block {
_35
/// The ID of the block.
_35
///
_35
/// It is essentially the hash of the block.
_35
///
_35
access(all)
_35
let id: [UInt8; 32]
_35
_35
/// The height of the block.
_35
///
_35
/// If the blockchain is viewed as a tree with the genesis block at the root,
_35
// the height of a node is the number of edges between the node and the genesis block
_35
///
_35
access(all)
_35
let height: UInt64
_35
_35
/// The view of the block.
_35
///
_35
/// It is a detail of the consensus algorithm. It is a monotonically increasing integer
_35
/// and counts rounds in the consensus algorithm. It is reset to zero at each spork.
_35
///
_35
access(all)
_35
let view: UInt64
_35
_35
/// The timestamp of the block.
_35
///
_35
/// Unix timestamp of when the proposer claims it constructed the block.
_35
///
_35
/// NOTE: It is included by the proposer, there are no guarantees on how much the time stamp can deviate from the true time the block was published.
_35
/// Consider observing blocks’ status changes off-chain yourself to get a more reliable value.
_35
///
_35
access(all)
_35
let timestamp: UFix64
_35
}