Receber por email
← Voltar para o catálogo

solana-development

Crie programas Solana usando o framework Anchor ou Rust nativo. Esta skill abrange o desenvolvimento de contratos inteligentes, operações de token, testes, implantação e desenvolvimento geral em Solana, incluindo Anchor de alto nível e Rust nativo de baixo nível.

29estrelas
Atualizado há 4 meses

Ver no GitHub ↗ Licença: MIT

Como adicionar

/plugin marketplace add tenequm/skills

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Para o autor da skill

Cole no README do seu repo

Mostra que sua skill está catalogada na Skillteca, gera backlink e tráfego rastreável.

[![Skillteca](https://www.skillteca.com.br/api/badge/solana-development/svg)](https://www.skillteca.com.br/skills/solana-development)

Alerta por categoria

Receba novas skills de Design e Frontend toda segunda

1 email curto, só com as skills novas de Design e Frontend. 4 minutos de leitura, sem spam, cancela com 1 clique.

Você confirma o email no primeiro envio. Sem spam. Cancela com 1 clique.

Ler descrição completa

Solana Development

Build Solana programs using Anchor framework or native Rust. Both approaches share the same core concepts (accounts, PDAs, CPIs, tokens) but differ in syntax and abstraction level.

Quick Start

Recommended: Anchor Framework

Anchor provides macros and tooling that reduce boilerplate and increase developer productivity:

use anchor_lang::prelude::*;

declare_id!("YourProgramID");

#[program]
pub mod my_program {
    use super::*;

    pub fn initialize(ctx: Context<Initialize>, data: u64) -> Result<()> {
        ctx.accounts.account.data = data;
        Ok(())
    }
}

#[derive(Accounts)]
pub struct Initialize<'info> {
    #[account(init, payer = user, space = 8 + 8)]
    pub account: Account<'info, MyAccount>,
    #[account(mut)]
    pub user: Signer<'info>,
    pub system_program: Program<'info, System>,
}

#[account]
pub struct MyAccount {
    pub data: u64,
}

When to use Anchor:

  • Building DeFi, NFT, or standard programs
  • Need TypeScript client generation with IDL
  • Want faster development with less boilerplate
  • Following common Solana patterns
  • New to Solana development

Installation:

cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
avm install latest
avm use latest
anchor --version

Create project:

anchor init my_project
cd my_project
anchor build
anchor test

→ See [references/anchor.md](references/anchor.md) for complete Anchor guide

Advanced: Native Rust

Native Rust provides maximum control, optimization potential, and deeper understanding of Solana's runtime:

use solana_program::{
    account_info::AccountInfo,
    entrypoint,
    entrypoint::ProgramResult,
    pubkey::Pubkey,
    msg,
};

entrypoint!(process_instruction);

pub fn process_instruction(
    program_id: &Pubkey,
    accounts: &[AccountInfo],
    instruction_data: &[u8],
) -> ProgramResult {
    msg!("Processing instruction");
    // Manual account parsing and validation
    // Manual instruction routing
    Ok(())
}

When to use Native Rust:

  • Need maximum compute efficiency (CU optimization critical)
  • Require advanced features (versioned transactions, durable nonces, ALTs)
  • Learning Solana fundamentals from first principles
  • Building highly optimized or specialized programs
  • Framework overhead is unacceptable

Setup:

cargo new my_program --lib
cd my_program
# Configure Cargo.toml (see native-rust.md)
cargo build-sbf

→ See [references/native-rust.md](references/native-rust.md) for complete native Rust guide

Core Concepts

Essential knowledge for all Solana developers, regardless of framework:

Foundational Concepts

  • [accounts.md](references/accounts.md) - Account model, ownership, rent, validation patterns
  • [pda.md](references/pda.md) - Program Derived Addresses: derivation, canonical bumps, signing patterns
  • [cpi.md](references/cpi.md) - Cross-Program Invocations: calling other programs safely

Program Integration

  • [tokens-overview.md](references/tokens-overview.md) - Token account structures and ATAs
  • [tokens-operations.md](references/tokens-operations.md) - Create, mint, transfer, burn, close operations
  • [tokens-validation.md](references/tokens-validation.md) - Account validation patterns
  • [tokens-2022.md](references/tokens-2022.md) - Token Extensions Program features
  • [tokens-patterns.md](references/tokens-patterns.md) - Common patterns and security
  • [testing-overview.md](references/testing-overview.md) - Test pyramid and strategy
  • [testing-frameworks.md](references/testing-frameworks.md) - Mollusk, Anchor test, Native Rust
  • [testing-practices.md](references/testing-practices.md) - Best practices and patterns
  • [surfpool.md](references/surfpool.md) - Local development with Surfpool: mainnet forking, cheatcodes, IaC
  • [deployment.md](references/deployment.md) - Deploy, upgrade, verify, and manage programs
  • [production-deployment.md](references/production-deployment.md) - Verified builds for production (Anchor 0.32.1 workflow)

Client-Side Development

  • [client-development.md](references/client-development.md) - dApp client: wallet connections, React hooks, SOL/SPL transfers, transaction management. Covers framework-kit (recommended for dApps) and @solana/kit 6.x (server-side/scripts)

Implementation Details

  • [serialization.md](references/serialization.md) - Account data layout, Borsh, zero-copy patterns
  • [error-handling.md](references/error-handling.md) - Custom error types, propagation, client-side handling
  • [security.md](references/security.md) - Security best practices and defensive programming patterns

Advanced Features

  • [compute-optimization.md](references/compute-optimization.md) - CU optimization techniques and benchmarking
  • [versioned-transactions.md](references/versioned-transactions.md) - Address Lookup Tables for 256+ accounts
  • [durable-nonces.md](references/durable-nonces.md) - Offline signing with durable transaction nonces
  • [transaction-lifecycle.md](references/transaction-lifecycle.md) - Submission, retry patterns, confirmations

Low-Level Details

  • [sysvars.md](references/sysvars.md) - System variables (Clock, Rent, EpochSchedule, SlotHashes)
  • [builtin-programs.md](references/builtin-programs.md) - System Program and Compute Budget Program

Resources

  • [resources.md](references/resources.md) - Official docs, tools, learning paths, community

Common Tasks Quick Reference

Create a new program:

  • Anchor: anchor init my_project → [anchor.md#getting-started](references/anchor.md)
  • Native: cargo new my_program --lib → [native-rust.md#setup](references/native-rust.md)

Initialize a PDA account:

  • Anchor: Use #[account(init, seeds = [...], bump)] → [pda.md#anchor](references/pda.md)
  • Native: Manual invoke_signed with System Program → [pda.md#native](references/pda.md)

Transfer SPL tokens:

  • Anchor: Use anchor_spl::token::transfer → [tokens-operations.md#transferring-tokens](references/tokens-operations.md)
  • Native: CPI to Token Program → [tokens-operations.md#transferring-tokens](references/tokens-operations.md)

Test your program:

  • Both: Mollusk for fast unit tests → [testing-frameworks.md#mollusk-testing](references/testing-frameworks.md)
  • Anchor: anchor test for integration tests → [testing-frameworks.md#anchor-specific-testing](references/testing-frameworks.md)

Local development with mainnet forking:

  • Both: surfpool start for mainnet-forked local network → [surfpool.md](references/surfpool.md)

Test with mainnet state (Jupiter, Raydium CPIs):

  • Both: Use Surfpool JIT forking → [surfpool.md#mainnet-forking](references/surfpool.md)

Profile compute units in detail:

  • Both: surfnet_profileTransaction cheatcode → [surfpool.md#transaction-profiling](references/surfpool.md)

Deploy to devnet:

  • Anchor: anchor deploy → [deployment.md#anchor](references/deployment.md)
  • Native: solana program deploy → [deployment.md#native](references/deployment.md)

Deploy to production (verified builds):

  • Both: solana-verify build + solana program deploy → [production-deployment.md](references/production-deployment.md)

Optimize compute units:

  • Both: Profile with Mollusk bencher → [compute-optimization.md](references/compute-optimization.md)

Handle 40+ accounts:

  • Both: Use Address Lookup Tables → [versioned-transactions.md](references/versioned-transactions.md)

Offline transaction signing:

  • Both: Use durable nonces → [durable-nonces.md](references/durable-nonces.md)

Decision Guide

| Your Need | Recommended Approach | Reason | |-----------|---------------------|---------| | Standard DeFi/NFT program | Anchor | Faster development, proven patterns | | TypeScript client needed | Anchor | Auto-generates IDL and client types | | Learning Solana fundamentals | Native Rust first | U

Compartilhar X LinkedIn