{"id":13652165,"url":"https://github.com/solana-developers/program-examples","last_synced_at":"2025-05-14T14:08:32.032Z","repository":{"id":43554041,"uuid":"509524133","full_name":"solana-developers/program-examples","owner":"solana-developers","description":"A repository of Solana program examples","archived":false,"fork":false,"pushed_at":"2025-05-13T13:36:20.000Z","size":7759,"stargazers_count":1077,"open_issues_count":59,"forks_count":405,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-05-14T11:00:30.546Z","etag":null,"topics":["anchor","anchor-lang","blockchain","hacktoberfest","native-solana","solana","solana-programs","web3"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/solana-developers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-07-01T16:37:26.000Z","updated_at":"2025-05-14T10:06:27.000Z","dependencies_parsed_at":"2023-02-15T13:31:49.395Z","dependency_job_id":"87212cac-5d87-452b-b646-2d545911cb7c","html_url":"https://github.com/solana-developers/program-examples","commit_stats":{"total_commits":366,"total_committers":24,"mean_commits":15.25,"dds":0.7650273224043715,"last_synced_commit":"2c4bc257c8cb8acf33f5921b35af276beed77c98"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solana-developers%2Fprogram-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solana-developers%2Fprogram-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solana-developers%2Fprogram-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solana-developers%2Fprogram-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/solana-developers","download_url":"https://codeload.github.com/solana-developers/program-examples/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254159800,"owners_count":22024564,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anchor","anchor-lang","blockchain","hacktoberfest","native-solana","solana","solana-programs","web3"],"created_at":"2024-08-02T02:00:56.293Z","updated_at":"2025-05-14T14:08:32.014Z","avatar_url":"https://github.com/solana-developers.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","Learning Resources","Books, Tutorials, and Courses","Uncategorized"],"sub_categories":["Tutorials \u0026 Examples","Uncategorized"],"readme":"# Program Examples\n\n## Onchain program examples for :anchor: Anchor :crab: Native Rust, [TS] TypeScript  and :snake: Python\n\nThis repo contains Solana onchain programs (referred to as 'Smart Contracts' in other blockchains).\n\n\u003e [!NOTE]\n\u003e If you're new to Solana, you don't need to create your own programs to perform basic things like making accounts, creating tokens, sending tokens, or minting NFTs. These common tasks are handled with existing programs, for example the System Program (for making account or transferring SOL) or the token program (for creating tokens and NFTs). See the [Solana Developer site](https://solana.com/developers) to learn more.\n\nEach folder includes examples for one or more of the following:\n\n- `anchor` - Written using [Anchor](https://www.anchor-lang.com/), the most popular framework for Solana Development, which uses Rust. Use `anchor build \u0026\u0026 anchor deploy` to build \u0026 deploy the program. Run `anchor run test` to test it.\n- `native` - Written using Solana's native Rust crates and vanilla Rust. Use `cicd.sh` to build \u0026 deploy the program. Run `yarn run test` to test it.\n- `poseidon` - Written using [Poseidon](https://turbin3.github.io/poseidon), which converts your TypeScript code to Anchor Rust.\n- `seahorse` - Written using the [Seahorse framework](https://seahorse-lang.org/), which converts your Python code to Anchor Rust. Use `seahorse build \u0026\u0026 anchor deploy` to build \u0026 deploy the program. Run `anchor run test` to test it.\n\n**If a given example is missing, please send us a PR to add it!** Our aim is to have every example available in every option. We'd also love to see more programs involving staking, wrapped tokens, oracles, compression and VRF. Follow the [contributing guidelines](./CONTRIBUTING.md) to keep things consistent.\n\n## The example programs\n\n\u003cdetails\u003e\n  \u003csummary\u003eBasics\u003c/summary\u003e\n\n### Hello world\n\n[Hello World on Solana! A minimal program that logs a greeting.](./basics/hello-solana/README.md)\n\n[anchor](./basics/hello-solana/anchor) [native](./basics/hello-solana/native) [seahorse](./basics/hello-solana/seahorse)\n\n### Account-data\n\nStore and retrieve data using Solana accounts.\n\n[anchor](./basics/account-data/anchor) [native](./basics/account-data/native)\n\n### Storing global state - Counter\n\n[Use a PDA to store global state, making a counter that increments when called.](./basics/counter/README.md)\n\n[anchor](./basics/counter/anchor) [native](./basics/counter/native) [seahorse](./basics/counter/seahorse)\n\n### Saving per-user state - Favorites\n\nSave and update per-user state on the blockchain, ensuring users can only update their own information.\n\n[anchor](./basics/favorites/anchor)\n\n### Checking Instruction Accounts\n\n[Check that the accounts provided in incoming instructions meet particular criteria.](./basics/checking-accounts/README.md)\n\n[anchor](./basics/checking-accounts/anchor) [native](./basics/checking-accounts/native)\n\n### Closing Accounts\n\nClose an account and get the Lamports back.\n\n[anchor](./basics/close-account/anchor) [native](./basics/close-account/native)\n\n### Creating Accounts\n\n[Make new accounts on the blockchain.](./basics/create-account/README.md)\n\n[anchor](./basics/create-account/anchor) [native](./basics/create-account/native)\n\n### Cross program invocations\n\n[Invoke an instruction handler from one onchain program in another onchain program.](./basics/cross-program-invocation/README.md)\n\n[anchor](./basics/cross-program-invocation/anchor) [native](./basics/cross-program-invocation/native)\n\n### PDA rent-payer\n\n[Use a PDA to pay the rent for the creation of a new account.](./basics/pda-rent-payer/README.md)\n\n[anchor](./basics/pda-rent-payer/anchor) [native](./basics/pda-rent-payer/native)\n\n### Processing instructions\n\n[Add parameters to an instruction handler and use them.](./basics/processing-instructions/README.md)\n\n[anchor](./basics/processing-instructions/anchor) [native](./basics/processing-instructions/native)\n\n### Storing date in program derived addresses\n\nStore and retrieve state in Solana.\n\n[anchor](./basics/program-derived-addresses/anchor) [native](./basics/program-derived-addresses/native)\n\n### Handling accounts that expand in size\n\nHow to store state that changes size in Solana.\n\n[anchor](./basics/realloc/anchor) [native](./basics/realloc/native)\n\n### Calculating account size to determine rent\n\n[Determine the necessary minimum rent by calculating an account's size.](./basics/rent/README.md)\n\n[anchor](./basics/rent/anchor) [native](./basics/rent/native)\n\n### Laying out larger programs\n\n[Layout larger Solana onchain programs.](./basics/repository-layout/README.md)\n\n[anchor](./basics/repository-layout/anchor) [native](./basics/repository-layout/native)\n\n### Transferring SOL\n\n[Send SOL between two accounts.](./basics/transfer-sol/README.md)\n\n[anchor](./basics/transfer-sol/anchor) [native](./basics/transfer-sol/native) [seahorse](./basics/transfer-sol/seahorse)\n\n\u003c/details\u003e\n\u003cdetails\u003e\n  \u003csummary\u003eTokens\u003c/summary\u003e\n\n### Creating tokens\n\n[Create a token on Solana with a token symbol and icon.](./tokens/create-token/README.md)\n\n[anchor](./tokens/create-token/anchor) [native](./tokens/create-token/native)\n\n### Minting NFTS\n\n[Mint an NFT from inside your own onchain program using the Token and Metaplex Token Metadata programs.](./tokens/nft-minter/README.md) Reminder: you don't need your own program just to mint an NFT, see the note at the top of this README.\n\n[anchor](./tokens/nft-minter/anchor) [native](./tokens/nft-minter/native)\n\n### Minting a token from inside a program\n\n[Mint a Token from inside your own onchain program using the Token program.](./tokens/spl-token-minter/README.md) Reminder: you don't need your own program just to mint an NFT, see the note at the top of this README.\n\n[anchor](./tokens/spl-token-minter/anchor) [native](./tokens/spl-token-minter/native)\n\n### Transferring Tokens\n\n[Transfer tokens between accounts](./tokens/transfer-tokens/README.md)\n\n[anchor](./tokens/transfer-tokens/anchor) [native](./tokens/transfer-tokens/native) [seahorse](./tokens/transfer-tokens/seahorse)\n\n### Allowing users to swap digital assets - Escrow\n\nAllow two users to swap digital assets with each other, each getting 100% of what the other has offered due to the power of decentralization!\n\n[anchor](./tokens/escrow/anchor)\n\n### Minting a token from inside a program with a PDA as the mint authority\n\n[Mint a Token from inside your own onchain program using the Token program.](./tokens/pda-mint-authority/README.md) Reminder: you don't need your own program just to mint an NFT, see the note at the top of this README.\n\n[anchor](./tokens/pda-mint-authority/anchor) [native](./tokens/pda-mint-authority/native)\n\n### Creating an Automated Market Maker\n\n[Create liquidity pools to allow trading of new digital assets and allows users that provide liquidity to be rewarded by creating an Automated Market Maker.](./tokens/token-swap/README.md)\n\n[anchor](./tokens/token-swap/anchor)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n  \u003csummary\u003eToken Extensions\u003c/summary\u003e\n\n### Basics - create token mints, mint tokens, and transfer tokens with Token Extensions\n\nCreate token mints, mint tokens, and transferr tokens using Token Extensions.\n\n[anchor](./tokens/token-2022/basics/anchor)\n\n### Preventing CPIs with CPI guard\n\nEnable CPI guard to prevents certain token action from occurring within CPI (Cross-Program Invocation).\n\n[anchor](./tokens/token-2022/cpi-guard/anchor)\n\n### Using default account state\n\nCreate new token accounts that are frozen by default.\n\n[anchor](./tokens/token-2022/default-account-state/anchor) [native](./tokens/token-2022/default-account-state/native)\n\n### Grouping tokens\n\nCreate tokens that belong to larger groups of tokens using the Group Pointer extension.\n\n[anchor](./tokens/token-2022/group/anchor)\n\n### Creating token accounts whose owner cannot be changed\n\nCreate tokens whose owning program cannot be changed.\n\n[anchor](./tokens/token-2022/immutable-owner/anchor)\n\n### Interest bearing tokens\n\nCreate tokens that show an 'interest' calculation.\n\n[anchor](./tokens/token-2022/interest-bearing/anchor)\n\n### Requiring transactions to include descriptive memos\n\nCreate tokens where transfers must have a memo describing the transaction attached.\n\n[anchor](./tokens/token-2022/memo-transfer/anchor)\n\n### Adding on-chain metadata to the token mint\n\nCreate tokens that store their onchain metadata inside the token mint, without needing to use or pay for additional programs.\n\n[anchor](./tokens/token-2022/metadata/anchor)\n\n### Allow a designedated account to close a mint\n\nAllow a designated account to close a Mint.\n\n[anchor](./tokens/token-2022/mint-close-authority/anchor) [native](./tokens/token-2022/mint-close-authority/native)\n\n### Usng multiple token extensions\n\nUse multiple Token Extensions at once.\n\n[native](./tokens/token-2022/multiple-extensions/native)\n\n### Non-transferrable - create tokens that can't be transferred.\n\nCreate tokens that cannot be transferred.\n\n[anchor](./tokens/token-2022/non-transferable/anchor) [native](./tokens/token-2022/non-transferable/native)\n\n### Permanent Delegate - Create tokens permanently under the control of a particular account\n\nCreate tokens that remain under the control of an account, even when transferred elsewhere.\n\n[anchor](./tokens/token-2022/permanent-delegate/anchor)\n\n### Create tokens with a transfer-fee.\n\nCreate tokens with an inbuilt transfer fee.\n\n[anchor](./tokens/token-2022/transfer-fee/anchor) [native](./tokens/token-2022/transfer-fee/native)\n\n\u003c/details\u003e\n\u003cdetails\u003e\n\n\u003csummary\u003eCompression\u003c/summary\u003e\n\n### Cnft-burn\n\nBurn compressed NFTs.\n\n[anchor](./compression/cnft-burn/anchor)\n\n### Cnft-vault\n\nStore Metaplex compressed NFTs inside a PDA.\n\n[anchor](./compression/cnft-vault/anchor)\n\n### Cutils\n\nWork with Metaplex compressed NFTs.\n\n[anchor](./compression/cutils/anchor)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eOracles\u003c/summary\u003e\n\n### pyth\n\nUse a data source for offchain data (called an Oracle) to perform activities onchain.\n\n[anchor](./oracles/pyth/anchor) [seahorse](./oracles/pyth/seahorse)\n\n\u003c/details\u003e\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolana-developers%2Fprogram-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolana-developers%2Fprogram-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolana-developers%2Fprogram-examples/lists"}