Understand the Pyth on-chain account structure
mainPyth manages on-chain data using a hierarchical relationship between three main account types. This structure allows for efficient mapping of products to their respective price data.
Account Hierarchy
- Mapping Accounts: A linked list of accounts that contain lists of
productaccount IDs (public keys). - Product Accounts: Contain reference attributes for a specific asset (e.g., BTC/USD). Attributes are stored as text key/value pairs (e.g.,
symbol,asset_type,quote_currency,tenor). - Price Accounts: A linked list of accounts referenced by a
product. Eachpriceaccount represents a specificprice_type(currentlyprice,twap, orvolatility).
Relationship Diagram
mapping $\rightarrow$ product $\rightarrow$ price (price/twap/volatility)