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

Becoming a Solana Developer: A Step-by-Step Guide

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

The fast-growing blockchain was founded by Anatoly Yakovenko & Raj Gokal, whose ideas of a truly efficient and scalable blockchain that also eliminates unpredictable fees and allows developers numerous options were 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 your understanding 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 centered 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 utilize 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 program 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 program you can create. The only thing that's going on here is that we're defining a function called initialize, which, when called, exits the program 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 program: 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 program through RPC. We can also put our program 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 program, 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 ourselves using the user's Solana wallet on the client.

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

Anchor, like the Provider, provides a handy means to access the program. 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 initialize 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 program 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 program: create and increment. These two functions are the RPC request handlers that will allow us to communicate with the programme from a client application.program

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 program 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 program. 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 program 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 utilize 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 and 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 program 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 program to look like this:

We're keeping track of two types of data in this program: a String called data and a Vector called data list, which holds a list of every data ever added to the program. 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 program. 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 program:

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 form here. The following are the most important things we must do:

1.Change the Solana CLI to utilize 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 program. Check that the program ID in Anchor.toml corresponds to the current program 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

Becoming a Solana nft developer might be the determining factor in whether someone is merely a crypto enthusiast or coder, a part of a core team, or somebody who has mastered cryptography. This is because becoming a Solana developer requires a significant amount of time and effort. The Solana blockchain platform is a community-driven initiative that is open-source and enables decentralized apps, smart contracts, and non-fungible tokens (NFTs). In addition, the platform is available to developers from all around the world (dApps). Staking and the transfer of value are two of the aspects that come naturally to the native coin of the Solana blockchain, which is known as SOL money.

As a Solana developer you will find out that the learning curve and development process you're your project is steep. That is mostly because Rust is a harder programming language. 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 decentralized 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 program 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 utilize Anchor to interact with a client's Solana software. The first program 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 and create and raise a counter with the newest Rust. Modify this program 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 program on a live network.

Let's build together on Solana

Next Article

How to Build & Deploy Smart Contracts on Solana

Research

NFTs, or non-fungible tokens, became a popular topic in 2021's digital world, comprising digital music, trading cards, digital art, and photographs of animals. Know More

Blockchain is a network of decentralized nodes that holds data. It is an excellent approach for protecting sensitive data within the system. Know More

Workshop

The Rapid Strategy Workshop will also provide you with a clear roadmap for the execution of your project/product and insight into the ideal team needed to execute it. Learn more

It helps all the stakeholders of a product like a client, designer, developer, and product manager all get on the same page and avoid any information loss during communication and on-going development. Learn more

Why us

We provide transparency from day 0 at each and every step of the development cycle and it sets us apart from other development agencies. You can think of us as the extended team and partner to solve complex business problems using technology. Know more

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.

Why Rejolut?

1 Reduce Cost

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.

2 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 (Ethereum, Solana, Hedera etc.)

3 Speed

In an industry where being first to market is critical, speed is essential. Rejolut's rapid prototyping framework(RPF) is the fastest, most effective way to take an idea to development. It is choreographed to ensure we gather an in-depth understanding of your idea in the shortest time possible.

4 Limit Your Risk

Rejolut RPF's 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 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

Rejolut is staying at the forefront of technology. From participating in (and winning) hackathons to showcasing their ability to implement almost any piece of code and 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

Location:

Mumbai Office
404, 4th Floor, Ellora Fiesta, Sec 11 Plot 8, Sanpada, Navi Mumbai, 400706 India
London Office
2-22 Wenlock Road, London N1 7GU, UK
Virgiana Office
2800 Laura Gae Circle Vienna, Virginia, USA 22180

We are located at