Testing Smart Contracts


Tools covered

More: formal verification, professional auditing, bug bounties


What to test


Unit testing

Validate each unit of the code performs as designed
  • Make sure the input parameters are rejecting invalid values
  • Make sure the return values are within expected range and properly formatted
  • Testing of smart contract state changes
  • Event testing
  • Error testing


Prevent attacks and vulnerabilities

  • Floating points and precision
  • Arithmetic under/over flows
  • Unexpected ether
  • Entropy illusion
  • Front-running / race conditions
  • Tx.origin authentication
  • Denial of service
  • Re-entrancy
  • Delegate call


How to test