stateMutability: a string with one of the following values: pure (specified to not read blockchain state), view (specified to not modify the blockchain state), nonpayable and payable (same as payable above).

constant: true if function is specified to never modify blockchain state; payable: true if function accepts ether, defaults to false.

  • Within the original design some use cases were not possible to express. For example a pure function doesn't have an equivalent.
    – Ismael
    Feb 23, 2018 at 14:13

1 Answer 1


constant has been deprecated in favour of pure and view - see here

pure is used for functions where state isn't even read (e.g. safeMath type functions) whereas view is used for functions which don't change state but do read from it.

in terms of the ABI, constant was retained for backward compatibility:


JSON ABI has a new field statemutability introduced with a string value as above

JSON ABI keeps constant/payable for backwards compatibility for a while

Source: Axic's comment on 15 Aug 2017 here

  • I guess the OP is not interested in the difference between pure/view/constants etc. He is asking why the abi contains stateMutability term since view/constant are already defined in the function signature. Feb 23, 2018 at 12:06
  • The answer is clear. constant and payable was retained for backward compatibility. Thank you!
    – Anderson
    Feb 24, 2018 at 9:44

Not the answer you're looking for? Browse other questions tagged or ask your own question.