This forum is a read-only archive. Posting, replying and signing in are disabled.

Local Storage Read

isha

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.

✔ Solved by fabrice in post #4
fabrice

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

isha

Does that mean local storage is not stored on blockchain?

fabrice

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.
✔ Solution
tsachi

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

fabrice
↩ in reply to cc9one

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.