{"id":22025211,"url":"https://github.com/ronanyeah/solana-rust-examples","last_synced_at":"2025-04-05T04:08:38.832Z","repository":{"id":38972514,"uuid":"502647173","full_name":"ronanyeah/solana-rust-examples","owner":"ronanyeah","description":"Demonstrating how to use Rust to interact with the Solana blockchain.","archived":false,"fork":false,"pushed_at":"2025-03-18T23:04:40.000Z","size":190,"stargazers_count":152,"open_issues_count":1,"forks_count":37,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-29T03:02:33.118Z","etag":null,"topics":["rust","solana","web3"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/ronanyeah.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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}},"created_at":"2022-06-12T15:01:20.000Z","updated_at":"2025-03-23T10:10:25.000Z","dependencies_parsed_at":"2024-10-24T23:31:48.588Z","dependency_job_id":"39b2108e-80a2-45f0-bdee-19e110e1a220","html_url":"https://github.com/ronanyeah/solana-rust-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronanyeah%2Fsolana-rust-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronanyeah%2Fsolana-rust-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronanyeah%2Fsolana-rust-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronanyeah%2Fsolana-rust-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ronanyeah","download_url":"https://codeload.github.com/ronanyeah/solana-rust-examples/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247284944,"owners_count":20913704,"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":["rust","solana","web3"],"created_at":"2024-11-30T07:15:01.397Z","updated_at":"2025-04-05T04:08:38.799Z","avatar_url":"https://github.com/ronanyeah.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Solana Scripts\n\nThis is a library of Rust scripts for specific purposes:\n\n- [Generate a new wallet](#new-wallet)\n- [Create an SPL token](#create-an-spl-token)\n- [Mint an SPL token](#mint-spl-tokens)\n- [Get an associated token balance](#get-token-balance)\n- [Get the creation date of an account](#get-account-creation-timestamp)\n- [Get the owner of an NFT](#get-nft-owner)\n- [List NFTs in wallet](#list-nfts-in-wallet)\n- [Subscribe to events](#subscribe-to-events)\n- [Fetch onchain Anchor IDL](#fetch-onchain-anchor-idl)\n\nThe scripts are found in the `src/bin` folder. They can be configured using environment variables, which are documented below.\n\n[Open an issue](https://github.com/ronanyeah/solana-rust-examples/issues) if you have any requests or suggestions.\n\n---\n\n## New wallet\n\n`cargo run --bin new_wallet` | [Code](./src/bin/new_wallet.rs)\n\nGenerates a new wallet and prints the pubkey, Base58 private key, and JSON private key.\n\n---\n\n## Create an SPL token\n\n`cargo run --bin create_spl` | [Code](./src/bin/create_spl.rs)\n\nCreates a new [SPL token](https://spl.solana.com/token) mint account.\n\n| Environment Variable | Note                                                       |\n| -------------------- | ---------------------------------------------------------- |\n| RPC_URL              | e.g. `https://api.mainnet-beta.solana.com`                 |\n| SIGNER_KEYPAIR       | Base58 encoded keypair, to pay for the transaction.        |\n| MINT_KEYPAIR         | Base58 encoded keypair, representing the new mint account. |\n\n---\n\n## Mint SPL tokens\n\n`cargo run --bin mint_spl` | [Code](./src/bin/mint_spl.rs)\n\nMints 10,000 SPL tokens from a specified mint to the [associated token account](https://spl.solana.com/associated-token-account) of a specified wallet.\n\n| Environment Variable | Note                                                               |\n| -------------------- | ------------------------------------------------------------------ |\n| RPC_URL              | e.g. `https://api.mainnet-beta.solana.com`                         |\n| SIGNER_KEYPAIR       | Base58 encoded keypair, which has mint authority.                  |\n| MINT_ACCOUNT_PUBKEY  | The pubkey address of the SPL Token mint account.                  |\n| RECEIVER_PUBKEY      | The pubkey address of the wallet you want to fund with the tokens. |\n\n---\n\n## Get token balance\n\n`cargo run --bin associated_token_balance` | [Code](./src/bin/associated_token_balance.rs)\n\nPrints the balance of an [associated token account](https://spl.solana.com/associated-token-account), for a specified wallet and mint.\n\n| Environment Variable | Note                                                   |\n| -------------------- | ------------------------------------------------------ |\n| RPC_URL              | e.g. `https://api.mainnet-beta.solana.com`             |\n| WALLET_PUBKEY        | The pubkey address of the wallet that owns the tokens. |\n| MINT_ACCOUNT_PUBKEY  | The pubkey address of the SPL Token mint account.      |\n\n---\n\n## Get account creation timestamp\n\n`cargo run --bin creation_date` | [Code](./src/bin/creation_date.rs)\n\nFetches and prints the creation timestamp of a specified [account](https://docs.solana.com/developing/programming-model/accounts).\n\n| Environment Variable | Note                                                      |\n| -------------------- | --------------------------------------------------------- |\n| RPC_URL              | e.g. `https://api.mainnet-beta.solana.com`                |\n| ACCOUNT_PUBKEY       | The pubkey address of the account you want to introspect. |\n\n---\n\n## Get NFT owner\n\n`cargo run --bin nft_owner` | [Code](./src/bin/nft_owner.rs)\n\nPrints the wallet address that owns a specified NFT.\n\n| Environment Variable | Note                                              |\n| -------------------- | ------------------------------------------------- |\n| RPC_URL              | e.g. `https://api.mainnet-beta.solana.com`        |\n| MINT_ACCOUNT_PUBKEY  | The pubkey address of the SPL Token mint account. |\n\n---\n\n## List NFTs in wallet\n\n`cargo run --bin list_nfts` | [Code](./src/bin/list_nfts.rs)\n\nFetches and prints the mint pubkeys of every NFT in the specified wallet.\n\n| Environment Variable | Note                                              |\n| -------------------- | ------------------------------------------------- |\n| RPC_URL              | e.g. `https://api.mainnet-beta.solana.com`        |\n| WALLET_PUBKEY        | The pubkey address of the wallet that owns the NFTs. |\n\n---\n\n## Subscribe to events\n\n`cargo run --bin pubsub` | [Code](./src/bin/pubsub.rs)\n\nListens to events from [`slotSubscribe`](https://solana.com/docs/rpc/websocket/slotsubscribe).\n\n| Environment Variable | Note                                              |\n| -------------------- | ------------------------------------------------- |\n| WS_URL              | e.g. `wss://api.mainnet-beta.solana.com`        |\n\n---\n\n## Fetch onchain Anchor IDL\n\n`cargo run --bin fetch_idl` | [Code](./src/bin/fetch_idl.rs)\n\nFetches an [`Anchor IDL`](https://solana.com/docs/programs/anchor/idl) from a program address.\n\n| Environment Variable | Note                                              |\n| -------------------- | ------------------------------------------------- |\n| WS_URL              | e.g. `wss://api.mainnet-beta.solana.com`           |\n| PROGRAM_ID        | The program address pubkey. e.g. `whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc` |","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fronanyeah%2Fsolana-rust-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fronanyeah%2Fsolana-rust-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fronanyeah%2Fsolana-rust-examples/lists"}