Global variables

Solidity provides a number of global variables that are always available in the global namespace. These variables provide information about blocks and transactions. Additionally, cryptographic functions and address-related variables are available as well.

A subset of available functions and variables is shown as follows:

keccak256(...) returns (bytes32) 

This function is used to compute the Keccak-256 hash of the argument provided to the function:

ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) returns (address) 

This function returns the associated address of the public key from the elliptic curve signature:

block.number 

This returns the current block number.

Get Mastering Blockchain - Second Edition 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.