Local Storage Read

Hi, I am trying to understand local and global storage of statefull smart contract.
I get it that global can be read and written by anyone. But not sure how local storage works?
If anyone has idea about it please let me know.

1 Like

Both local and global storage can be read by any stateful application, and can only be written by the application that owns them.

Differences between the two are: where they are stored, the maximum limits, and the necessity for opt-in for local storage. See Your First Application - Algorand Developer Portal

1 Like

Does that mean local storage is not stored on blockchain?

Both local storage and global storage are stored on the blockchain.

“where they are stored” was meant to mean “where exactly in the node database representing the blockchain, they are stored”:

  • global storage is stored at the “application” level: it’s unique per application.
  • local storage is stored at the “account” level: it’s unique per application and per account.

Oh okay great that helps
Thank you

Does this mean that local storage can securely contain confidential information?

Both local and global information is stored on the blockchain, and you shpuld avoid storing secrets and/or sensetive information there.

1 Like

To be very clear: everything on the blockchain is public.
You cannot store any private/confidential information on a blockchain.
This is true for Algorand and most, if not all, the other public blockchains.

If you need to store private information, you need to use cryptographic techniques such as encryption and commitments.

Note: Some blockchains provide privacy for transactions, but it’s a very different story. It does not allow you to “store” information per se.