Chewing Glass with Solana - Part 1

A deep-dive into dApp development with Solana and Anchor

Chewing Glass with Solana - Part 1

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 )

    1. Open PowerShell in administrator mode ( "Run as Administrator" ).

    2. Type this command:

       wsl --install
      
    3. 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:

    1. Install avm ( Anchor Version Manager ) using Cargo.

       cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
      
    2. 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
      
    3. 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 😎.

Β