current location:Home >> Solana Tutorial >> solana account model with diagram

solana account model with diagram

admin Solana Tutorial 752

Solana Account Model

The Solana account model is a fundamental part of its architecture, differing significantly from the UTXO model (used by Bitcoin) and the account-based model (used by Ethereum). Here's an explanation with a conceptual diagram.

Key Concepts

  1. solana account model with diagram

    Accounts as Objects: Everything in Solana is stored in accounts - programs (smart contracts), data, and even the programs themselves.

  2. Two Types of Accounts:

    • Program Accounts: Store executable code (smart contracts)

    • Data Accounts: Store data (user accounts, token accounts, etc.)

  3. Account Fields:

    • Lamports: The account's balance in lamports (1 SOL = 1 billion lamports)

    • Owner: The program that owns the account

    • Executable: Whether the account is a program

    • Data: The raw data stored in the account

    • Rent Epoch: When the account will next owe rent

Solana Account Model Diagram

┌─────────────────────────────────────────────────────────────┐
│                       Solana Account                        │
├──────────────┬──────────────┬──────────────┬───────────────┤
│   Lamports   │    Owner     │ Executable   │    Data       │
│ (balance)    │ (program ID) │ (true/false) │ (raw bytes)   │
└──────────────┴──────────────┴──────────────┴───────────────┘
        ▲              ▲              ▲              ▲
        │              │              │              │
        │              │              │              │
┌───────┴───────┐ ┌────┴─────┐ ┌──────┴──────┐ ┌─────┴───────┐
│ Native SOL    │ │ System    │ │ Program    │ │ Can store:  │
│ or SPL tokens │ │ Program   │ │ Account    │ │ - Metadata  │
│               │ │ or other  │ │ (if true)  │ │ - State     │
│               │ │ program   │ │            │ │ - PDA seeds │
└───────────────┘ └───────────┘ └────────────┘ └─────────────┘

Program Derived Accounts (PDAs)

┌─────────────────────────────────────────────────────────────┐
│                   Program Derived Account                   │
├─────────────────────────────────────────────────────────────┤
│ • Created by programs (not users)                           │
│ • No private key (derived from program ID + seeds)          │
│ • Can only be signed by the deriving program                │
│ • Used for cross-program invocation and state management    │
└─────────────────────────────────────────────────────────────┘

Account Relationships

┌─────────────┐    owns     ┌─────────────┐
│  Program    ├─────────────► Data Account│
│  Account    ◄─────────────┤             │
└─────────────┘    used by  └─────────────┘
       ▲
       │
       │ creates
       │
┌──────┴───────┐
│ Program      │
│ Derived      │
│ Account (PDA)│
└──────────────┘

Key Features

  1. Rent Mechanism: Accounts must maintain a minimum balance or pay rent (recently made optional with the 1.8 upgrade)

  2. Account Size: Fixed size when created, must specify maximum size upfront

  3. Ownership Model: Only the owning program can modify an account's data

  4. Parallel Processing: The account model enables parallel transaction processing by identifying which accounts a transaction will modify

This model enables Solana's high throughput by making it clear which state will be modified by transactions, allowing for parallel execution.

If you have any questions or uncertainties, please join the official Telegram group: https://t.me/GToken_EN

GTokenTool

GTokenTool is the most comprehensive one click coin issuance tool, supporting multiple public chains such as TON, SOL, BSC, etc. Function: Create tokensmarket value managementbatch airdropstoken pre-sales IDO、 Lockpledge mining, etc. Provide a visual interface that allows users to quickly create, deploy, and manage their own cryptocurrencies without writing code.

Similar recommendations