Installation Guide
Complete guide to setting up your development environment for building a liquid staking protocol on Solana.
Environment Setup
Before developing your liquid staking protocol, ensure your development environment is properly configured with all necessary tools and dependencies.
System Requirements
- •Operating System: Linux, macOS, or Windows (WSL2 recommended for Windows)
- •CPU: Modern multi-core processor
- •RAM: Minimum 8GB, 16GB recommended
- •Storage: At least 50GB of free space
Performance Note
For optimal development experience and testing, we recommend using a machine with at least 16GB RAM and a modern multi-core processor. This will significantly improve build times and testing capabilities.
Installing Rust and Cargo
Rust is the primary programming language for Solana smart contracts. Follow these steps to install Rust and its package manager, Cargo.
1. Install Rust
1curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
After installation, configure your current shell:
1source $HOME/.cargo/env
2. Install Required Components
1rustup component add rustfmt
2rustup component add clippy
3rustup target add wasm32-unknown-unknown
3. Verify Installation
1rustc --version
2cargo --version
3rustup --version
Version Compatibility
Ensure you're using the latest stable version of Rust. Some features might not work correctly with older versions.
Solana Development Tools
1. Install Solana CLI
1sh -c "$(curl -sSfL https://release.solana.com/v1.17.0/install)"
Add Solana to your PATH:
1export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
2. Configure Solana CLI
1# Set to devnet for development
2solana config set --url https://api.devnet.solana.com
3
4# Generate a new keypair
5solana-keygen new
6
7# Verify configuration
8solana config get
9
10# Get devnet SOL for testing
11solana airdrop 2
3. Install Anchor Framework
Anchor is a framework that simplifies Solana program development:
1# Install Anchor CLI
2cargo install --git https://github.com/coral-xyz/anchor avm --locked
3avm install latest
4avm use latest
5
6# Install dependencies (Ubuntu/Debian)
7sudo apt-get update
8sudo apt-get install -y pkg-config build-essential libudev-dev
Node.js and Development Dependencies
1. Install Node.js
Using nvm (Node Version Manager) is recommended:
1curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
2source ~/.bashrc
3nvm install 16
4nvm use 16
2. Install Project Dependencies
1npm install -g yarn
2npm install -g typescript
3npm install -g ts-node
3. Install Development Tools
1# Install Solana Web3.js
2yarn add @solana/web3.js
3
4# Install SPL Token
5yarn add @solana/spl-token
6
7# Install Anchor Client
8yarn add @coral-xyz/anchor
IDE Configuration
VS Code Extensions
- •rust-analyzer: Rust language support
- •Even Better TOML: TOML file support for Cargo configuration
- •Solana: Solana language support
Recommended VS Code Settings
1{
2 "rust-analyzer.checkOnSave.command": "clippy",
3 "editor.formatOnSave": true,
4 "[rust]": {
5 "editor.defaultFormatter": "rust-lang.rust-analyzer"
6 }
7}
Installation Verification
1. Verify Solana Installation
1solana --version
2solana-test-validator --version
3solana-keygen --version
2. Verify Anchor Installation
1anchor --version
2anchor test --version
3. Test Local Validator
1# Start local validator
2solana-test-validator
3
4# In a new terminal, verify connection
5solana config set --url localhost
6solana balance
Ready to Start
If all verifications pass, your development environment is ready for building your liquid staking protocol on Solana.
Troubleshooting Common Issues
Rust Build Failures
If you encounter Rust build failures:
1rustup update
2rustup toolchain install stable
3rustup default stable
Solana CLI Connection Issues
For connection issues:
1# Reset config to devnet
2solana config set --url https://api.devnet.solana.com
3
4# Clear cached data
5rm -rf ~/.config/solana/install/active_release
6
7# Reinstall CLI
8sh -c "$(curl -sSfL https://release.solana.com/v1.17.0/install)"
Permission Issues
For permission-related errors:
1# Fix cargo permissions
2sudo chown -R $(whoami):$(whoami) ~/.cargo
3
4# Fix npm global permissions
5mkdir ~/.npm-global
6npm config set prefix '~/.npm-global'
7export PATH=~/.npm-global/bin:$PATH
Next Steps
Now that your development environment is set up, you can: