Skip to content

This repository serves as a Solana BPF Assembly (sBPF) learning resource. It aims to guide developers, from beginners to experts, in writing low-level Solana programs in Assembly.

Notifications You must be signed in to change notification settings

7etsuo/Learn-Solana-BPF-Assembly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solana BPF Assembly (sBPF)

    ███        ▄████████     ███        ▄████████ ███    █▄   ▄██████▄  
▀█████████▄   ███    ███ ▀█████████▄   ███    ███ ███    ███ ███    ███ 
   ▀███▀▀██   ███    █▀     ▀███▀▀██   ███    █▀  ███    ███ ███    ███ 
    ███   ▀  ▄███▄▄▄         ███   ▀   ███        ███    ███ ███    ███ 
    ███     ▀▀███▀▀▀         ███     ▀███████████ ███    ███ ███    ███ 
    ███       ███    █▄      ███              ███ ███    ███ ███    ███ 
    ███       ███    ███     ███        ▄█    ███ ███    ███ ███    ███ 
   ▄████▀     ██████████    ▄████▀    ▄████████▀  ████████▀   ▀██████▀  
                                                                        

This repository serves as a Solana BPF Assembly (sBPF) learning resource. It aims to guide developers, from beginners to experts, in writing low-level Solana programs in Assembly. We consolidate project-specific technical documentation and highlight key examples from the broader Solana development community, featuring valuable work by developers like Dean 利迪恩 (@deanmlittle) and the Firedancer team to illustrate practical sBPF programming.

Key Features:

  • Progressive learning paths from foundational concepts to advanced topics.
  • Curated references to high-quality, optimized community examples.
  • Consolidated instruction set details, opcode tables, and sBPF specifics.
  • In-depth technical documentation on the sBPF execution model, memory map, and register usage.
  • Clear, organized navigation to help you find information quickly.

Connect with the Community:


📚 Documentation Overview

This documentation is structured to guide you through sBPF Assembly programming.

Core concepts for getting started with sBPF programming.

Detailed references for the sBPF assembly language.

(Partially Coming Soon) How sBPF programs interact with the Solana runtime.

  • Program Deployment (Coming Soon)
  • Testing Strategies (Coming Soon)
  • Development Workflow (Coming Soon)
  • Helper/Syscall Catalogue (Planned)

(Coming Soon) Deeper dives into complex sBPF programming aspects.

  • Account Interactions
  • Cross-Program Invocation
  • Program Derived Addresses
  • Heap Usage

Supplementary materials and detailed references.


💻 Code Examples

Learn by doing with these practical examples:

A minimal Solana program in assembly by Dean 利迪恩 (@deanmlittle). Optimized to just 336 bytes, it's a great starting point.

Calculates Fibonacci numbers using assembly, by Dean 利迪恩 (@deanmlittle). Demonstrates computation, achieving F(93) in only 653 CUs.

A complete token program implementation by Firedancer Contributors. Highly optimized, performing transfers in just 56 CUs.


🛠️ Getting Started

  1. Set Up Your Environment: Follow the Toolchain Setup guide.
  2. Build an Example Program: Refer to the instructions in an example directory, e.g., ./examples/sbpf-asm-noop/README.md.
  3. Deploy to Solana: Deployment guides will be available in the Solana Integration (Usage) section (coming soon).

📝 Contributing

Contributions are highly welcome! Please feel free to submit a Pull Request.

About

This repository serves as a Solana BPF Assembly (sBPF) learning resource. It aims to guide developers, from beginners to experts, in writing low-level Solana programs in Assembly.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published