Gas Fee

  • Fee schedule in Ethereum Yellow Paper
  • Some opcodes are more expensive than others
    • e.g. multiplication costs 5 gas; shift left costs 3 gas
Image for Ethereum Blockchain mechanism Image Ethereum Modified Merkle-Paricia-Trie systme

Storage

  • A contract storage is persistent between function calls and transactions
  • It is a key-value mapping of 2256 keys. Each value is 32 bytes

Memory

  • Memory is volatile
  • It is mainly used to store data during execution
  • Each message call starts with a cleared memory

Stack

  • All computations are performed on the stack
  • It has a maximum of 1024 elements
  • Access to stack is limited to the top elements
  • Access to elements by pop/push to stack

Smart contract Storage

  • This is where state variables are stored
  • It is persistent between function calls and transactions
  • It is a key-value mapping of 2256 keys; each value is 32 bytes long
### Benefits of Inline Assembly - Code could be more gas efficient - Bypass Solidity safety checks - Less code, less gas fee - Some operations only available in assembly