What is the Aver Protocol?

Aver is an orderbook powered betting and prediction protocol that lives entirely on the blockchain. It enables the exchange of bets between peers via a decentralized exchange without the need for a trusted third party to stand in the middle.
It uses a combination of executable logic (referred to as the 'on-chain program' or sometimes as the 'smart contract') and a large number of 'Account states' (locations on the blockchain where data can be stored and updated subject to programmatic logic and authorizations) to facilitate this.

Overview of the Flow of Interactions

When any action is taken on Aver, it starts off with a Transaction addressed to the Aver program being sent to the Solana blockchain.
This Transaction might contain one-or-more Instructions. An instruction might be to create a new market, to place an order, or to trigger settlement of winnings (to name a few).
The program assesses the instructions and performs a number of steps to determine whether any on-chain state should be updated, and how it should be updated. This includes:
  • Checking if valid parameters have been passed
  • Checking if the requesting wallet has the necessary criteria and permissions to permit the requested action
  • Checking whether the wallet has indeed requested the action (by validating cryptographically that the wallet 'signed' the transaction)
  • Checking that the a given Market permits this of actions in it's current status, and given properties of components of it's state (for example, does the market remain actively traded or has it been ceased - for example when the underlying event has taken place)
  • Determining whether (and what) value needs to be moved around - i.e. transferring funds to-or-from different wallets of accounts as a result of a valid/permitted actions
  • Determining whether (and what) other values or states need to be updated as a result of processing this action (if it checks out and is permitted) - for example, changing a status, recording a change in position/exposure or updating a piece of data or information
The program specifies all of this logic and the conditions and validations that need to be performed to verify and execute actions in a trustless way.

Account Model

Keeping track of thousands of wallets, their token balances, their exposures in different markets, etc. generates a lot of data, or 'state'.
To store this data, the Solana blockchain uses an 'Account Model', whereby arbitrary pieces of data can be stored at different addresses on the blockchain and be updated (subject to the program's own validations) by a program which 'owns' that account.
Read more about this in the Solana Account Model section.
The program itself can then interpret (deserialize) and create/alter/overwrite this data (serialize) within this account across the blockchain. How these pieces of data are interpreted is entirely down to the program.
The Aver Account Model consists of a number of different account types - for example, to descibe markets, record a given participant's positions and orders in a given market, to store funds/collateral, and to track and match open orders.

On-chain Matching

The entire process of placing, posting, matching and settling orders occurs on-chain, and is executed within the on-chain program's logic, and recording the necessary changes in state within the account model.
You can learn more about how this takes place here.