Solidity provides access to a few global variables that are not declared within contracts but are accessible from code within contracts. Contracts cannot access the ledger directly. A ledger is maintained by miners only; however Solidity provides some information about the current transaction and block to contracts so that they can utilize them. Solidity provides both block-as well as transaction-related variables.
The following code illustratesexamples of using global transaction, block, and message 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 |
| Same as etherbase. Refers to the miner's address. |
| Difficulty level of current block. |
| Gas limit for current block. |
| Block number in sequence. |
| Time when block was... |