Table of Contents

We have developed around 50+ blockchain projects and helped companies to raise funds.
You can connect directly to our Solana developers using any of the above links.

Talk  to Solana Developer

How to Become a Solana Developer

Becoming a Solana developer can make the difference between being an ordinary crypto enthusiast or programmer and a core team or person who has mastered crypto. Solana is an open-source, community blockchain platform that enables smart contracts, non-fungible tokens (NFTs), and decentralised apps (dApps). Staking and value transfer are two functions of the SOL money, which is native to Solana's blockchain.

The fast growing blockchain founded by Anatoly Yakovenko & Raj Gokal, whose ideas of a truly efficient and scalable blockchain that also eliminates unpredictable fees and allow developers numerous options was brought to life in the creation of the Solana blockchain. Solana is now becoming a hot blockchain for smart contracts, NFTs and other possibilities with blockchain technology. We will spare nothing but get our hands dirty on Solana development in this article. We will walk you through what it feels like and help you start your journey or be in the best position to hire Solana developers for your next blockchain project.

We'll be Utilising the Following Tools:

Solana Tool Suite - This contains a well-polished and well-documented command-line interface for interfacing with the Solana network.

Anchor Framework - The Anchor is a lifesaver. Without it, we would probably not have been able to get over the hump of developing anything. It's the Hardhat of Solana development and so much more. It also provides a domain specific language, (DSL) on top of Rust, so you don't need a thorough grasp of the language to get started. However, since most people are still attempting to learn Rust it will be helpful to develop anything non-trivial, even with the DSL. The Rust Book is a fantastic free resource for learning Rust.

People leave out all of the in-depth specifics of Solana's operation since others can cover this. They concentrate on developing something and giving the intricacies that you need to know to do it and the most critical aspects. There are a few means to support you understand more about Solana and how it works: In this article, we'll mainly focus on project setup, testing, and front end client integration for developing a few different sorts of apps, primarily centred on CRUD activities (minus the delete, of course), which we discovered to be reasonably undocumented (integration with client applications). We'll also learn how to use the Solana CLI to airdrop tokens to our development accounts and deploy our apps to local and live test networks.

We will not be focusing on NFTs in this article but may do so in a future guide.

Prerequisites

It describes how to construct a complete stack app on Solana but does not explain how to install various requirements.

We will also include the dependencies and link to the installation documentation. Each project will explain and document these things better than we could and maintain them up to date.

1. Node.js - We recommend using nvm or fnm to install Node.

2. Solana Tool Suite - Installation instructions may be found here. Note: If you're having trouble installing Solana on an M1 Mac, try building from the source and following this approach.

3. Anchor (including Mocha installation) - Anchor installation is relatively simple. The installation instructions may be found here.

4. Solana browser wallet - Phantom, with which we tested our app.

Getting Started

Let's have a peek at the Solana CLI before we start constructing.

CLI Solana

The major things we'll accomplish using the Solana CLI will be setting our network (between Localhost and a developer testnet) and airdropping tokens into our wallets. Pretty much everything else we'll do with the Anchor CLI.

For example, we can use the following command to inspect the current network (and other) configurations:

Set up a Keypair path if you don't already have one by following the instructions.

We may modify the network as follows:

This is crucial because you will need to know which network you utilise while developing, testing, and deploying your apps. When testing, you should also ensure that your wallet operates the same network as your local environment.

We'll begin by programming on the localhost network, then move to the devnet network.

We can also use the CLI to find out what our current local wallet address is:

Solana Address

Then you may retrieve all of the information on a specific account:

Solana account <address from above>

Let's then airdrop some tokens. To begin, connect to the local network, as here is where we will be working initially:

solana config set --url localhost

Start the local network after that. This will be a local Solana node that we can use for testing:

solana-test-validator

You can airdrop tokens to your account once the local network operates. Open a new window and enter the following command when the network is active:

Solana Airdrop 100

You may check your wallet balance here:

Solana balance

# or

Solana balance <address>

You should now have a 100 SOL balance in your wallet. With it, we can begin

Let's start building

To begin, create a new anchor project and navigate to the following directory:

Make sure you're using Anchor version 0.16.0 or later.

In addition to the node modules folder, there are four primary directories in this project:

app - Programs that will run where our frontend code will go - This is where the Rust code for the Solana programme test is kept. - The location of the JavaScript tests for the program's live migrations. - A simple deployment script

Let's look at the software that was designed specifically for us.

Anchor employs and enables us to construct an eDSL (embedded DSL), which abstracts away many of the more sophisticated low-level operations you'd generally need to do if you were using Solana & Rust without it, making it more approachable for me.

This is most likely the most simple programme you can create. The only thing that's going on here is that we're defining a function called initialise, which, when called, exits the programme successfully. There is no data modification.

The context is defined as empty of any parameters by the Initialize struct. Later on, we'll learn more about the function context.

We can use the Anchor build command to construct this programme: anchor build

When a build is finished, you should notice a new folder called target.

An IDL is one of the objects generated.

IDLs are analogous to ABIs in Solidity (or query definitions in GraphQL). We will use them similarly in our JavaScript tests and frontends to connect with our Solana programme through RPC. We can also put our programme to the test.

The examination should look like this:

We can learn a few things from this test that will be useful in the future, both in our tests and in the frontend JavaScript clients.

To use Anchor to contact a Solana programme, we usually require two things:

1. Provider - A Provider is an abstraction of a Solana network connection that generally consists of a Connection, Wallet, and preflight commitment.

The Anchor framework will generate the Provider for the test based on the environment (anchor.Provider.env()). Still, we will need to construct the Provider ourself using the user's Solana wallet on the client.

2. programme - The programme is an abstraction that combines the Provider, idl, and the programID (which is produced when the programme is formed) and allows us to invoke RPC methods on our programme.

Anchor, like the Provider, provides a handy means to access the programme. Still, we'll need to develop this Provider ourselves when building out the front end.

We can begin calling functions in our application after these two elements. In our software, for example, we have an initialise function. In our test, you'll notice that we may call that method directly using

This is a persistent pattern that you'll see a lot of while dealing with Anchor. Once you get the hang of it, it makes connecting to and interacting with a Solana application a breeze.

We can now run the test script to put the software through its paces:

anchor test

Building Hello World

Now that we've established our project, let's make something more intriguing.

As a full-stack developer, you probably spend most of your time wondering how to perform CRUD tasks, so that's what we'll look at next.

The first programme we'll write will enable us to establish a counter that will increase each time we call it from a client application.

The first step is to edit programs/mysolanaapp/src/lib.rs and replace the following code:

We have two functions in our programme: create and increment. These two functions are the RPC request handlers that will allow us to communicate with the programme from a client application.

The Context struct is the first argument of an RPC handler, and it provides the context that will be sent in when the function is called and how to handle it. In the case of Create, three arguments are expected: base account, user, and system program.

The #[account(...)] attributes establish constraints and instructions relating to the following account where it is stated. If any of these limitations are violated, the instruction will never be executed.

Any client that contacts this application with the right base account can access these RPC functions.

Solana's approach to data is different from anyone I've ever dealt with. There is no persistent state in the software; everything is associated with what is known as accounts. A program's state is effectively stored in a statement. As a result, all data is supplied from the outside by reference.

There are no read operations either. This is because all you need to do to read the contents of a programme is request the account, and from there, you may examine all of the program's state.

Anchor build is used to construct the software.

Let's now construct a test that makes use of this counter application. To accomplish this, edit tests/mysolanaapp.js and replace the following code:

Before we continue testing and deploying the software, we'd need to obtain the dynamically generated Program ID obtained by the build. We need this ID to replace the placeholder ID we set up when we started the project in the Rust programme. We may obtain this ID by issuing the

following command:

Run the following test: anchor test

We may now deploy after the test has passed.

We can now put the programme into action. Check that the Solana-test-validator is running: anchor deploy

You may also examine the validator logging by opening a new window and typing Solana logs into it.

We're now ready to start working on the front end.

Building the React app

Create a new react app in the root of the Anchor project to replace the old app directory:

app npx create-react-app

Next, install the Anchor and Solana Web3 dependencies: cd app

@project-serum/anchor @solana/web3.js npm install

We will also utilise the Solana Wallet Adapter to link the user's Solana wallet. Let's also install those dependencies:

npm install @solana/wallet-adapter-react \

@solana/wallet-adapter-react-ui @solana/wallet-adapter-wallets \

@solana/wallet-adapter-base

Next, in the src directory, create a new file named idl.json. Here, copy the IDL JSON created for you in the main project folder, located at target/idl/mysolanaapp.json.

It would be nice to copy this idl file automatically to our client application src folder. You can, of course, create your script that does this if you'd like, or else you need to copy and paste over the IDL after every change to your main program.

If you want a script like this, you can do it in just a couple of lines of code:

Next, open app/src/App.js and update it with the following:

SCALE YOUR SOLANA DEVELOPMENT PROJECTS WITH US

Changing your wallet network

We must first switch our Phantom wallet to the correct network before we can communicate with an application on the localhost network.

To do so, open your Phantom wallet and navigate to the settings tab. Then, scroll down to Network Change:

Next, choose Localhost:

We must now airdrop tokens to this wallet. Click on your address at the top of the wallet screen to copy it to your clipboard.

Next, open your terminal and type the following command (while Solana-test-validator is running):

address> Solana airdrop 10

You should now have a total of ten tokens in your wallet. We can now launch and test the app!

Navigate to the app directory and execute the following command:

start npm

You should be able to link your wallet, create and increase a counter.

You'll note that the program's state is lost when you refresh. This is because the primary account is generated dynamically when the software loads. Suppose you wanted to read and interact with programme data across several clients. In that case, you'd have to build and store the Keypair someplace in your project. I've put up a rough outline of a naïve approach to how this would appear.

World part 2

Let's modify this software so that, instead of dealing with a counter, we may construct a message and maintain track of all previously created messages.

To do this, let's change our Rust programme to look like this:

We're keeping track of two types of data in this programme: a String called data and a Vector called data list, which holds a list of every data ever added to the programme. In order to account for the Vector, the memory allocation here is more significant (128 + 128) than in the initial application. I'm not sure how many updates you'd be able to save in this programme. Still, it's something to look into more or play with, as this example is experimental and only serves to demonstrate how things operate.

Following that, we may revise the test for this new programme:

To test it out:

anchor test

If the test fails, try turning off the validator and running again.

Next, let's update the client.

You'll have a new IDL with the updated build that you'll need to update for your client. Copy the updated IDL to app/src/idl.json or execute the copyIdl.js script.

Putting it to the test

When testing the new software, update the idl.json file that the build generated.

Navigate to the app directory and execute the following command:

npm start

Devnet deployment

Deploying to a live network is rather simple from here. The following are the most important things we must do:

1. Change the Solana CLI to utilise devnet by running Solana config set —url devnet.

2. Reconfigure Phantom wallet to utilise devnet.

3. In Anchor.toml, change the cluster name from localnet to devnet.

4. Re-create the programme. Check that the programme ID in Anchor.toml corresponds to the current programme ID.

5. Re-deploy the software; this time, it will be deployed to devnet.

6. We also need to alter the network in app/src/App.js, this time using the clusterApiUrl from @solana/web3, as seen below:

/* prior to */

endpoint="http://127.0.0.1:8899">ConnectionProvider

/* following */ import..., clusterApiUrl from '@solana/web3.js';

network const = clusterApiUrl('devnet');

endpoint=network>ConnectionProvider>

As we have completed the previous stages, you should be able to deploy and test from here.

Final Thoughts

As a Solana developer you will find out that the learning curve and development processyou’re your project is steep. That is mostly because Rust is a harder programming lanauge. You can, however master stuff and become really good at development on Solana with time and practice. Smart contracts, non-fungible tokens (NFTs), and a wide range of decentralised applications are possible with Solana (dApps). The SOL token is unique to the Solana blockchain, offering network security and value transmission. Setting up our local network and airdropping tokens into our wallets will be the primary uses of the Anchor and Node. Anchor is a Rust framework created for the Solana programme test. It allows us to build an eDSL (embedded DSL) that abstracts away many of the more complex low-level processes required to use Solana & Rust without it.

This article describes how to utilise Anchor to interact with a client's Solana software. The first programme we construct will allow us to create a counter that increases each time a client application calls it using the 'anchor test' method. We now have a counter that uses the build's Program ID. This will replace the placeholder ID we created when we began the project in Rust. Solana Wallet Adapter to link the user's Solana wallet.

You should be able to link your wallet, create and raise a counter with the newest Rust. Modify this programme to produce messages and keep track of them. The memory allotment is higher (128 + 128) than before. The next step is to re-deploy the programme on a live network.

Let's build together on Solana

Next Article

How to Build & Deploy Smart Contracts on Solana

Other Related Services From Rejolut

How to Build & Deploy Smart Contracts on Solana

Solana Is A Decentralized Blockchain Is Unique For Its Proof Of History Consensus Technique

How to buy & sell Solana NFT | An Extensive Guide

According to DappRadar, NFT sales will reach $25 billion in 2021.

Decentralized Finance
Top DeFi Projects Built on the Solana Blockchain

DeFi Is An Umbrella Name For Peer-To-Peer Financial Services On Public Blockchains Like Solana.

Key Benefits of the Rapid Concept Workshop

Reduce Cost

RCW™ is the number one way to reduce superficial and bloated development costs.

We’ll work with you to develop a true ‘MVP’ (Minimum Viable Product). We will “cut the fat” and design a lean product that has only the critical features.

Define Product Strategy

Designing a successful product is a science and we help implement the same Product Design frameworks used by the most successful products in the world (Facebook, Instagram, Uber etc.)

Speed

In an industry where being first to market is critical, speed is essential. RCW™ is the fastest, most effective way to take an idea to development. RCW™ is choreographed to ensure we gather an in-depth understanding of your idea in the shortest time possible.

Limit Your Risk

Appsters RCW™ helps you identify problem areas in your concept and business model. We will identify your weaknesses so you can make an informed business decision about the best path for your product.

Our Team

Vishal Dharmawat

Blockchain Expert & Consultant

Rahul Asati

Blockchain Expert & Delivery

Devishankar Mishra

Head of Delivery

Rahul Sharma

Head of Design

Our Clients

We as a blockchain development company take your success personally as we strongly believe in a philosophy that "Your success is our success and as you grow, we grow." We go the extra mile to deliver you the best product.

BlockApps

CoinDCX

Tata Communications

Malaysian airline

Hedera HashGraph

Houm

Xeniapp

Jazeera airline

EarthId

Hbar Price

EarthTile

MentorBox

TaskBar

Siki

The Purpose Company

Hashing Systems

TraxSmart

DispalyRide

Infilect

Verified Network

What Our Clients Say

Don't just take our words for it

I have worked with developers from many countries for over 20 years on some of the most high traffic websites and apps in the world. The team at rejolut.com are some of most professional, hard working and intelligent developers I have ever worked with rejolut.com have worked tirelessly and gone beyond the call of duty in order to have our dapps ready for Hedera Hashgraph open access. They are truly exceptional and I can’t recommend them enough.
Joel Bruce
Co-founder, hbarprice.com and earthtile.io
Rejolut is staying at the forefront of technology. From participating in, and winning, hackathons to showcase their ability to implement almost any piece of code. To contributing in open source software for anyone in the world to benefit from the increased functionality. They’ve shown they can do it all.
Pablo Peillard
Founder, Hashing Systems
Enjoyed working with the Rejolut team. Professional and with a sound understanding of smart contracts and blockchain. Easy to work with and I highly recommend the team for future projects. Kudos!
Zhang
Founder, 200eth
They have great problem-solving skills. The best part is they very well understand the business fundamentals and at the same time are apt with domain knowledge.
Suyash Katyayani
CTO, Purplle

Think Big, Act Now & Scale Fast

Speed up your blockchain adoption with our proven framework.

We are located at