I'm trying to fully comprehend what is going on in a standard ERC721 token.
But this statement is really tripping me up:

// Mapping from owner to operator approvals
mapping (address => mapping (address => bool)) internal operatorApprovals;

Like what is a good way to think about a mapping of a mapping,

Like could someone please give me a minimalist example of why this is a useful data structure?

1 Answer 1


You can see the mappings as a sort of an array where the key can be any type (instead of just a numerical index) like the associative arrays in PHP or the Hashtable in C#. And two nested mappings just provide you another level with the same feature.

So to use that mapping in this way


to get the bool value


will only give you the other mapping which can contains multiple operators. Keys are unique. Check the Solidity doc for more info

  • 1
    Great explanation. I think it finally clicked for me. May 11, 2018 at 6:45

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.