I am trying to do something simple:

examsFinalHash = keccak256(examHash + msg.sender);

but I get the following error:

TypeError: Operator + not compatible with types string memory and address payable

I am new to solidity. Please help. Also, where in the solidity Docs can I find a reference to types and their characteristics?

1 Answer 1


I think that the classic


is a good choice to begin.

Your error is simply the result of a tentative sum of type address with type string: it cannot work. In a previous version of the compiler it could have worked for conventional reasons: in that case the + operator in the kecca256 parentheses was there to say “pack this arguments”.

Given this, using the compilers of 5.x generation you are asked to explicitly pack the argument of kecca256 because of a language redefinition after version 5.0 or so of the compiler.

For instance

keccak256(abi.encodePacked(a, b))

is now required instead of the old

keccak256(a + b)

Check the documentation: it can help very much!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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