This page may contain legacy content

To get our most up-to-date content please access our documentation

July 14, 2022

Solana Programming – The Ultimate Guide to Solana Development

Table of Contents

Solana is one of the programmable blockchains that defined 2021. However, there is much more to Solana than its 2021 price rally. Specifically, a lot of devs are focusing on Solana programming. And, unlike Ethereum, this chain has much lower gas fees, giving it an advantage over e.g. Ethereum. Moreover, there are a myriad of projects on the Solana chain – not to mention SPL tokens and Solana NFTs (non–fungible tokens). Moreover, unlike most other popular blockchain networks, Solana is not EVM-compatible. As such, Solana does not use Solidity as its programming language. Nevertheless, we’ll cover all you need to know about Solana programming, regardless of your prior knowledge. Firstly, you should know that there are certain tools you can leverage to make Solana programming a lot simpler. This is where Moralis, the ultimate Web3 development platform, makes a world of difference. And, since bear markets are for building, now is the best time to learn more about developing on Solana.

Moving forward, we will start with the basics and ensure you all know all about Solana. Then, we will take a closer look at how to do Solana programming. This is where you’ll also learn more about Solana programming language options. Next, we’ll dive deeper into Moralis’ Solana API, including the Solana NFT API. The latter enables you to build decentralized applications (dapps) around Solana NFTs without breaking a sweat. Last but not least, we’ll also do a quick overview of some neat example projects that can help you learn how to do Solana programming. Then, it will be up to you to dive deeper into any of these projects. If you decide to do that, you’ll learn to utilize the power of Moralis and tools like Metaplex. As such, you will have a chance to create your own Solana tokens, SPL dashboards, and other killer Solana dapps!         

What is Solana?

Anatoly Yakovenko and Raj Gokal launched Solana back in 2017. These two developers are still significantly involved with Solana Labs, which is the company behind Solana. Yakovenko is Solana Labs’ current CEO and Gokal its COO. However, that doesn’t tell us much about Solana – so in short, what is Solana?

Solana is a public and open-source programmable blockchain, meaning it supports smart contracts. However, in the case of Solana, the latter are called “programs”, though they play the same role as smart contracts. As such, Solana programs are key to Solana programming. Moreover, as mentioned in the introduction, just like Ethereum, Solana supports the development of fungible and non-fungible tokens. Of course, it is also a network on which devs can deploy all sorts of dapps. Furthermore, Solana’s native coin or token is called “SOL”. This native currency is used to provide network security via Solana’s hybrid DeFi staking consensus, to pay the transaction fees, and to transfer the value on this chain.

Moreover, despite Solana’s hybrid consensus mechanism, it falls into the category of proof-of-stake (PoS) chains. Solana’s PoS protocol, where staked SOL does the “mining”, ensures that the Solana blockchain maintains accurate information across all nodes. Furthermore, Solana’s theoretical throughput is a whopping 65,000 transactions per second. In addition to its high speed, transaction fees on Solana are less than one cent of a dollar. For comparison, Ethereum gas fees can often be in hundreds of dollars. So, these two factors make Solana quite popular both among users and devs. However, we have to mention that Solana’s had its issues and many skeptics continue to doubt its level of decentralization.

For a deeper dive into Solana’s hybrid consensus mechanisms, the chain’s pros and cons, and SOL’s tokenomics, follow the “what is Solana” link above. 

How to Do Solana Programming

With Solana basics under our belt, we can focus on how to do Solana programming. Here, we have to remind you that there are different types of Solana programming. For example, there’s creating Solana tokens, creating Solana dapps, and creating Solana programs (smart contracts equivalents). Sometimes, the lines between these kinds of programming can be very blurry. And, while creating Solana programs would be considered the core of Solana programming, you can create many Solana dapps using on-chain data and Solana wallets, such as Phantom, without writing Solana programs. Moreover, even though programs are behind token minting, you can actually create SPL tokens without writing your own Solana program. Thus, it all depends on your goals and preferences.

The most general way to start with Solana programming would involve visiting Solana’s “Developer Resources” page. There you get to explore their docs and learn about Solana development workflows, programs, dapps, and client SDKs. Furthermore, this is the place to access the Solana Cookbook, SolDev, and the core Metaplex documentation. As such, we strongly encourage you to explore those valuable resources. However, the simplest way to go about Solana programming comes through Moralis. And, we’ll show you how to use this Firebase for crypto to get an API for Solana in a bit. But first, let’s take a closer look at Solana programming language options. 

What Programming Language Does Solana Use?

If we had to choose the Solana programming language, the most obvious choice would be Rust. However, C and C++ can also be used to deploy programs on Solana. So, if your goal is to become a hardcore Solana dev, the one that masters smart contract development on this chain, Rust is definitely a prerequisite. But, as you’ve learned previously, there are tools that enable you to focus solely on the frontend and still create killer dapps. As such, when you use Moralis, your JavaScript skills can be enough to cover your Solana programming needs. Hence, we’ll take a closer look at how to get Moralis’ Solana API. However, for those of you who want to learn more about the core Solana programming language, make sure to check out the following section!

The Core Solana Programming Language – Rust

Rust was created back in 2010 by Graydon Hoare. Hence, Rust existed years before Solana, unlike Solidity, which was designed particularly for Ethereum. This fact gives a certain advantage to developers that are already Rust proficient. Moreover, Rust is an open-source programming language. It is highly performant, statically typed, and memory-efficient. Rust is a great choice for developers who are interested in reliability and safety. Furthermore, Rust also makes controlling low-level details such as memory very easy. Also, thanks to Rust’s type system and ownership model, developers can eliminate several classes of bugs when compiling. 

Another advantage of Rust is that it has no runtime or garbage collector. Hence, it easily powers performance-critical computations and runs on embedded devices. Moreover, it is very easy to integrate Rust with other popular programming languages. Nonetheless, according to developers, the core Solana programming language is quite intuitive and versatile, and creating programs on Solana is just one of its applications. 

Get an API for Solana Programming

The Moralis’ Solana API is the simplest way to start with Solana programming. With this fast and powerful API, you get to effortlessly query data from the Solana blockchain. Essentially, Solana API is a very powerful REST API. Moreover, it enables you to fetch user token balances, NFT metadata, and much more. Furthermore, as common with REST APIs, you can call the Solana API by default in any programming language. As such, you can effortlessly fetch Solana data throughout multiple applications and platforms 

However, the simplest way to use this API is by calling it using the Moralis’ SDK. That way, it only takes a few lines of code. Moreover, the “Moralis.SolanaAPI” namespace is where all of these powerful functions reside. Furthermore, “Moralis.start()” automatically loads the “Moralis.SolanaAPI” module. In addition, for additional convenience, the above namespace is divided into two categories – “SolanaAPI.account” and “SolanaAPI.nft”. And, since Solana NFTs continue to be all the rage, let’s take a closer look at a Solana NFT API. 

Solana NFT Programming

By this point, you know that Solana is not EVM-compatible. As such, it has its own token standards, known as SPL. This is where Moralis provides you with “getNFTMetadata” to fetch the metadata of SPL NFTs. Moreover, this hook comes with two options: “network” and “address”.

The “network” option enables you to choose between Solana’s mainnet and devnet. Though, mainnet is the default value. On the other hand, the “address” option takes in an SPL NFT address. To further clarify the use of “getNFTMetadata” let’s look at the example code that gets devnet metadata for a given SPL NFT address:

const options = {
  network: "devnet",
  address: "6XU36wCxWobLx5Rtsb58kmgAJKVYmMVqy4SHXxENAyAe",
const nftMetadata = await Moralis.SolanaAPI.nft.getNFTMetadata(options);

And, here’s the result for the above lines of code:

  "mint": "string",
  "standard": "string",
  "name": "string",
  "symbol": "string",
  "metaplex": {
    "metadataUri": "string",
    "masterEdition": true,
    "isMutable": true,
    "primarySaleHappened": true,
    "sellerFeeBasisPoints": 0,
    "updateAuthority": "string"

Once you have access to the above details, you can build all sorts of dapps around it. Moreover, aside from NFTs’ metadata, you can also use “getNFTs” to return SPL NFTs of a particular address. This method also takes in network type (mainnet or devnet) and an address. Furthermore, there are several other Moralis Solana API hooks at your disposal, including “balance”, “getSPL”, and “getPortfolio”. For more details regarding these hooks, visit the Moralis documentation.  

Practice Solana Programming with Moralis

Based on our experience, learning by getting your hands dirty is highly effective in learning programming. As such, we encourage you to roll up your sleeves and tackle some of our Solana programming example projects. For instance, in case you can learn how to mint a Solana NFT with Metaplex. This example project will teach you how to mint each Solana NFT individually or how to batch mint without any Rust programming. 

Furthermore, we also recommend exploring how to get Solana NFT metadata. This is where you’ll be able to put the above-presented “getNFTMetadata” hook to use. Moreover, this is where you will also learn how to build a neat Web3 UI to present Solana NFTs in a user-friendly and eye-catching manner. 

Last but not least, we also encourage you to create a Solana token; all it takes is 5 simple steps. Moreover, you can then give your token a home and build a Solana token dashboard. Any of these tutorials will take you closer to becoming a Solana developer. As such, take your pick and start building. However, we strongly encourage you to complete all of them. Along the way, you’ll build up your confidence and will then be ready to tackle your own projects.     

Solana Programming – The Ultimate Guide to Solana Development – Summary

If this is your first time hearing about Solana, you now know everything you need to get going with Solana programming. Furthermore, even if you had basics such as “what is Solana” under your belt already, you had a chance to learn more about Solana programming. Hence, you now know that Rust is the main Solana programming language, used to create Solana programs. 

Moreover, you also know that you do not need to be Rust proficient to become a Solana programmer. In fact, you had an opportunity to learn about the simplest way to start creating Solana dapps, which is through the Moralis’ Solana API. And, since Moralis offers a free plan, this is also a way to save some money. In addition, we also shared some of our example Solana projects that can help you get the initial traction. However, if you are serious about becoming a Solana expert, taking a more professional approach might be the path for you. In that case, we recommend enrolling in Solana Programming 101.  

On the other hand, you may want to explore other blockchain development topics instead of focusing on Solana. If so, Moralis’ Web3 YouTube channel and Moralis’ Web3 blog are the outlets for you. There, you can find a ton of example projects that teach you how to create tokens and build all sorts of dapps on different programmable blockchains. And, thanks to Moralis’ cross-chain interoperability, you don’t get stuck to any particular network. Aside from actionable example projects, these two outlets also provide easy-to-understand explanations of crypto terms and concepts. Of course, you can also learn about NFTs from experienced NFT coders, learning e.g. about generating NFTs, how to create an NFT minting website, or learning more about NFT use cases. Also, you can turn to Moralis Academy if you want more structured lessons. Moreover, this is also the place to get professional mentorship and become a member of one of the most supportive and advancing blockchain communities.

Moralis Money
Stay ahead of the markets with real-time, on-chain data insights. Inform your trades with true market alpha!
Moralis Money
Related Articles
November 28, 2023

Best Free NFT Tools for Developers in 2024

September 13, 2022

How to Build a Decentralized Social Media Profile

December 2, 2022

Full Guide: What is Ethers.js?

February 27, 2023

Arbitrum DEX – List of Arbitrum DEXs and How to Build One

February 13, 2023

How to Build a Decentralized Cryptocurrency Exchange

January 25, 2023

Solana Testnet Faucet – How to Get Testnet SOL from Solana Faucets

September 25, 2022

Full Guide: How to Build an Ethereum Dapp in 5 Steps

March 6, 2023

Web3 Marketplace Development – Build a Web3 Business in 3 Steps