Solana Account Model

Information about how the Solana account model works
Solana's account model is different to that of other blockchains, such as Ethereum.
Before interacting with Aver, it is vital to understand how data is represented on-chain within the Aver protocol in the Aver Account Model section. However, some understanding of the Solana account model is required first.
The following Medium article is quoted throughout this section.

What is an account?

Accounts are arbitrary locations on the Solana blockchain which store 'live' state in the form of serialized byte buffers. Every account contains 5 pieces of information:
  1. 1.
    Lamports - Number of lamports (SOL 10^-9) owned by this account
  2. 2.
    Owner - Public key of the account that owns this account
  3. 3.
    Executable - Boolean value that indicates whether this is an executable account or data account, see account types below
  4. 4.
    Rent Epoch - See rent below
  5. 5.
    Data - In the case of an 'executable account', it is the executable byte code and in the case of a 'data account', it contains some arbitrary set of data for this account
Data in a 'data account' has no fixed structure. It depends on the type of account and it is up to the person reading from the blockchain to interpret this data.
Examples of account types:
  • Main wallet accounts have no additional data (beyond flags and lamport balances)
  • Token accounts describe the token and the balance of these tokens a participant has
  • Aver Market accounts describe the market properties, and store live values and key metrics required to enable the market to function (i.e - bids and asks for the orderbook are all stored on these accounts)

Account types

In Solana, accounts can be divided by two different types: executable and non-executable.
Executable account: This is a program (or 'Smart Contract'). It stores executable code that are immutable once deployed.
Non-executable account: This can be treated as a storage account. It is used to store changing variables, assets of an individual, etc.
When interacting with Aver, you will only be creating non-executable account types. These will be used to store information on a variety of areas (e.g. - how many tokens you have, which orders you've placed, etc.)
The only executable account type you will be interacting with is the Aver Program, which has been written prior.
You will have multiple accounts created when placing orders, which will hold different information. See the Aver Account Model section for more details.

Program Owner

In Solana, the person who owns the private key of the account is called the owner. Owner means a program that can amend data of an account. Every account in Solana has an owner. By default, all accounts are owned by Solana’s System Program.
In Solana nomenclature, the word program owner can sometimes be a little confusing. Even if you totally control an account, you may not be the program owner of the account. This is more of a technicality, but it is useful to be aware of it, as it can cause some confusion.


For storage accounts, participants have to keep certain lamports (smallest unit in SOL) in their account to keep it alive. Rent payable to validators shall be charged from these lamports. If lamports are deducted to zero, the account would be erased from the Blockchain.
The concept of rent is an essential differentiator between Solana and other blockchains. Rent helps to keep the network running fast by creating an economic incentive to ensure only useful information is stored on-chain.
In reality, almost all accounts on Aver don't pay rent; instead, they become rent-exempt. Accounts are not charged rent if they deposit the 'rent-exempt' amount of SOL into the account. This amount can be recovered later when the data no longer needs to be stored, and the account is removed from the blockchain's memory (i.e. after settlement has taken place for a market).
Aver has been designed to be as lean as possible in terms of the frictional costs involved - 'gas' for transactions costs, and 'rent' for in data storage costs.
While a wallet will need to fund the cost of this rent 'deposit' up-front so that their positions in a given market can be recorded, the Aver protocol will automatically handle the closing of this account (and returning of the rent to the original wallet) once the market has been resolved and settled.
Afterwards, this data no longer needs to be stored on the blockchain.
When placing an order on a market, you will first need a 'UserMarket' account. When creating this, the owner will need to pay the rent cost.
But don't worry, this does not mean to say that transaction history and record of interactions are gone forever - it's just that this data is no longer required to be stored 'live' in-state.
All transactions that occured on the blockchain are retained permanently within the transaction logs, and state at any given point in-time could be reconstructed.
A full, and detailed history of all interactions a wallet has had with the Aver protocol can be constructed at any time - either directly from the Solana blockchain's main transaction history (or more quickly/readily available from Aver's centralized copy of these records).

Tokens in Solana

If you have experience in Ethereum Smart Contract development, you will be aware that all tokens on Ethereum (ERC20 tokens) are handled by their own Smart Contracts. A Smart Contract manages a record of its holders’ addresses and the token balances within those addresses.
Other Smart Contracts or participants mainly call functions from the token’s Smart Contract to transfer tokens or conduct other actions related to the token. For more information, please refer to my another passage regarding ERC20 token.
...In Solana, handles aren't handled in the same way as they are on Ethereum...
Solana tokens ('SPL' tokens) are all storage accounts (normally called a 'Token Account'). This account records information such as the total supply of the token, mint authority, etc.
This information is managed by the Solana Token Program. So, the owner of the account is set to 'Token Program' instead of 'System Program'.
This information is important because when using Aver, you will often need to create an 'Associated Token Account' (ATA). This account stores information on how many tokens you have (e.g. - USDC token balance). Tokens are withdrawn from your ATA when placing orders.
Awareness of the technical details is not required - however, if you're interested you can read more here.