Learn Pentesting like a Pro!

Share this post

Solidity Cheat Sheet

pentesting.academy

Solidity Cheat Sheet

Quick review to the most relevant global variables used in Solidity smart contracts

pentesting.academy
Jul 9, 2022
Share this post

Solidity Cheat Sheet

pentesting.academy

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()

Thanks for reading Learn Pentesting like a Pro! Subscribe for free to receive new posts.

Share this post

Solidity Cheat Sheet

pentesting.academy
Comments
TopNew

No posts

Ready for more?

© 2023 pentesting.academy
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing