Looking to build decentralized applications (dapps) on the Solana mainnet or devnet? With Moralis for Developers, you can skip the heavy lifting and start developing immediately. Get real-time token prices, complete NFT metadata, in-depth wallet insights, and more – all with a single API call. Whether you’re building a wallet, NFT marketplace, or token analytics dashboard, Moralis gives you everything you need to ship faster!
To kick things off, we’ll dive straight into a code example to highlight the power of Moralis’ Solana API. Here’s how easy it is to get a wallet’s portfolio data:
import fetch from 'node-fetch'; const options = { method: 'GET', headers: { accept: 'application/json', 'X-API-Key': 'YOUR_API_KEY' }, }; fetch('https://solana-gateway.moralis.io/account/mainnet/kXB7FfzdrfZpAZEW3TZcp8a8CwQbsowa6BdfAHZ4gVs/portfolio?nftMetadata=true', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err));
Calling the endpoint returns all assets held by the specified wallet, including native tokens, fungible tokens, and non-fungible tokens (NFTs). Here’s what it looks like:
{ "nativeBalance": { "lamports": "10869403775", "solana": "10.869403775" }, "tokens": [ { "associatedTokenAddress": "23L3yLu19dzionjCm6WryuvC4MDiMvCmQK7uZV1hQmKp", "mint": "38PWZPwf5Yteg897jbytuAUwf5MPfZhA5LuN1Q6RunCj", "amountRaw": "61234990000", "amount": "61234.99", "decimals": 6, "name": "New XAI gork", "symbol": "gork", "logo": "https://logo.moralis.io/solana-mainnet_38PWZPwf5Yteg897jbytuAUwf5MPfZhA5LuN1Q6RunCj_cf1c20249bf6ee37efd52c4f3ab44bde.webp", "isVerifiedContract": false, "possibleSpam": false }, //... ], "nfts": [ { "associatedTokenAddress": "22ZW4s9ykErNkiE8Y2rQBthEsk9G3uAA2u8LPHMUyGcj", "mint": "Byg4PiNLvME2zi3fv8eb99mCKmvS6yxe64v2B55stqY5", "name": "Hiall Fendrel", "symbol": "UGS", "decimals": 0, "amount": "1", "amountRaw": "1", "possibleSpam": false, "media": null, "totalSupply": "1", "attributes": [ { "traitType": "Background", "value": "Pastel-pink" }, { "traitType": "Gender", "value": "Male" }, //... ], "contract": { "type": "non-fungible", "name": "Underground Society", "symbol": "UGS" }, "collection": { "collectionAddress": "9VeLfmrCDSS9LMDdYN2KYB39ujQiudAe3XCzvuPPgwdf", "name": "Underground Society", "description": "1056th of 5000 Underground Society NFTs", "imageOriginalUrl": "https://bafybeid6ldvwrgcmsyqs237kujepkxmpuralkhlpnwcktt36oxwv6vyuze.ipfs.nftstorage.link/164.png?ext=png", "externalUrl": null, "metaplexMint": "9VeLfmrCDSS9LMDdYN2KYB39ujQiudAe3XCzvuPPgwdf", "sellerFeeBasisPoints": 0 }, "firstCreated": { "mintTimestamp": null, "mintBlockNumber": null, "mintTransaction": null }, "creators": [ { "address": "8xBMPGAj5NzAwRmdfEcksDcZyexr87AAmD6LWwKG7Dqq", "share": 0, "verified": true }, { "address": "F7kryTJ5VJK84DVJrMPBK1r2qLRifNzZ7AvdnuWgW43N", "share": 100, "verified": false } ], "properties": { "creators": [ { "address": "F7kryTJ5VJK84DVJrMPBK1r2qLRifNzZ7AvdnuWgW43N", "share": 100 } ], "files": [ { "uri": "https://bafybeid6ldvwrgcmsyqs237kujepkxmpuralkhlpnwcktt36oxwv6vyuze.ipfs.nftstorage.link/164.png?ext=png", "type": "image/png" } ] } }, //... ] }
With just this endpoint, you can effortlessly build a detailed portfolio view of a wallet, giving your users complete insight into all their digital assets!
To learn more about building dapps on Solana, join us in today’s guide as we dive deeper into this topic. And if you immediately want to start using Moralis’ APIs, please sign up for a free account using the button below:
Overview
One of the most challenging parts of building dapps is fetching and integrating on-chain data from the Solana blockchain. If you’re doing it all on your own, you need a robust underlying infrastructure for querying, decoding, and indexing the information, which is both time-consuming and resource-intensive to set up. But here’s the good news: you don’t have to do it yourself. With a top-tier crypto data provider, you can skip the hassle and launch faster than ever.
A crypto data provider takes care of all the complexities for you. In return, you can typically query the data you need without breaking a sweat. That way, you can focus on other, more important parts of building dapps, such as delivering user value.
To learn more about this and how you can easily build dapps on the Solana mainnet and testnet, join us in today’s article as we introduce you to the industry’s #1 crypto data provider: Moralis for Developers!
What is the Solana Mainnet & Devnet?
The Solana blockchain launched back in March 2020, and it aims to address key limitations of older blockchains like Ethereum by offering high throughput, low fees, and fast block finality. This makes Solana an ideal environment for building crypto projects like decentralized exchanges (DEXs), decentralized finance (DeFi) platforms, etc.

Solana uses a unique hybrid consensus model that combines proof-of-history (PoH) and proof-of-stake (PoS). PoH introduces a cryptographic timestamping mechanism, enabling validators to process transactions in parallel. As a result, Solana can support thousands of transactions per second with near-instant block finality.
The Solana ecosystem is split into two key environments that serve different purposes:
- Mainnet: The live, production-ready version of the Solana blockchain. It supports real economic activity, such as token trading, NFT minting, and dapp deployment.
- Devnet: A test network that mirrors the mainnet but uses test tokens and sandbox environments. It’s an excellent resource for developers who want to prototype, experiment, and try out features before they go live.
In short, Solana is one of the most popular blockchains driving next-generation Web3 experiences with speed, affordability, and a developer-friendly infrastructure.
With that said, how do you build dapps on the Solana mainnet and devnet? To learn more about this, join us below as we introduce Moralis!
Moralis for Developers – The Easiest Way to Build Dapps on the Solana Mainnet & Devnet
If you’re looking for the best crypto data provider, then you’ll want to check out Moralis for Developers. With top-tier APIs and next-generation RPC nodes, we streamline your developer experience, enabling you to build dapps faster and more efficiently. Access the tools, resources, and data you need – all in one single platform!

Here’s why developers choose Moralis as their data provider:
- More Data. Fewer Calls: Our outcome-driven APIs are designed to deliver more data in fewer requests. Get a wallet’s decoded transaction history, comprehensive OHLCV data, detailed portfolio insights, and much more with just one API call.
- Cross-Chain Support: Moralis supports all major chains, including Solana, Ethereum, BNB Smart Chain (BSC), Optimism, Base, and many more. Build fully cross-chain compatible projects with one single data provider.
- SOC 2 Type 2: Moralis is SOC 2 Type 2 certified, showing our commitment to maintaining enterprise-grade security and reliability across all tools and features.
With an overview of Moralis, let’s dive into the ultimate tool for building dapps on the Solana mainnet and devnet!
Exploring the Solana API
Moralis’ Solana API is the ultimate tool for anyone looking to build dapps on Solana. It allows you to fetch and integrate everything from detailed portfolio data to real-time token prices without any hassle.

Here are some key interfaces in Moralis’ Solana API suite:
- Token API: Fetch real-time prices, OHLCV candlesticks, snipers, holders, token analytics, and much more.
- Wallet API: Get detailed portfolio data, decoded wallet history, and token balances.
- NFT API: Query NFT balances, normalized metadata, image previews, and much more.
Let’s dive a bit deeper into each of these APIs!
Token API: Query Real-Time Prices, Holders, & Token Analytics
The Token API is a top-tier interface for fetching token-related data. Get real-time prices, holders, snipers, analytics, OHLCV candlesticks, and much more with just one API call. Use the Token API to build everything from interactive candlestick charts to advanced token analytics platforms with ease.

Let’s explore some prominent Solana Token API endpoints:
/token/:network/:address/price
: Query the price of any token, denominated in both the chain’s native currency and USD./token/:network/:address/top-holders
: Fetch a list of a token’s top holders, complete with balances, ownership percentages, and more./api/v2.2/tokens/search
: Search for any token by name, symbol, address, or pair address.
…and many more!
To highlight the power of the Token API, we’ll now show you how easy it is to get the price of a token. Here’s a sample script:
import fetch from 'node-fetch'; const options = { method: 'GET', headers: { accept: 'application/json', 'X-API-Key': 'YOUR_API_KEY' }, }; fetch('https://solana-gateway.moralis.io/token/mainnet/SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt/price', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err));
Calling the endpoint above will provide you with the price of the specified token, along with price changes over time, a logo, and other valuable data. Here’s what it can look like:
{ "tokenAddress": "SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt", "pairAddress": "8tzS7SkUZyHPQY7gLqsMCXZ5EDCgjESUHcB17tiR1h3Z", "exchangeName": "Raydium", "exchangeAddress": "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8", "nativePrice": { "value": "81680.5", "symbol": "WSOL", "name": "Wrapped Solana", "decimals": 9 }, "usdPrice": 0.014315, "usdPrice24h": 0.014726, "usdPrice24hrUsdChange": -0.0004109999999999999, "usdPrice24hrPercentChange": -2.7909819367105793, "logo": "https://logo.moralis.io/solana-mainnet_SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt_e7445e31c3869105.webp", "name": "Serum", "symbol": "SRM", "isVerifiedContract": true }
Check out the Solana Token API documentation to learn more about this premier tool.
Wallet API: Fetch Decoded Transaction History, Portfolio Data, & Native Balances
With the Wallet API, you only need a single API call to get a wallet’s decoded transaction history, detailed portfolio data, and native balance. Use this interface to build detailed transaction timelines, insightful portfolio views, and other premier features for your Solana dapps.

Here are some Solana Wallet API endpoints:
/account/:network/:address/portfolio
: Get a full portfolio view of a wallet, including fungible tokens and NFT balances./account/:network/:walletAddress/swaps
: Fetch the decoded transaction history of a wallet, enriched with category tags, labels, logos, and more./account/:network/:address/balance
: Query the native balance of any wallet.
…and more!
Let’s look at a script for fetching a wallet’s decoded transaction history to highlight the accessibility of this tool. Here’s what it can look like:
import fetch from 'node-fetch'; const options = { method: 'GET', headers: { accept: 'application/json', 'X-API-Key': 'YOUR_API_KEY' }, }; fetch('https://solana-gateway.moralis.io/account/mainnet/6Hf1CYNfDAbpKdiz8N9RAFMoZfqinGVytJX7hD1zHg7v/swaps', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err));
Running this script returns the wallet’s transaction history – complete with tags, prices, logos, and other insights – all in a structured, developer-friendly format. Here’s a sample response:
{ //... "result": [ { "transactionHash": "2r68SAigABrGPqSWT4zYmejF1U9dXcg3MfjgddmwJfVWNGnmgL5ReWT8EK3x1sGzKY2CNJPRRQn1tcYaK5oZ55K3", "transactionType": "sell", "transactionIndex": 181, "subCategory": "sellAll", "blockTimestamp": "2025-01-19T12:06:58.000Z", "blockNumber": 314997910, "walletAddress": "6Hf1CYNfDAbpKdiz8N9RAFMoZfqinGVytJX7hD1zHg7v", "pairAddress": "HpUwsJeYV7rwWkQDsfoKqT6UDXfpptNVzS1GT9AdDwef", "pairLabel": "COPPER/SOL", "exchangeAddress": "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8", "exchangeName": "Raydium AMM v4", "exchangeLogo": "https://entities-logos.s3.amazonaws.com/raydium.png", "baseToken": "HB95N5gb6WgQ25psSBt44cAuMNM3ghiZPcGeBnSApump", "quoteToken": "So11111111111111111111111111111111111111112", "bought": { "address": "So11111111111111111111111111111111111111112", "name": "Wrapped SOL", "symbol": "SOL", "logo": "https://logo.moralis.io/solana-mainnet_So11111111111111111111111111111111111111112_5ffe40a76ba4f2a8.webp", "amount": "0.007613989", "usdPrice": 283.794632352, "usdAmount": 2.160809208987172, "tokenType": "token0" }, "sold": { "address": "HB95N5gb6WgQ25psSBt44cAuMNM3ghiZPcGeBnSApump", "name": "COPPER CAT", "symbol": "COPPER", "logo": "https://logo.moralis.io/solana-mainnet_HB95N5gb6WgQ25psSBt44cAuMNM3ghiZPcGeBnSApump_0dbb3c004f45adfbf38e8970d606f9c3.webp", "amount": "348802.272818000", "usdPrice": 0.000006194, "usdAmount": 2.160481277834692, "tokenType": "token1" }, "baseQuotePrice": "2.1825641833554394e-8", "totalValueUsd": 2.160809208 }, //... ] }
To learn more about this tool, please explore the Solana Wallet API documentation page.
NFT API: Get NFT Balances, Up-To-Date Metadata, & Image Previews
The NFT API is your go-to tool for fetching NFT data. Get NFT balances, detailed metadata, image previews, collection insights, and much more without breaking a sweat. Utilize the NFT API to develop a range of applications, from NFT marketplaces to comprehensive portfolio trackers and other similar dapps.

Here are the endpoints of the NFT API:
/account/:network/:address/nft
: Fetch an array of all NFTs owned by a wallet./nft/:network/:address/metadata
: Get complete metadata for any NFT, including image previews, collection insights, attributes, traits, and much more.
To highlight the accessibility of the NFT API, we’ll now show you how easy it is to get the metadata of any NFT. Here’s a sample script:
import fetch from 'node-fetch'; const options = { method: 'GET', headers: { accept: 'application/json', 'X-API-Key': 'YOUR_API_KEY' }, }; fetch('https://solana-gateway.moralis.io/nft/mainnet/FVzM6rUA1SigPxh6e3iQ8dAPjQNf2guap3Xcdj8Q6R2H/metadata', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err));
Calling the endpoint above returns the NFT’s metadata, including a name, description, attributes, traits, Metaplex data, and much more. Here’s what it can look like:
{ "address": "FVzM6rUA1SigPxh6e3iQ8dAPjQNf2guap3Xcdj8Q6R2H", "mint": "FVzM6rUA1SigPxh6e3iQ8dAPjQNf2guap3Xcdj8Q6R2H", "standard": "metaplex", "name": "Mad Lads #7256", "symbol": "MAD", "description": "Fock it.", "imageOriginalUrl": "https://madlads.s3.us-west-2.amazonaws.com/images/7256.png", "externalUrl": "https://madlads.com", "metadataOriginalUrl": "https://madlads.s3.us-west-2.amazonaws.com/json/7256.json", "totalSupply": "1", "metaplex": { "metadataUri": "https://madlads.s3.us-west-2.amazonaws.com/json/7256.json", "updateAuthority": "2RtGg6fsFiiF1EQzHqbd66AhW7R5bWeQGpTbv2UMkCdW", "sellerFeeBasisPoints": 420, "primarySaleHappened": 1, "isMutable": true, "masterEdition": false }, "attributes": [ { "traitType": "Gender", "value": "Male" }, { "traitType": "Type", "value": "Dark" }, //... ], "contract": { "type": "non-fungible-programmable", "name": "Mad Lads", "symbol": "MAD" }, "collection": { "collectionAddress": "J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w", "name": "Mad Lads", "description": "Fock it.", "imageOriginalUrl": "https://madlads.s3.us-west-2.amazonaws.com/images/7256.png", "externalUrl": "https://madlads.com", "metaplexMint": "J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w", "sellerFeeBasisPoints": 500 }, "firstCreated": { "mintTimestamp": 1682119190, "mintBlockNumber": 189744752, "mintTransaction": "2yZw1LEKuFydmg6bQd3jWoeZGYytyrmC1dBkdhco8kbkmtBi2FiuW1TfBvToRqougfcogrqQvD5c2Kk25auw4wXA" }, "creators": [ { "address": "5XvhfmRjwXkGp3jHGmaKpqeerNYjkuZZBYLVQYdeVcRv", "share": 0, "verified": true }, { "address": "2RtGg6fsFiiF1EQzHqbd66AhW7R5bWeQGpTbv2UMkCdW", "share": 100, "verified": true } ], "properties": { "files": [ { "id": "portrait", "uri": "https://madlads.s3.us-west-2.amazonaws.com/images/7256.png", "type": "image/png" }, { "id": "rug", "uri": "https://arweave.net/qJ5B6fx5hEt4P7XbicbJQRyTcbyLaV-OQNA1KjzdqOQ/7256.png", "type": "image/png" } ], "category": "image", "collection": { "name": "Mad Lads", "family": "MAD" }, "creators": [ { "address": "2RtGg6fsFiiF1EQzHqbd66AhW7R5bWeQGpTbv2UMkCdW", "share": 100 } ] }, "media": { "status": "success", "mimetype": "image/png", "originalMediaUrl": "https://madlads.s3.us-west-2.amazonaws.com/images/7256.png", "updatedAt": "2025-05-22T07:22:59.666Z", "mediaCollection": { "low": { "height": 100, "width": 80, "url": "https://nft-preview-media.s3.us-east-1.amazonaws.com/solana/mainnet/FVzM6rUA1SigPxh6e3iQ8dAPjQNf2guap3Xcdj8Q6R2H/0x831a9883966f1fa6f03b0405cfc6f7523d66273e6a7b594de41ddb90688d7dd0/low.png" }, "medium": { "height": 250, "width": 200, "url": "https://nft-preview-media.s3.us-east-1.amazonaws.com/solana/mainnet/FVzM6rUA1SigPxh6e3iQ8dAPjQNf2guap3Xcdj8Q6R2H/0x831a9883966f1fa6f03b0405cfc6f7523d66273e6a7b594de41ddb90688d7dd0/medium.png" }, "high": { "height": 500, "width": 400, "url": "https://nft-preview-media.s3.us-east-1.amazonaws.com/solana/mainnet/FVzM6rUA1SigPxh6e3iQ8dAPjQNf2guap3Xcdj8Q6R2H/0x831a9883966f1fa6f03b0405cfc6f7523d66273e6a7b594de41ddb90688d7dd0/high.png" } } }, "possibleSpam": false }
Explore the Solana NFT API documentation to learn more about this world-class interface.
What Can You Build on the Solana Mainnet & Devnet?
Moralis’ Solana API empowers you to build a wide range of dapps and advanced features. Here are three prominent use cases:
- Transaction Table: With just one call to the
/token/:network/:tokenAddress/swaps
endpoint, you can build an advanced transaction table for tokens, complete with category tags, USD values, real-time prices, logos, and much more. Here’s an example of what it can look like:

- Interactive Price Chart: When using the
/token/:network/pairs/:pairAddress/ohlcv
endpoint, you only need one request to fetch open, high, low, and close prices, along with volume and swap data, for any token on the Solana blockchain. As such, with this endpoint, you can effortlessly power interactive candlestick charts, providing your users with insight into both real-time and historical prices. Here’s what the charts can look like:

- Token Search: The
/api/v2.2/tokens/search
endpoint lets you find any token by name, symbol, address, or pair address, making it the ultimate tool for implementing accurate search functionality in your dapps. This endpoint also supports partial matches, features advanced ranking systems, and is cross-chain compatible, making it easy for your users to find precisely what they’re looking for. Here’s an example of what it can look like:

Transaction table, interactive price charts, and token search functionality are only three prominent examples of what you can build with our APIs. When working with Moralis, you gain access to the data to power almost any crypto-related feature.
Crypto Widgets: Integrate Charts & Token Pages with Ease
In addition to building charts and powerful features from scratch using the data provided by Moralis, you might also want to check out our crypto widgets. With the crypto widgets, you can easily embed price charts and complete token pages into your dapps at the click of a few buttons. And the best part? It’s completely free!
At the time of writing, we currently offer two widgets:
- Price Chart Widget: Add an interactive chart to your platform, giving users insight into real-time and historical prices. Also, the widget allows you to include a holders chart, showing the development of a token’s holder count over time. Here’s what it looks like:

- Token Page Widget: Supercharge your dapp with a full Moralis token page, featuring live prices, holder insights, a real-time transaction table, and much more. Here’s an example of what it can look like:

To learn more about this, please check out Moralis’ Crypto Widgets page!
Summary: Solana Devnet – How to Build Dapps on Solana
If you’re looking to build dapps on the Solana mainnet or devnet, you should definitely check out Moralis for Developers. Moralis is a leading crypto data provider that features top-tier RPC nodes and world-class APIs designed to make your life as a developer easy!

In Moralis’ Solana API suite, you’ll find a bunch of use-case-specific interfaces that help you effortlessly fetch and integrate on-chain data. Here are three prominent examples:
- Token API: Fetch real-time prices, holders, snipers, OHLCV data, pairs, analytics, stats, and other valuable insights.
- Wallet API: Get any wallet’s portfolio data, decoded history, and native balance.
- NFT API: Query NFT balances, rich metadata, media items, collection insights, etc.
With the tools mentioned above, you can build everything from detailed portfolio views to interactive candlestick charts using only a single endpoint!
So, if you’re looking for the best and easiest way to build dapps on the Solana mainnet and devnet, be sure to sign up for a free Moralis account today!
Also, if you’d like to learn more about what makes Moralis the top data provider in Web3, explore some of our comparison pages. For example, see how our APIs stack up against the DeBank API or the CoinGecko API.