Welcome to my Solana learning repository! This repo contains various projects and experiments as I learn about Solana development using Rust and TypeScript.
Before you begin, ensure you have the following installed:
- Node.js (LTS version recommended)
- Yarn
- Rust (install via
rustup
) - Solana CLI
- Anchor CLI
npm install @solana/web3.js
- Command to start solana env locally
solana-test-validator
- Connect to the local validator:
solana config set --url localhost
- For Rust-based Solana programs: You can use the Anchor framework to create and deploy your smart contracts.
anchor init my_solana_project
cd my_solana_project
my_solana_project/
├── Anchor.toml
├── Cargo.toml
├── programs/
│ └── my_solana_project/
│ └── src/
│ └── lib.rs
├── migrations/
├── tests/
│ └── my_solana_project.ts
└── target/
- Anchor.toml: Configuration file for the Anchor framework.
- Cargo.toml: Configuration for Rust dependencies and project settings.
- programs/: Contains the Rust smart contract (program).
- lib.rs: The main Rust source file where you’ll write your Solana program.
- tests/: Contains the TypeScript tests for your program.
- build the project with following command
anchor build
- sync the 32Bit hash generated in the build process with the following command
anchor keys sync
[programs.localnet]
my_solana_project = "onchain-program-address"
[registry]
url = "https://api.apr.dev"
[provider]
cluster = "devnet" // change it accordinglly
wallet = "~/localwallet1.json" // change the provider wallet address accordinglly
anchor deploy