Solana
References:
programming-on-solana-an-introduction
The reason we have accounts is because Solana programs are stateless
.
Programs themselves are stored in accounts which are marked executable. Each account can hold data and SOL (opens new window). Each account also has an owner and only the owner may debit the account and adjust its data.
Accounts can only be owned by programs.
In theory, programs have full autonomy over the accounts they own. It is up to the program’s creator to limit this autonomy and up to the users of the program to verify the program’s creator has really done so.
All accounts to be read or written to must be passed into the entrypoint function
1 |
|
The flow of a program using this structure looks like this:
- Someone calls the entrypoint
- The entrypoint forwards the arguments to the processor
- The processor asks
instruction.rs
to decode theinstruction_data
argument from the entrypoint function. - Using the decoded data, the processor will now decide which processing function to use to process the request.
- The processor may use
state.rs
to encode state into or decode the state of an account which has been passed into the entrypoint.