March 4, 2023

Solana Devnet – How to Build Dapps on Solana

Table of Contents

Solana is one of the most popular non-EVM-compatible blockchains, attracting numerous developers to create dapps (decentralized applications) on its network. However, before launching dapps directly on its mainnet, the Solana devnet is the go-to choice. 

If you’re an aspiring Solana developer, this article will help you understand the Solana devnet to get going in your Solana journey. You’ll have a chance to learn how to start building dapps on this popular network easily with the help of the Moralis Solana API. The latter supports both the Solana mainnet and the Solana devnet. Furthermore, with Moralis, you can use short code snippets to fetch parsed on-chain data with any of the leading programming languages and frameworks. For example, let’s say you want to get NFTs from users’ wallets. In that case, you can use the Moralis Solana NFT API endpoint to get NFTs by wallet either using Python or NodeJS with just a few simple lines of code:

The get_nfts endpoint using Python:

result = sol_api.account.get_nfts(

The getNFTs endpoint using NodeJS:

const response = await Moralis.SolApi.account.getNFTs({

The network parameter enables you to choose between the Solana mainnet and the Solana devnet. Of course, to make the above endpoints work, you also need to import Moralis, obtain your Web3 API key, and properly define the parameters. Fortunately, we’ll show you how to do that in the “Build Dapps on the Solana Network with Moralis” section. Before we get there, make sure to sign up with Moralis!  

Build on the Solana Devnet - Sign Up with Moralis


In today’s article, we will cover the following topics:

  • What is the Solana Devnet
  • Solana Devnet vs Solana Mainnet
  • Solana Devnet vs Testnet
  • What is a Solana Devnet Faucet
  • Building on the Solana Devnet
  • Write a Solana Smart Contract for the Devnet
  • Get the Portfolio Balance on Solana
  • Build Dapps on the Solana Network with Moralis

The final three topics of today’s article will show you how to easily build dapps using the power of Moralis. Aside from the above showcased “Get NFTs by wallet” endpoint, you’ll learn about other Moralis Solana API endpoints. Here’s an overview of the current Solana API fleet with the lines of code for the NodeJS framework:

Solana NFT API

  • The getNFTs endpoint to get NFTs by wallet:  
const response = await Moralis.SolApi.account.getNFTs({
  • The getNFTMetadata endpoint to get NFT metadata:
const response = await Moralis.SolApi.nft.getNFTMetadata({

Solana Token API

  • The getTokenPrice endpoint to get the token price:
const response = await Moralis.SolApi.token.getTokenPrice({

Solana Balance API

  • The getBalance endpoint to get the native balance by wallet:
const response = await Moralis.SolApi.account.getBalance({
  • The getSPL endpoint to get the token balance by wallet:
const response = await Moralis.SolApi.account.getSPL({
  • The getPortfolio endpoint to get the portfolio by wallet:
const response = await Moralis.SolApi.account.getPortfolio({

Solana Auth API

  • The requestMessage endpoint to request a Solana challenge:
const result = await Moralis.Auth.requestMessage(options);
  • The verify endpoint to verify the Solana challenge:
const verifiedData = Moralis.Auth.verify({
  message: message,
  signature: signature,
  network: network,

However, before we can show you how to implement some of these code snippets above, you ought to get the basics of the Solana devnet under your belt. Now, if you’d like to skip the basics, feel free to scroll down to the “Building on the Solana Devnet” section!

Title - What is the Solana Devnet?

What is the Solana Devnet?

The Solana devnet is a test network for the Solana blockchain. This devnet is specifically designed for developers to test their dapps before deploying to the main Solana network. Thanks to this network, developers get to experiment with Solana’s features, such as smart contracts, token creation, and other dapps. Additionally, they get to do so without risking real funds (SOL) or affecting the performance of the main network.

The devnet is an important tool for developers because it enables them to test their dapps in a controlled environment. That way, devs can identify and fix potential issues and vulnerabilities before they go live on the main network. Also, the Solana devnet provides a sandbox environment for developers to learn and experiment with the Solana ecosystem. Despite its name, the devnet is not only for developers, but every Solana user can connect to this network to take Solana for a test drive.

Aside from the public devnet, which is the primary focus of this article, developers may also use the “localnet” environment. The latter allows devs to run a local instance of Solana for testing and development purposes.

Build on Solana with Moralis

Solana Devnet vs Solana Mainnet

The devnet is basically a replica of Solana’s mainnet. After all, the goal is for the devnet to resemble the mainnet as much as possible to give proper weight to testing. However, there are some key differences between the two networks:

  • SOL vs Devnet SOL – Transactions and network security of the mainnet are powered by Solana’s native coin: SOL. The latter is a cryptocurrency that one must purchase with fiat or another cryptocurrency. On the other hand, the devnet SOL is not “real” – anyone can obtain it for free from a reliable Solana faucet
  • Ledger Resets – The devnet may be subject to ledger resets, which is not the case for the mainnet.
  • Software Release – Typically, the mainnet and the devnet run the same software release branch version. However, updates are rolled out to the devnet first. Thus, there may be times when the devnet runs a newer release than the mainnet.  
Solana Devnet vs Testnet?

Solana Devnet vs Testnet

By definition, the Solana devnet is a test network; however, it is a different network than the Solana testnet. It’s worth noting that most other leading blockchains offer only testnets. Thus, Solana’s devnet is often referred to as a testnet, which can cause some confusion. However, keep in mind that these are two separate networks with essentially the same properties. The core difference is in whom the networks serve.  

The devnet is intended to serve all Solana developers and users who want to test on-chain programs, create tokens, and build various dapps. On the other hand, the Solana testnet is meant to primarily serve Solana’s core developers and contributors for stress testing the mainnet’s upcoming upgrades. With the Solana testnet, the core Solana contributors test network stability, performance, and validators’ behavior.

Title - What is a Solana Faucet?

What is a Solana Devnet Faucet?

A Solana devnet faucet is an online application that allows you to obtain devnet SOL. Accordingly, this is the tool to use to get the native “play” or “testnet” currency of the devnet and then use it to execute test transactions. The most user-friendly crypto faucets enable users to simply input their wallet address, hit a button, and receive test assets in their wallet. That is exactly how the Solana faucet that awaits you on our “Pure Faucets” page works.

Solana Devnet Faucet Landing Page

Note: The above page includes links to all leading crypto faucets, such as a vetted Goerli faucet and many others. So, whether you wish to build on Aptos, target the Arbitrum testnet, Ethereum testnet, or any of the leading EVM-compatible chains’ testnets, this is the page to use to get their respective test tokens.

If you wish to learn more details about how to use a reliable Solana faucet, make sure to read our article on that subject. You can access that article via the “Solana faucet” link above. There, you’ll also find detailed instructions on how to use the best Solana faucet; however, the following screenshot covers the gist:

Devnet Faucet for Solana page with entry field

Building on the Solana Devnet

By this point, you know that if you wish to build on the Solana mainnet, you should first build on the Solana devnet. So, whether you want to deploy a simple on-chain program (smart contract), create new SPL tokens, or build a complex dapp that utilizes multiple smart contracts, you should start on the devnet.

When it comes to building dapps, you have two options. You can focus on utilizing existing smart contracts, or you can also create your own smart contracts. The first option is a lot simpler, as it allows you to use some powerful tools to effortlessly fetch the on-chain data using legacy programming languages and frameworks, such as NodeJS, Python, Go, etc. On the other hand, creating your own smart contracts requires getting acquainted with some specific Solana standards and tools. However, unlike Ethereum, where smart contracts are mainly written in Solidity, Solana allows you to use legacy programming languages to write on-chain programs. As such, you can use Rust, C, and C++; however, Rust is the most popular choice. 

To help you get started with either of the two options of building on Solana, we’ve prepared two short video tutorials. We encourage you to follow along and get a taste of writing your own smart contracts and building dapps by using existing smart contracts and fetching on-chain data.

Write a Solana Smart Contract for the Devnet

The above video will show you how to use Rust to write a simple Solana smart contract. It will guide you through the Rust and Solana CLI installation process and the code itself. You’ll also have a chance to create a clean, simple frontend that gives users a neat way to trigger your new smart contract:

To easily implement Web3 authentication, you will get to use the Moralis Auth API presented in the intro. Last but not least, the above video also introduces a Solana playground app that enables you to deploy and test Solana programs in your favorite browser. Nonetheless, if you prefer written instructions over a video, learn to write a Solana smart contract from our article on the subject – just click the link in this sentence. 

As you probably know, to create your own Solana tokens, you must also deploy your own smart contracts. However, in case you want to create NFTs on Solana, you can use Metaplex’s Candy Machine. This is a powerful tool that basically generates a Solana NFT smart contract on your behalf. As a result, it makes creating NFT SPL tokens a lot simpler.

Get the Portfolio Balance

There are many cool dapps that you can build on Solana without deploying your own smart contracts. Some great examples are Web3 wallets, portfolio trackers, and NFT galleries. The easiest way to build such dapps is to use the power of Moralis. This is where the Solana API endpoints outlined in the “Overview” section come to play. 

You can follow the above video to create a simple portfolio tracker that utilizes the power of the getPortfolio endpoint. The latter essentially combines the power of the getBalance, getSPL, and getNFTs endpoints. Moreover, the following are the NodeJS lines of code enabling you to implement that powerful API endpoint in your backend:

const getPortfolio = async (address, network) => {
  const data = await Moralis.SolApi.account.getPortfolio({

  return data.raw;
};"/getPortfolio", async (req, res) => {
  const { address, network } = req.body;
  try {
    if (address && network) {
      const response = await getPortfolio(address, network);
    } else {
      res.status(400).send({ error: "Missing Inputs" });
  } catch (e) {
    res.status(400).send({ error: e.message });

In addition, you’ll also have a chance to create a simple frontend dapp that lets you enter any Solana wallet address, choose between the Solana mainnet and devnet, and get the specified wallet’s portfolio via the “Get Portfolio” button:

Build Dapps on the Solana Network with Moralis

If you want to dive into Solana blockchain app development with your legacy programming skills, there’s no better way than using Moralis. With the Web3 Data API and Authentication API, you can create killer dapps based on the existing Solana smart contracts and the on-chain data they process. All you need to start using these endpoints is your Moralis Web3 API key. And the latter awaits you inside your admin area, which you can access with your Moralis account credentials:

When it comes to implementing the Moralis Solana endpoints, you do not have to write the code from scratch. Instead, you can use the API reference pages from Moralis’ docs. There, you simply select the programming language/framework that you want to use and then copy the lines of code:

  • Solana Auth API:
  • Solana Web3 Data APIs:

Looking at the above screenshot, you can see that the API reference pages enable you to enter the parameters and take the endpoints for a spin right on the spot. By copying the lines of code from the API reference pages, you get to create your backend scripts in minutes. This means you can spend more time creating a unique frontend that will ensure a great user experience. So, start BUIDLing Solana dapps the easy way today!

Title - Build on Solana Devnet with Moralis

Solana Devnet – How to Build Dapps on Solana – Summary

We covered quite a distance in today’s article. First, we went through the basics that helped you understand what the Solana devnet is and how it’s different from Solana’s mainnet and testnet. You also find out what a Solana faucet is and where you can find a reliable one. As such, you now know how to get testnet SOL. 

In addition, we stated that there are two ways devs can start building on Solana: by creating their own on-chain programs or by building dapps on top of existing smart contracts and tokens. However, no matter which path you choose, you now know that you should first focus on the devnet. We even provided you with two video tutorials, allowing you to test the waters of each approach. Last but not least, you found out what makes Moralis so powerful and how you can easily implement blockchain-related backend functionalities using the Moralis API reference pages.

In case you wish to explore other blockchain development topics, make sure to visit the Moralis YouTube channel and the Moralis blog. 

Market Data API
Build amazing trading and portfolio dapps with this Market Data API. Keep users engaged with up-to-date data!
Market Data API
Related Articles
October 15, 2022

NodeJS Web3 Tutorial – Create Dapps Using a NodeJS Web3 Example

September 13, 2023

How to Write a Smart Contract in Solidity – Full Guide 

November 21, 2022

Amazon GameSparks Guide – What is Amazon GameSparks?

November 22, 2023

Best NFT Data Analytics for 2024 – Real-Time NFT Transfers, Tracking & Discovery

August 9, 2022

Blockchain Syncs – Exploring On-Chain Syncing

August 23, 2022

How to Use Filecoin in Unity for Storage

December 7, 2022

Python for Ethereum Development – Build a Web3 Ethereum Python App

November 20, 2023

What’s the Difference Between Polygon PoS vs Polygon zkEVM?

March 6, 2023

Web3 Marketplace Development – Build a Web3 Business in 3 Steps