Any developer can get began with Solana blockchain app improvement with the appropriate instruments. When choosing one of many main Solana improvement instruments, the Solana API, quick code snippets do all of the blockchain-related backend work. Right here’s an instance of the API in motion fetching balances of a pockets:
@app.submit("/getWalletbalance") def getWalletbalance(): physique = request.json params = { "tackle": physique["address"], "community": physique["network"] } outcome = sol_api.account.steadiness( api_key= moralis_api_key, params = params ) return outcome
The “sol_api.account.steadiness” technique is simply one of many highly effective strategies within the Moralis Solana API set. On this article, we’ll present you tips on how to simply implement all of them, which is the important thing to easy Solana blockchain app improvement. If that pursuits you, ensure that to create your free Moralis account and observe alongside!

Overview
In as we speak’s article, we’ll first deal with a beginner-friendly Solana blockchain app improvement tutorial. The latter will train you tips on how to simply work with the Solana API. Through the use of our present Solana dapp, we’ll show tips on how to transition from NodeJS to Python backend with out affecting the JavaScript frontend. Apart from the endpoint used above, this tutorial will implement all the Solana API fleet.
The second half of this information will show you how to higher perceive Solana and Solana blockchain improvement. That is additionally the place we’ll take a better have a look at the Solana blockchain improvement companies and sources. As such, you’ll have an opportunity to study extra in regards to the Solana API. Consequently, you’ll have the ability to decide which endpoints it is best to deal with to your Solana blockchain app improvement feats.

Solana Blockchain App Improvement with the Solana API
As talked about above and because the above picture illustrates, this Solana blockchain app improvement tutorial focuses on shifting the backend from NodeJS to Python with out affecting the frontend. The latter is a straightforward JavaScript app that permits customers to make the most of the facility of the Solana API endpoints:

Notice: You’ll be able to clone the whole frontend script – “index.html” – on GitHub. In case you need a fast code walkthrough of our instance frontend dapp, take a look at the video on the high of this text, beginning at 1:05.
In an effort to use Python to implement the Solana API, it’s good to full some preliminary setups, which is precisely what the upcoming part will show you how to with.
Setting Up Python and Solana Blockchain Improvement Companies
Earlier than shifting on, ensure that to have your “Solana API demo” venture prepared. The latter ought to include a “frontend” folder, which incorporates the above-mentioned “index.html” script, presuming you cloned our code. In case you probably did clone our NodeJS backend as nicely, you must also have a “backend” folder in your venture:
Transferring on, begin by making a “python-backend” folder. You are able to do this manually or through the next command:
mkdir python-backend
Subsequent, “cd” into this new folder by operating the command beneath:
cd python-backend
Then, it’s good to create a brand new digital atmosphere that can assist the set up and use of Python modules. As such, enter this into your terminal:
python3 -m venv venv
You additionally must activate your digital atmosphere:
Run the next “activate” command:
supply venv/bin/activate
Subsequent, it’s good to set up the mandatory modules. The command beneath will set up Flask, Flask CORS, Moralis, and Python “dotenv”:
pip set up flask flask_cors moralis python-dotenv
Together with your digital atmosphere activated and modules put in, chances are you’ll proceed with establishing the atmosphere variables. Therefore, ensure that to acquire your Moralis Web3 API key. The latter is the gateway to Solana blockchain app improvement with the Solana API from Moralis. So, for those who haven’t created your Moralis account but, try this now. Together with your account, you get to entry your admin space. There, you possibly can acquire your Web3 API key within the following two steps:
Create a brand new “.env” file or copy it from the NodeJS backend folder and populate the “MORALIS_API_KEY” variable with the above-obtained API key.
The way to Use Solana Blockchain Improvement Companies with Python
To implement the Moralis Solana API endpoints with Python, create a brand new “index.py” file inside your “python-backend” folder. Then, import the above-installed packages and the highest of that script:
from flask import Flask, request from flask_cors import CORS from moralis import sol_api from dotenv import dotenv_values
You additionally need this script to fetch your Web3 API key, which you retailer within the “.env” file:
config = dotenv_values(".env") moralis_api_key = config.get("MORALIS_API_KEY")
On the subsequent line, use Flask to outline a variable “app” and embrace “CORS“:
app = Flask(__name__) CORS(app)
Since you’re changing our NodeJS backend that runs on port “9000“, ensure that your Python backend deal with the identical port. In any other case, you’d want to switch the URL in your frontend. These are the strains of code that can deal with that:
if __name__ == "__main__": app.run(debug=True, host="0.0.0.0", port=9000)
Transferring additional down your “index.py” script, it’s time you begin implementing the Moralis Solana API endpoints: “Get native steadiness by pockets”, “Get token steadiness by pockets”, “Get portfolio by pockets”, “Get token value”, “Get NFTs by pockets”, and “Get NFT metadata”.
The only means to make use of these Solana blockchain improvement companies is to repeat the suitable strains of code from the Solana API reference pages. When working with Python, it’s good to choose that programming language. Right here’s the “Get native steadiness by pockets” endpoint reference web page:

Implementing Solana API Endpoints
Return to your “index.py” script to outline routes and features for every endpoint beneath the “CORS(app)” line. So far as the “get native steadiness by pockets” endpoint goes, the strains of code from the introduction will get the job accomplished:
@app.submit("/getWalletbalance") def getWalletbalance(): physique = request.json params = { "tackle": physique["address"], "community": physique["network"] } outcome = sol_api.account.steadiness( api_key= moralis_api_key, params = params ) return outcome
The highest line – “@app.submit(“/getWalletbalance“) – creates a brand new route in Python. With “def getWalletbalance():“, you outline the operate for the endpoint at hand. Utilizing “physique = request.json“, you learn the JSON knowledge that Moralis fetches and parses for you. Then, you outline the endpoint’s parameters (“tackle” and “community“). Utilizing the “sol_api.account.steadiness” technique with the parameters and your Web3 API key, you retailer the info below the “outcome” variable. Lastly, you employ “return outcome” to return outcomes.
Python Snippets of Code for All Solana API Endpoints
In terms of different Solana API endpoints, the very same ideas are at play. Primarily, you should use the identical strains of code as introduced above. Nevertheless, you do want to alter the routes, operate names, and strategies to match the endpoint. To save lots of you a while, yow will discover the snippets of code for the remaining 5 Solana API endpoints beneath:
- Implementing the “getTokenbalance” endpoint:
@app.submit("/getTokenbalance") def getTokenbalance(): physique = request.json params = { "tackle": physique["address"], "community": physique["network"] } outcome = sol_api.account.get_spl( api_key= moralis_api_key, params = params ) return outcome
- Implementing the “getNfts” endpoint:
@app.submit("/getNfts") def getNfts(): physique = request.json params = { "tackle": physique["address"], "community": physique["network"] } outcome = sol_api.account.get_nfts( api_key= moralis_api_key, params = params ) return outcome
- Implementing the “getPortfolio” endpoint:
@app.submit("/getPortfolio") def getPortfolio(): physique = request.json params = { "tackle": physique["address"], "community": physique["network"] } outcome = sol_api.account.get_portfolio( api_key= moralis_api_key, params = params ) return outcome
- Implementing the “getNFTMetadata” endpoint:
@app.submit("/getNFTMetadata") def getNFTMetadata(): physique = request.json params = { "tackle": physique["address"], "community": physique["network"] } outcome = sol_api.nft.get_nft_metadata( api_key= moralis_api_key, params = params ) return outcome
- Implementing the “getTokenPrice” endpoint:
@app.submit("/getTokenPrice") def getTokenPrice(): physique = request.json params = { "tackle": physique["address"], "community": physique["network"] } outcome = sol_api.token.get_token_price( api_key= moralis_api_key, params = params ) return outcome
Notice: The whole “index.py” script is ready for you on our GitHub repo web page.
Exploring the Outcomes of Your Solana Blockchain App Improvement
Be sure you are inside your “python-backend” folder. Then use the next command to run “index.py”:
python3 index.py
The above command begins your backend on port “9000“. To entry the facility of your backend, you additionally want to start out your frontend. You are able to do this with the “Reside Server” extension in Visible Studio Code (VSC). Excellent-click on “index.html” and choose the “Open with Reside server” choice:
Lastly, you get to mess around together with your frontend dapp and check all Solana API endpoints. The next are our examples for the “Get Native Stability by Pockets” and “Get Token Stability by Pockets” choices:
- The “Get Native Stability by Pockets” demo:
- The “Get Token Stability by Pockets” demo:
Exploring Solana Blockchain App Improvement
For those who like getting your palms soiled, you loved the above tutorial and almost certainly created your personal occasion of our instance Solana blockchain app. Nevertheless, it is necessary that you simply perceive the theoretical fundamentals behind Solana blockchain app improvement. So, let’s first reply the “what’s Solana?” query.

What’s Solana?
Solana is a non-EVM-compatible programmable blockchain. It’s public and open-source. Solana helps good contract improvement (on-chain applications), token creation, and all types of dapps (decentralized purposes). Like all main programmable chains, Solana makes use of its native coin, “SOL”, to supply community safety through Solana’s hybrid DeFi staking consensus. SOL can be used to cowl transaction charges on Solana. Like most cryptocurrencies, it may be used to switch worth on the Solana community.
Raj Gokal and Anatoly Yakovenko launched Solana again in 2017. Each of those devs are nonetheless deeply concerned with Solana by means of Solana Labs. The latter is a expertise firm that builds instruments, merchandise, and reference implementations that develop the Solana ecosystem.
Notice: To study extra about Solana, use the “what’s Solana?” hyperlink above.

What’s Solana Blockchain Improvement?
Solana blockchain improvement is any form of dev exercise that revolves across the Solana blockchain. At its core, it refers back to the creation and steady enchancment (updates implementation) of the Solana blockchain itself. That is what Solana’s core crew and neighborhood deal with.
Alternatively, Solana blockchain improvement may also seek advice from Solana good contract constructing and the creation of dapps that work together with this well-liked decentralized community. For many builders, that is way more thrilling and accessible, particularly after they use the appropriate Solana blockchain improvement companies, sources, and instruments.

Which Programming Language is Used for Solana Improvement?
Rust is the programming language that Solana helps for writing on-chain applications. So, if you wish to code your distinctive and superior good contracts for Solana, you’ll need to be expert in Rust. As two options to Rust, you may additionally create Solana on-chain applications with C or C++. Nevertheless, if you wish to create NFTs on Solana, you are able to do so with none superior programming expertise, due to some neat Solana dev instruments (extra on that beneath).
In terms of Solana blockchain app improvement, you’ve already realized that NodeJS and Python can get the job accomplished. Furthermore, Moralis additionally helps cURL, Go, and PHP. As such, you should use totally different legacy programming languages to construct killer Solana dapps.

Solana Blockchain Improvement Companies and Assets
The Solana API from Moralis offers the perfect Solana blockchain improvement companies. They arrive within the following Web3 knowledge endpoints, which you should use with all main programming languages/frameworks:
- Stability API endpoints:
- Get native steadiness by pockets
- Get token steadiness by pockets
- Get portfolio by pockets
- Token API endpoints:
- NFT API endpoints:
- Get NFTs by pockets
- Get NFT metadata
With the above APIs supporting Solana’s mainnet and devnet, you possibly can fetch NFT metadata, pockets portfolios, token balances, and SPL token costs. As such, you should use the Moralis Solana API in numerous methods. As an illustration, you possibly can construct NFT marketplaces, token value feeds, portfolio dapps, and far more.
Apart from Web3 knowledge, all dapps additionally want user-friendly Web3 authentication. That is the place the Moralis Authentication API enters the scene. The latter helps Ethereum and all main EVM-compatible chains and Solana. With the “Request problem” and “Confirm problem” endpoints, you possibly can incorporate seamless Web3 logins for all main Solana wallets into your dapps. In case you are not sure tips on how to reply the “what’s a Solana pockets?” query, discover our article on that topic.
In terms of creating Solana on-chain applications, Solana good contract examples can prevent quite a lot of time. Additionally, if you wish to create NFTs on this community, Solana NFT mint instruments simplify issues immensely, corresponding to Metaplex Sweet Machine. For those who resolve to dive deeper into Solana improvement, you’ll additionally need to get conversant in Solana Labs’ native applications and Solana Program Library (SPL).
Nonetheless, a dependable Solana testnet faucet will give you testnet SOL to check your dapps and good contracts on the Solana devnet:
The way to Get Began with Solana Blockchain App Improvement – Abstract
We coated fairly a distance in as we speak’s article. Within the first half of this Solana blockchain app improvement information, you had an opportunity to observe our tutorial and use Python to create an instance Solana backend dapp. As for the second a part of as we speak’s article, we ensured you understand what Solana is and what Solana blockchain improvement entails. You additionally realized that Rust is the main programming language for creating Solana good contracts. Lastly, we coated the perfect Solana blockchain improvement companies, sources, and instruments. As such, you’re all set to start out BUIDLing killer Solana dapps!
In case you have your personal concepts and the required expertise, use the data obtained herein and be part of the Web3 revolution. Nevertheless, for those who want extra apply or another concepts, ensure that to discover our Solana tutorials, which await you within the Moralis docs, on our blockchain improvement movies, and our crypto weblog. These are additionally the shops for exploring Web3 improvement on different main blockchains and studying about different sensible instruments. Nice examples are our gwei to ETH calculator, Goerli faucet, Sepolia testnet faucet, and record of Web3 libraries. For those who’re not fixated on Solana, you possibly can even use Notify API options to hearken to blockchain pockets and good contract addresses. Or, ensure that to take a look at our information on tips on how to create your personal ERC-20 token. These are simply a number of the numerous choices that Moralis offers.
It’s additionally price stating that blockchain provides many nice job alternatives, and changing into blockchain-certified may help you land your dream place in crypto. If that pursuits you, ensure that to think about enrolling in Moralis Academy! We advocate beginning with blockchain and Bitcoin fundamentals.