Are Local Variables Mutable by the User?

Hi, I was wondering if I understood how local variables work correctly on Algorand. To my understanding, when an account opts into a contract, the variable is added to the accounts balanced record.

Does this mean that the local variable is stored in the users wallet? If the local variable isn’t on the blockchain does this mean a user could manipulate their own local variables without interacting with the application?

I’m asking this question because I’m wondering if I’m able to design an app where the user takes on certain local variables but am worried about whether the users can manipulate their own local variables to their advantage (e.g. a contract or a loan where the amount stored is local per a user).

So called local storage I think might be a poor name. Additionally, I think you’re getting mixed up with how data on chain is stored.

The balance record for a given account is always available on chain. It isn’t stored in some wallet on a device. A wallet is just for signing transactions, it stores the secret keys and provides an API to sign transactions. The actual storage for account information is in the globally available ledger.

With that explained, local storage is really app storage for a given account. Only the app can modify the local storage values. The exception to that being that an account can clear state at any time to opt out of the application.

2 Likes