Chewing Glass with Solana - Part 1
A deep-dive into dApp development with Solana and Anchor
Gm Gm friends ππ»
If you are reading this blog, it's probably because either you've tried developing on Solana, and surprise, surprise! It didn't go as smoothly as you hoped, or, you are looking to get into dApp development on Solana. The first major hurdle when starting with Solana is its complex architecture. The Account model can be a bit challenging to grasp, especially for those unfamiliar with the Linux file system. The next significant roadblock is writing Smart Contracts, called Programs in Solana, in Rust. Rust is a niche programming language with a steep learning curve. When I began working on Solana, it felt like I was chewing glass. That's why I'm writing this blog seriesβto make learning to develop on Solana a bit simpler. So, let's get into it!
Before we begin, let's make sure you meet all the pre-requisites to follow along this series:
Dependencies:
If you are on Windows, install WSL ( Windows Subsystem for Linux ) for the best development experience. ( Linux and MacOS users can skip this step )
Open PowerShell in administrator mode ( "Run as Administrator" ).
Type this command:
wsl --install
Now, open WSL in the Command Prompt using this command:
wsl
This will provide you with a bash CLI to work with.
Install Rust and Cargo ( The Rust package manager ):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Install the Solana Tool Suite:
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
This will install the latest stable version of Solana on your machine. Depending on your system, the end of the installer messaging may prompt you to
Please update your PATH environment variable to include the solana programs:
If you get the above message, copy and paste the recommended command below it to update
PATH
Confirm the Solana installation by running the command:
solana --version
You should get an output like this:
Install Anchor: Anchor is a framework for quickly building secure Solana programs. It really makes our lives easier by abstracting away a lot of complexities of the Solana program and provides us with a suite of tools for the development and testing of the Solana Program. It's like Hardhat for Solana and even more.
Let's install Anchor now:
Install
avm
( Anchor Version Manager ) using Cargo.cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
On Linux systems, you may need to install additional dependencies if cargo install fails. E.g. on Ubuntu:
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y pkg-config build-essential libudev-dev libssl-dev
Install the latest version of the CLI using
avm
, and then set it to be the version to use.avm install latest avm use latest
Verify the installation.
anchor --version
This should give an output like this:
Congratulations ππ!! You have successfully set up your Solana development environment and are now ready to get into some real action π.
We will continue on this awesome journey of becoming a Solana developer in the upcoming parts of this blog series( coming soon ), where we will discuss the architecture of the Solana blockchain and how it is capable of providing a transaction throughput of 65,000 TPS at such a low fee.
Till then, HODL and WAGMI π.