Transaction and message global variables

The following is a list of global variables along with their data types and a description provided as a ready reference:

Variable name

Description

block.coinbase (address)

Same as etherbase. Refers to the miner's address.

block.difficulty (uint)

Difficulty level of current block.

block.gaslimit (uint)

Gas limit for current block.

block.number (uint)

Block number in sequence.

block.timestamp (uint)

Time when block was created.

msg.data (bytes)

Information about the function and its parameters that created the transaction.

msg.gas (uint)

Gas unused after execution of transaction.

msg.sender (address)

Address of caller who invoked the function.

Get Solidity Programming Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.