# Global Variables

### Block and Transaction Properties

* `blockhash(uint blockNumber) returns (bytes32)`: hash of the given block when `blocknumber` is one of the 256 most recent blocks; otherwise returns zero
* `block.basefee (uint)`: current block’s base fee
* `block.chainid (uint)`: current chain id
* `block.coinbase (address payable)`: current block miner’s address
* `block.gaslimit (uint)`: current block gaslimit
* `block.number (uint)`: current block number
* `block.timestamp (uint)`: current block timestamp as seconds since unix epoch
* `gasleft() returns (uint256)`: remaining gas
* `msg.data (bytes calldata)`: complete calldata
* `msg.sender (address)`: sender of the message (current call)
* `msg.sig (bytes4)`: first four bytes of the calldata (i.e. function identifier)
* `msg.value (uint)`: number of wei sent with the message
* `tx.gasprice (uint)`: gas price of the transaction
* `tx.origin (address)`: sender of the transaction (full call chain)

### Error handling

* `assert(bool condition)`: causes a Panic error and thus state change reversion if the condition is not met - to be used for internal errors.
* `require(bool condition)`: reverts if the condition is not met - to be used for errors in inputs or external components.
* `require(bool condition, string memory message)`: reverts if the condition is not met - to be used for errors in inputs or external components. Also provides an error message.
* `revert()`: abort execution and revert state changes
* `revert(string memory reason)`: abort execution and revert state changes, providing an explanatory string

### Members of Address Types

* `<address>.balance (uint256)`: balance of the Address in Wei
* `<address>.code (bytes memory)`: code at the Address (can be empty)
* `<address>.codehash (bytes32)`: the codehash of the Address
* `<address payable>.transfer(uint256 amount)`: send given amount of Wei to Address, reverts on failure, forwards 2300 gas stipend, not adjustable
* `<address payable>.send(uint256 amount) returns (bool)`: send given amount of Wei to Address, returns false on failure, forwards 2300 gas stipend, not adjustable
* `<address>.call(bytes memory) returns (bool, bytes memory)`: issue low-level CALL with the given payload, returns success condition and return data, forwards all available gas, adjustable
* `<address>.delegatecall(bytes memory) returns (bool, bytes memory)`: issue low-level DELEGATECALL with the given payload, returns success condition and return data, forwards all available gas, adjustable
* `<address>.staticcall(bytes memory) returns (bool, bytes memory)`: issue low-level STATICCALL with the given payload, returns success condition and return data, forwards all available gas, adjustable

### Contract-related keywords

* `this`: The current contract, explicitly convertible to Address
* `super`: A contract one level higher in the inheritance hierarchy
* `selfdestruct(address payable recipient)`: Destroy the current contract, sending its funds to the given Address and end execution. Note that selfdestruct has some peculiarities inherited from the EVM:
  * the receiving contract’s receive function is not executed.
  * the contract is only really destroyed at the end of the transaction and revert s might “undo” the destruction.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bootcamp.openguild.wtf/smart-contract-development/advanced-solidity/global-variables.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
