3

If I have a deployed Solana Program which creates some Solana accounts for storing data in it. Can these Solana accounts be accessed by any other Solana program using the account addresses? I am confused about the security features for the data stored in the account since accounts are mutable and if any other program can access it then there's a risk of data getting changed right?

1 Answer 1

5

Reading

Any program can read data from and credit SOL to any Solana account.

Writing

Where permission to write to an account is concerned, there are restrictions. All Solana accounts have a field of metadata on them named owner. In that field you will find the address of a program. The Solana runtime will only grant a program write access to an account if the program's address matches the address stored in the owner field of the account being written to.

Example

By default, newly created accounts are owned by the System Program[1]. Writes to these accounts are thereby mediated by the System Program. As an example: let's say that you wanted to debit an account (ie. transfer some SOL tokens out of it). Since the System Program is the only program that can perform such a mutation, you will have to convince it to do so on your behalf. The canonical way to do this is to call its Transfer instruction. In order for that instruction to succeed, the System Program will require that you produce a cryptographic signature as proof that you own the account being debited.


[1] The address of the System Program is 11111111111111111111111111111111.

4
  • What about accessing a user deployed solana program? Who can access that? Feb 24, 2023 at 11:46
  • What do you mean by ‘accessing,’ @RounakNaik? If your question is ‘who can execute a user deployed Solana program,’ executing is a kind of reading; you can execute any program that you can read (which is all of them). Mar 3, 2023 at 18:17
  • by 'accessing' I mean who can write data or change data stored in Solana accounts? Mar 16, 2023 at 17:54
  • Read about the upgrade authority and immutabillity. Mar 17, 2023 at 0:17

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.