Solidity Cheat Sheet
Quick review to the most relevant global variables used in Solidity smart contracts
Solidity Global Variables
block methods:
block.coinbase
block.difficulty
block.gaslimit
block.number
block.timestamp
block.blockhash(uint blockNumber)
msg methods:
msg.data
msg.gas
msg.sender: immediate account that invoked the function
msg.sig
msg.value
tx methods:
tx.gasprice
tx.origin: external account that initiated the tx
contract methods:
contract.this
contract.selfdestruct
contract.suicide
address methods:
address.balance
address.transfer(): uint wei
address.send(): uint wei
address.call(): bytes4(sha3("<FUNCTION>(params)"))
address.callcode()
address.delegatecall()
error handling:
require(<CONDITION>)
assert(<CONDITION>)
revert()
Others:
now
sha3 = keccak256()
sha2 = sha256()