Dwarves
Memo
Type ESC to close search bar

Solana Account

Unlike most blockchain, Solana separates logic and data into two separate components: Program and Account. What that means is that instead of storing data inside variables internally, Programs interact with external data stored in Accounts with the ability to mutate them.

Account model

There are 3 kinds of accounts:

Each account has an address (usually a public key) and an owner (address of a program account). The full field list an account stores is found below.

FieldDescription
lamportsThe number of lamports owned by this account
ownerThe program owner of this account
executableWhether this account can process instructions
dataThe raw data byte array stored by this account
rent_epochThe next epoch that this account will owe rent

Ownership rules

There are a few important ownership rules:

Technically, the Programs are special kinds of Accounts marked as executable whose entire purpose is to store the compiled code of Program. The program accounts do not store state.

For example, if you create a counter program that lets you increment a counter, you must create two accounts, one account (account A) to store the program’s code (executable = true), and one (account B) to store the counter value and account A must be the owner of account B.

Rent

References