Navigate:
Anchor
~$ANCHO0.2%

Anchor: Solana Program Development Framework

A Rust-based framework for building Solana programs with IDL generation and TypeScript client support.

LIVE RANKINGS • 03:09 AM • STEADY
OVERALL
#282
134
CRYPTO
#10
10
30 DAY RANKING TREND
ovr#282
·Crypt#10
STARS
4.9K
FORKS
1.8K
7D STARS
+11
7D FORKS
+2
Tags:
See Repo:
Share:

Learn more about Anchor

Anchor is a development framework for building programs on the Solana blockchain. It provides a Rust embedded domain-specific language (eDSL) that abstracts low-level Solana program development complexities. The framework generates Interface Description Language (IDL) specifications from Rust code and includes tooling for TypeScript client generation. Anchor includes CLI tools for workspace management and is commonly used for developing decentralized applications on Solana.

Anchor

1

Rust eDSL

Provides high-level Rust abstractions for Solana program development with account validation and serialization handling.

2

IDL Generation

Automatically generates interface specifications from Rust code, enabling type-safe client generation across multiple languages.

3

Complete Toolchain

Includes CLI tools, workspace management, and both Rust and TypeScript client libraries for full-stack development.


use anchor_lang::prelude::*;

declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");

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

    pub fn initialize(ctx: Context<Initialize>, data: u64) -> Result<()> {
        let my_account = &mut ctx.accounts.my_account;
        my_account.data = data;
        my_account.authority = ctx.accounts.user.key();
        Ok(())
    }

    pub fn update(ctx: Context<Update>, new_data: u64) -> Result<()> {
        let my_account = &mut ctx.accounts.my_account;
        my_account.data = new_data;
        Ok(())
    }
}

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

#[derive(Accounts)]
pub struct Update<'info> {
    #[account(
        mut,
        has_one = authority
    )]
    pub my_account: Account<'info, MyAccount>,
    pub authority: Signer<'info>,
}

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


vv0.32.1

The 0.32.1 patch release is here. This patch is aimed to fix the `anchor deploy` race condition found in `0.32.0`.

  • The 0.32.1 patch release is here
  • This patch is aimed to fix the `anchor deploy` race condition found in `0.32.0`
vv0.32.0

The 0.32.0 major release is here. This release targets a number of optimizations we wanted to make before 1.0 major release.

  • The 0.32.0 major release is here
  • This release targets a number of optimizations we wanted to make before 1.0 major release
vv0.31.1

This patch release is aimed at fixing `proc-macro2` related IDL build errors.

  • This patch release is aimed at fixing `proc-macro2` related IDL build errors
  • Check out the release notes from Anchor website or GitHub

See how people are using Anchor

Loading tweets...


[ EXPLORE MORE ]

Related Repositories

Discover similar tools and frameworks used by developers