I am using openzeppelin ERC721 smart contract. That smart contract have a mapping's called :

mapping(address => uint256) private _balances;
mapping(uint256 => address) private _owners;

Can we change their type from private to public without violating the ERC721 standard? Or will it violate the standard.

My use-case is that I want to update their value inside a function call but since they are private I cannot inherit them to update or modify.

1 Answer 1


There are functions that you can modify or retrieve the state of the contract itself, which makes it a standard. Using these provided functionalities, these private state variables can be manipulated. Changing these variables from private to public, and implementing different functions that can manipulate these state variables would make it a different type of contract that may not be fitting in ERC721 standards. That doesn't mean you cannot invent or develop a new way of a contract standart, however it won't be ERC721 anymore.

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.