How Solana Differs from EVM
If you’re coming from Ethereum/Solidity, Solana’s programming model is fundamentally different:
The key mental shift: on Solana, programs don’t own data. Every piece of state is an “account” that programs read from and write to. You declare which accounts each instruction needs upfront, which is how Solana achieves parallel execution.
Anchor Framework
Anchor is to Solana what Hardhat/Foundry is to Ethereum — a higher-level framework that handles the boilerplate. Most production Solana apps use Anchor. Anchor gives you:- Automatic account serialization/deserialization
- Declarative account validation (constraints)
- IDL generation (like ABI for Solana)
- TypeScript client generation
- Built-in testing framework
Project Structure
An Anchor project looks like this:Setting Up the Toolchain
First time only — install Rust, Solana CLI, and Anchor:- Rust (stable toolchain)
- Solana CLI v2.3.0
- Anchor v0.32.0
Writing an Anchor Program
Here’s a minimal counter program:#[program]— defines your instruction handlers#[derive(Accounts)]— declares which accounts each instruction needs#[account]— defines the data schema for an accountContext<T>— provides access to the validated accounts
Important Version Constraints
Always use these exact versions in yourCargo.toml:
edition = "2021" in your Cargo.toml (not 2024 — Solana’s platform tools don’t support it yet).
Compiling
.sobinary — the compiled program for deployment- IDL file — describes your program’s interface (like an ABI)
- TypeScript types — generated from the IDL for client code
- Type mismatches
- Missing trait implementations
- Account constraint violations
- Wrong dependency versions
Local Development
Start a Local Validator
solana-test-validator at http://127.0.0.1:8899. You get:
- Instant transaction finality
- Unlimited SOL airdrops
- Clean state (resets when stopped)
- No rate limits
Fund Your Wallet
Deploying Programs
To Local
.so file and deploys it. You get back the program ID (the on-chain address of your program).
To Devnet/Testnet
To Mainnet
Program Upgrades
By default, the deployer retains upgrade authority — you can deploy new versions to the same program address. You can:- Upgrade the program later with new code
- Transfer upgrade authority to a multisig
- Revoke upgrade authority to make it immutable
SPL Token Operations
SPL tokens are Solana’s equivalent of ERC-20. Manage them through chat:Create a Token
Mint Tokens
Transfer Tokens
Check Balance
Program Derived Addresses (PDAs)
PDAs are deterministic addresses derived from a program ID and seeds. They’re fundamental to Solana development:- Program-controlled token accounts (programs can “sign” for PDAs)
- Deterministic data accounts (predictable addresses based on user + seed)
- Cross-program invocation authority
Solidity on Solana (Solang)
If you prefer Solidity over Rust, you can compile Solidity for Solana using Solang:- Account management requires explicit annotations
- Storage works differently (data lives in accounts, not contract storage)
- Not all Solidity features are available
- Different gas/compute model
Workflow Summary
1
Install Toolchain (Once)
"Install the Anchor toolchain"2
Create Project
"Create a Solana program that does X"3
Write Program Logic
Define instructions, accounts, and data structures in Rust.
4
Compile
"Compile my Anchor program"5
Start Local Validator
"Start a local Solana node"6
Fund Wallet
"Fund my wallet with 1000 SOL"7
Deploy
"Deploy my program"8
Interact
"Call the increment instruction"9
Deploy to Testnet/Mainnet
"Switch to testnet and deploy"Troubleshooting
Build fails with edition2024 error
Build fails with edition2024 error
Use
edition = "2021" in Cargo.toml and solana-program = "2.1" (not 2.2+). Solana’s platform tools don’t support Rust edition 2024 yet.Deployment fails
Deployment fails
Check: wallet connected, sufficient SOL for rent, correct network selected,
.so file exists in target/deploy/.Airdrop rate limited
Airdrop rate limited
On public devnet/testnet, wait a few minutes between requests. Request 1-2 SOL at a time. On local, there are no limits.
Toolchain version conflicts
Toolchain version conflicts
Use exactly:
anchor-lang = "0.32.0", solana-program = "2.1", edition = "2021". Don’t add unnecessary solana-* crates.