Example Programs

Example Anchor programs references

There are extensive examples for individual Anchor features on the Solana Foundation Program Examples repo.

Additionally, the Quicknode Solana Program Examples repo includes Anchor examples of larger programs, like order books, loan markets, betting markets, and so on. The current Anchor stack, including Anchor 1.x, the multiple files layout, and LiteSVM for tests is used throughout.

Basics

ExampleDescription
checking-accountsChecking account example with Anchor
close-accountClose account example with Anchor
counterCounter program using Anchor
create-accountCreate accounts with Anchor
cross-program-invocationCross program invocation with Anchor
favoritesStore user "favorites" with Anchor
hello-solanaBasic "Hello, Solana!" program with Anchor
pda-rent-payerPDA rent payer example with Anchor
processing-instructionsProcess instructions using Anchor
program-derived-addressesProgram-derived addresses with Anchor
reallocReallocate account data with Anchor
rentCalculate account SOL rent with Anchor
transfer-solTransfer SOL tokens with Anchor

Tokens

ExampleDescription
create-tokenCreate an SPL token with Anchor
escrowEscrow program using Anchor
nft-minterMint NFTs using Anchor
nft-operationsNFT operations with Anchor
pda-mint-authorityPDA as mint authority with Anchor
spl-token-minterSPL token minting with Anchor
token-fundraiserToken fundraiser using Anchor
token-swapSwap tokens with Anchor
transfer-tokensTransfer SPL tokens using Anchor

Token Extensions

ExampleDescription
basicsBasics of Token 2022 with Anchor
cpi-guardCPI guard example with Anchor
default-account-stateDefault account state setup with Anchor
groupToken grouping example with Anchor
immutable-ownerImmutable owner setup with Anchor
interest-bearingInterest-bearing tokens using Anchor
memo-transferMemo transfer with Anchor
metadataToken metadata with Anchor
mint-close-authorityMint close authority with Anchor
multiple-extensionsMultiple extensions example with Anchor
nft-meta-data-pointerNFT metadata pointer with Anchor
non-transferableNon-transferable tokens using Anchor
permanent-delegatePermanent delegate setup with Anchor
transfer-feeTransfer fees example with Anchor
transfer-hookTransfer hook example with Anchor

On this page

GitHubEdit on GitHub