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:
![](https://static.packt-cdn.com/products/9781788831383/graphics/assets/47ab807b-7ede-4077-b146-7c7cd03f689f.png)