Skip to content

SVM

SVM (Solana Virtual Machine)

SVM (Solana Virtual Machine) is the execution environment for Solana smart contracts, responsible for running eBPF bytecode programs. SVM's parallel execution capability is the core of Solana's high performance.

Core Features

Parallel Execution SVM's greatest innovation is the parallel execution of multiple smart contracts: - Analyzes account dependencies of transactions - Processes non-conflicting transactions in parallel - Fully utilizes multi-core CPUs

eBPF Runtime SVM executes eBPF bytecode: - Register-based virtual machine - JIT compiled to native code - Performance close to native programs

Account Model Programs and data are separated: - Programs are read-only - Data is stored in independent accounts - Supports concurrent access

Parallel Execution Mechanism

Sealevel Runtime Sealevel is SVM's parallel execution engine:

  1. Dependency Analysis
  2. Extracts the accounts accessed by each transaction
  3. Builds an account dependency graph
  4. Identifies parallelizable transactions

  5. Dispatch and Execution

  6. Assigns non-conflicting transactions to different CPU cores
  7. Executes conflicting transactions serially
  8. Maximizes parallelism

  9. State Merging

  10. After parallel execution completes
  11. Merges state updates
  12. Writes to AccountsDB

Comparison with EVM

Feature SVM EVM
Parallelism Supported Not supported (serial)
Architecture Register-based Stack-based
Bytecode eBPF EVM bytecode
Languages Rust, C Solidity
Account Model Program/data separation Self-contained contracts
Performance Extremely high Moderate

Execution Flow

1. Load Program Load eBPF bytecode from the chain.

2. Load Accounts Read the account data involved in the transaction.

3. Execute - JIT compile eBPF - Execute program logic - Record CU consumption

4. Verify - Check account ownership - Verify signatures - Ensure resource limits

5. Commit Write state updates to AccountsDB.

Compute Limits

CU Limits - Per transaction: 200,000 - 1,400,000 CU - Prevents infinite loops - Ensures fair resource allocation

Call Depth - CPI (Cross-Program Invocation) maximum depth of 4 levels - Prevents stack overflow

Account Limits - Maximum of 64 writable accounts per transaction - Accounts must be declared in advance

Security Mechanisms

Sandbox Isolation Programs run in a restricted environment: - Cannot access the file system - Cannot access the network - Cannot call system APIs

Static Verification The eBPF verifier checks for: - No infinite loops - No illegal memory access - Compliance with instruction limits

Runtime Checks - CU consumption monitoring - Account permission verification - Signature verification

SVM Ecosystem

SVM Chain Family Multiple projects adopt SVM as their execution layer: - Eclipse: SVM + Ethereum settlement - Sonic: A gaming-optimized SVM chain - Nitro: Another SVM L2

Advantages - Inherits Solana's high performance - Compatible with Solana's toolchain - Shares the developer ecosystem

Ongoing Optimization

Performance Improvements - Optimizing JIT compilation - Reducing account loading overhead - Improving parallel scheduling algorithms

Feature Expansion - Supporting new system calls - Enhancing cross-program invocation - Improving error handling

Impact on Developers

High Performance SVM enables developers to build high-throughput applications.

Parallelism-Friendly Account access patterns must be considered during design to avoid unnecessary conflicts.

Mature Toolchain Frameworks like Anchor simplify SVM program development.

  • eBPF: The bytecode format executed by SVM
  • Sealevel: SVM's parallel runtime
  • CU (Compute Units): The unit measuring program execution consumption
  • EVM: Ethereum Virtual Machine, a counterpart to SVM
  • Parallel Execution: SVM's core advantage