Anchor: Solana Program Development Framework
A Rust-based framework for building Solana programs with IDL generation and TypeScript client support.
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.
Rust eDSL
Provides high-level Rust abstractions for Solana program development with account validation and serialization handling.
IDL Generation
Automatically generates interface specifications from Rust code, enabling type-safe client generation across multiple languages.
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,
}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`
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
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
Related Repositories
Discover similar tools and frameworks used by developers
NEAR Core
Reference implementation of NEAR Protocol blockchain, providing infrastructure for smart contracts and applications.
Aave V3 Core
Smart contracts for Aave Protocol V3, a decentralized liquidity market for lending and borrowing cryptocurrencies.
BitcoinJS
A TypeScript-based Bitcoin library providing cryptographic functions and transaction handling for Node.js and browsers.
Hyperledger Fabric
Modular enterprise blockchain framework with permissioned networks, pluggable consensus, and privacy controls.
Solmate
A collection of gas-optimized Solidity contracts including ERC token implementations and utility libraries.