Quickstart
- Rust is the primary language for Solana programs.
- Solana devs must learn Rust.
- Regions of memory on-chain are called accounts.
- Accounts pay rent to be stored on-chain.
- PDAs are accounts that are derived from a seed and a program.
- CPI is the cross-program invocation, which is the way to call another program from a program.
- “Borsh” is the binary encoding format used by Solana.
- Binary Object Representation Serializer for Hashing.
- Think of it as a more efficient JSON.
- Tokens on Solana come in two flavors currently: SPL and “Token-2022”.
- SPL tokens are the standard token format.
- “Token-2022” is a more advanced token format and we don’t see them much in the current environment.
- SPL tokens use the Token program.
- This is an on-chain program that manages token accounts. There are many of these pre-deployed programs on Solana (e.g. Token-2022 program, SPL associated token account program, address lookup table program)
- Lots of guides/docs are incomplete or outdated. Expect to do a lot of digging and experimentation.
- GPT has a decent grasp of using
@solana/web3.js
and tangential libraries
- GPT has a decent grasp of using
Useful Guides
- Start here
- Then understand serialization
- Gives a great introduction to how Solana programs are executed and how to encode instructions.
- Interactive examples included.
- Then understand instruction data
- Focuses heavily on the Rust side of things.
- Goes over impl, structs, and enums.
- Real-world example included.
- This is without using the Anchor framework.
- Will be useful for understanding how to decode transaction data in real-time.
- soldev.app
- Solana Cookbook
Libraries
JavaScript
- ed25519-hd-key - Great when dealing with seed phrases
- bip39
- @solana/web3.js
Troubleshooting
Warning
Update your Solana dependencies when using old code samples! Be sure to update the
Cargo.toml
file with the latest packages to prevent any weird issues!
The errors from old dependencies might look something like this:
error: package `bumpalo v3.15.4` cannot be built because it requires rustc 1.73.0 or newer, while the currently active rustc version is 1.72.0-dev
Either upgrade to rustc 1.73.0 or newer, or use
cargo update -p bumpalo@3.15.4 --precise ver
where `ver` is the latest version of `bumpalo` supporting rustc 1.72.0-dev