Question · Blockchain and Web3 course · Module 4: ethers.js & viem

Read vs Write Functions

What is the difference between view/pure functions and functions that change the contract's state?

Answer options

  • View/pure are free (they don't require gas), functions that change state require a transaction
  • View/pure are faster than state-changing functions
  • View/pure only work on mainnet
  • There's no difference, they're the same

You can check the correct answer by solving this task in the CodeWorlds game.