...by Daniel Szego
quote
"Simplicity is the ultimate sophistication."
Leonardo da Vinci

Sunday, December 10, 2017

Solidity and Truffle Tips and Tricks - private variable visibility


There is a possibility to set a variable in an explicit way to private like:

uint private _privateVariable;

It means that the variable is not accessible directly from the outside world, neither it is accessible from inherited contracts. As opposed to the standard visibility without any modification that is not reachable from the outside world either, however it is accessible from an inherited contract. However, it is important to note that "private" only means that it is not visible from other contracts, the blockchain despite contains the information in a public way ! So it is not the best idea to store really private information in such a variables, even if they are marked as "private".