Is it possible to have a mapping
in Solidity with a hash
as key?
For example:
mapping (hash => uint) hashToInt;
If not, is there any way to group some information and put it as a key of a mapping
?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityYes, hash
was an old type that's been replaced with bytes32
. You can call keccak256(data1, data2, ...)
and use that as a key.