can I add a modifier (for ex: onlyOwner) to a mapping? only I must see the value of mapping's key by myself(onlyowner).
mapping (address => bool) onlyOwner getAddress;
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 community
It's actually part of a broader concern.
You can put access control on a read-only function, but an adversary will:
Therefore, an adversary will get around any notion of confidentiality you construct.
private doesn't change that. The most you can do is inconvenience a determined adversary.
Since it is transparent in any case, I generally advise against any restrictions on read-only functions and, in fact, incline to completely discoverable states.
Confidential information just won't exist in a contract state because it shouldn't be there.
Hope it helps.