Altszn.com
  • Home
  • Crypto
    • Altcoins
    • Bitcoin
    • Ethereum
    • Monero
    • XRP
    • Zcash
  • Web3
  • DeFi
  • NFTs
No Result
View All Result
Altszn.com
  • Home
  • Crypto
    • Altcoins
    • Bitcoin
    • Ethereum
    • Monero
    • XRP
    • Zcash
  • Web3
  • DeFi
  • NFTs
No Result
View All Result
Altszn.com
No Result
View All Result

Build on Solana and EVM

Altszn.com by Altszn.com
November 1, 2023
in Web3
0
Build on Solana and EVM
399
SHARES
2.3k
VIEWS
Share on FacebookShare on Twitter


Build on Solana and EVM - Solana & EVM Compatible APIs

With the rapid expansion of the Web3 industry, we have seen numerous blockchain networks emerge to address the growing demand for decentralized applications (dapps). And the fragmented ecosystem of multiple blockchains has highlighted the need for interoperability. Consequently, Web3 developers should be able to build cross-chain compatible dapps โ€“ on networks like Solana and all major EVM chains โ€“ to reach the largest possible audience. Although most developers might choose to launch on a specific network, any forward-looking Web3 project should be built with cross-chain compatible APIs, enabling future expansion to other networks. So, what APIs should these developers use? For the answer to this question, join us in this article as we show you the easiest way to build on Solana and EVM!

Overview 

In todayโ€™s article, weโ€™ll start by introducing you to Moralis and explain how you can use our tools to build on both Solana and all major EVM chains. From there, weโ€™ll dive deeper into our cross-chain compatible APIs to highlight the capabilities of these industry-leading tools. Lastly, to top things off, weโ€™ll cover two brief examples of how you can get the NFT balance of any address on both Solana and all EVM chains. 

Moralis Solana and EVM APIs

Also, did you know that you can access all our APIs free of charge? All you have to do is sign up with Moralis, and youโ€™ll immediately be able to leverage the full power of blockchain technology! 

Nevertheless, without further ado, letโ€™s jump right into it and explore the easiest way to build on Solana and EVM! 

How to Build on Solana and EVM

The most accessible way to build on Solana and EVM chains is to leverage Moralisโ€™ cross-chain compatible APIs. Moralis provides a comprehensive suite of enterprise-grade APIs, making Web3 development as seamless as Web2. As such, when working with Moralis, it has never been easier to build cross-chain compatible decentralized applications (dapps)! 

Among the supported networks, youโ€™ll find Solana and ten+ EVM chains, including Ethereum, Polygon, BNB Smart Chain (BSC), Optimism, and many others! 

Highlighting blockchain networks compatible with Moralis APIs, including Solana and EVM

Furthermore, not only do the cross-chain compatible APIs from Moralis allow you to build on both Solana and multiple EVM networks, but they are also the best in the business. As such, when it comes to response times, scalability, reliability, and features, Moralis APIs clearly stand out as industry leaders!

Case Study Showing How Moralis Solana and EVM APIs are the fastest ones available - Competition comparison chart

Build on Solana

With Moralisโ€™ Solana-compatible APIs, you can effortlessly bring projects to market faster and more efficiently. The APIs index any blockchain data you need for Solana development, including data for NFTs, fungible tokens, wallets, and more! 

UI of Moralis Solana API

Querying blockchain data has never been easier, and with only single lines of code, you can accomplish the following: 

  • Get NFT metadata
  • Fetch wallet portfolios
  • Query token balances by wallet
  • Monitor wallet activity
  • Get SPL token prices
  • And more!

Moralisโ€™ Solana-compatible APIs support the Solana mainnet and testnet, ensuring you can leverage our comprehensive suite of tools for both testing and developing production-ready dapps! 

If you immediately want to build on Solana and explore all available endpoints, check out our official Solana Web3 data API documentation page. 

Build on EVM 

With Moralisโ€™ EVM-compatible APIs, you can seamlessly build dapps faster and more efficiently across ten+ blockchain networks. In fact, when working with our suite of industry-leading interfaces, you can save a whopping 83% of the average Web3 go-to-market time, enabling you to prototype, deploy, and launch your Web3 projects before everyone else! 

EVM components illustrated in art image

Whatโ€™s more, by using Moralis APIs, youโ€™ll be leveraging the same easy-to-use tech that already powers some of the most significant projects in Web3, including MetaMask, Delta, NFTrade, 1inch, and many others. 

So, what can you do with our EVM-compatible APIs? 

With only single lines of code, you can do the following: 

  • Query token prices
  • Stream real-time blockchain data
  • Get user tokens
  • Monitor NFT collection prices
  • Fetch NFT metadata
  • And much more!

If you want to get right into it and explore all available EVM endpoints, check out our official EVM Web3 data API documentation page.

Nevertheless, that covers the basics of how you can build on Solana and EVM networks with Moralis. Letโ€™s now dive a bit deeper and look closer at some of Moralisโ€™ cross-chain compatible APIs!

Solana and EVM Compatible APIs 

Moralis offers a range of cross-chain compatible APIs, making it the ultimate one-stop shop for anyone looking to build on both Solana and EVM chains. In this section, weโ€™ll explore three prominent examples: 

  1. NFT API
  2. Token API
  3. Wallet API

Nevertheless, without further delay, letโ€™s start by diving into the NFT API!

NFT API 

The Moralis NFT API is free to use and delivers unmatched performance through lightning-fast CDNs. It supports over three million NFT collections, including everything from established projects like CryptoPunks and Pudgy Penguins to NFTs minted only seconds ago! 

Solana and EVM NFT API art image

So, what can you do with the NFT API? Here are a few examples:

  • Fetch NFT Transfer Data: Fetch historical and real-time transfer data for any NFT, wallet, or address. 
  • Access Enriched Metadata: Access normalized and fully enriched metadata for both collections and individual NFTs. 
  • Get On-Chain Pricing Data: Get and integrate on-chain pricing data into your dapps, including last sale prices and lowest historical prices. 
  • Query Optimized Image Previews: Query and benefit from dynamically sized image previews.  

The NFT API supports Solana and ten+ EVM chains, meaning you can leverage the same tool to build NFT projects across multiple blockchain networks! 

Token API 

With the Moralis Token API, you can effortlessly integrate real-time prices, wallet balances, and transfers into your Web3 projects. As such, when working with this tool, it has never been so easy to build decentralized exchanges (DEXs), Web3 wallets, portfolio trackers, or any other dapps! 

EVM and Solana Token API art image illustration

So, what are the features of the Token API? Letโ€™s look at a few examples:

  • Get Token Prices: Get any tokenโ€™s current and historical price from popular automated market makers (AMMs) like Uniswap and PancakeSwap. 
  • Track Token Transfers: Track transfers of any token in real time by contract or wallet. You can also fetch historical transfers with ease.
  • Query Token Balances: Query token balances of any address at any given point in time. 
  • Advanced Spam Detection: Experience enhanced security with support for detecting suspicious tokens. 
  • Rich Metadata: Access up-to-date token metadata, including token names, logos, symbols, and much more.

Also, just like the NFT API, the Token API also features cross-chain support. Consequently, when using Moralisโ€™ Token API, you can build projects compatible with Solana and all major EVM blockchains! 

Wallet API

The Moralis Wallet API boasts an array of powerful features, unparalleled scalability, and exceptional flexibility, making it the ultimate tool for integrating wallet functionality into dapps. The Wallet API supports over 500 million addresses across all major blockchains, including Solana, Ethereum, Polygon, and many other EVM-compatible networks! 

Moralis Solana and EVM Compatible APIs for Wallet Development art image

So, what does the Moralis Wallet API do? 

  • Native Balances: Access both historical and current native balances for all wallets.
  • Portfolios: Fetch the entire portfolio of any wallet, including fungible and non-fungible tokens.
  • NFTs: Get all NFTs and collections held by a wallet, along with metadata and images. 
  • Transfers: Get real-time transfers and swaps for both NFTs and fungible tokens. 
  • Labels: All transfer and transaction endpoints support public address labels, allowing you to easily decode transactions. 
  • And more!

Thanks to the cross-chain compatibility of the Wallet API, you can use this interface to build on both Solana and all major EVM chains! 

Additional EVM APIs

In addition to the three APIs from the previous section, Moralis also offers numerous other EVM-compatible interfaces. And in this section, weโ€™ll introduce you to a few of them: 

  • Price API: The Price API is the industryโ€™s premier interface for crypto prices. You can pick any metric โ€“ whether you want to judge by speed, features, or pricing โ€“ this API comes out on top compared to any competitor. 
  • Blockchain API: The Blockchain API is the industryโ€™s most precise and scalable interface for raw and decoded blockchain data. With single lines of code, you can seamlessly query block data, transactions, internal transactions, logs, and more. 
  • Streams API: With the Streams API, you can effortlessly set up streams to receive instant, customizable notifications whenever something important happens on-chain. This allows you to seamlessly monitor any userโ€™s real-time transfers, notify your dapp users about important events, and much more.
  • Market Data API: With the Market Data API, you can unlock the power of Web3 market data and seamlessly integrate this into your dapps. Query trending NFT collection, NFT drops, top ERC-20 tokens, and much more with only single lines of code. 
Highlighting all of Moralis' Solana and EVM compatible APIs

The APIs above are only a few examples. So, if you want to explore all of them, check out our Web3 API page! 

Tutorial: How to Build with Solana and EVM with Cross-Chain Compatible APIs

In this section, weโ€™ll show you a couple of examples of how you can use our cross-chain compatible APIs to build with Moralis on both Solana and EVM blockchains. And in this case, weโ€™ll be using the NFT API to illustrate the power of Moralis. More specifically, weโ€™ll show you how to get the NFT balance of any address! 

However, before continuing, you must deal with a few essential prerequisites! 

Prerequisites

In this tutorial, weโ€™ll be using JavaScript to get the NFT balance of any address. As such, before you continue, make sure you have the following ready: 

Furthermore, open your preferred integrated development environment (IDE) and set up a new project. From there, launch a new terminal, cd into the projectโ€™s root folder and run the command below to install the Moralis SDK: 

npm install moralis @moralisweb3/common-sol-utils
npm install moralis @moralisweb3/common-evm-utils

Lastly, you also need a Moralis API key. As such, if you havenโ€™t already, sign up with Moralis by clicking on the โ€Start for Freeโ€ button at the top right of Moralisโ€™ homepage: 

Build on Solana and EVM - Get started for free using Moralis start for free button

Next, go to the โ€Settingsโ€ tab, scroll down to the โ€API Keysโ€ section, and copy your key: 

Showing API key page and illustration how to copy the API key

Keep it for now, as you need it in the coming two sections! 

Nevertheless, that covers the prerequisites. In the following sections, weโ€™ll give two examples of how you can get the NFT balance of an address on both Solana and EVM chains! 

Solana Example: Get NFT Balance of an Address

Create a new โ€index.jsโ€ file in your project root folder and add the following code: 

const Moralis = require("moralis").default; const { SolNetwork } = require("@moralisweb3/common-sol-utils");  const runApp = async () => {   await Moralis.start({     apiKey: "YOUR_API_KEY",     // ...and any other configuration   });    const address = "BWeBmN8zYDXgx2tnGj72cA533GZEWAVeqR9Eu29txaen";    const network = SolNetwork.MAINNET;    const response = await Moralis.SolApi.account.getNFTs({     address,     network,   });    console.log(response.toJSON()); };  runApp();

Next, replace YOUR_API_KEY with the key you copied in the previous section: 

Solana and EVM API code - Replacing the API key

From there, configure the address const by adding the address from which you want to query the NFT balance: 

Changing the address parameter to query the NFT balance using the Solana and EVM API

We then pass along address and chain as parameters when calling the getNFTs() endpoint: 

Passing the address and chain parameter for the API call

Thatโ€™s it for the code; you can now execute the script by running the terminal command below in the projectโ€™s root folder: 

node index.js

In return, youโ€™ll get an array of all NFTs held by the address you specified. It will look something like this: 

[   {     "associatedTokenAddress": "B7gJmenw3xpQqq82UNHim2cFPqo5p21WY9YLf4XgVNkw",     "mint": "6RPYwFcfmkzMucAGz6FrBRvDX5sK4FBqDye3iZDCw5Q",     "name": "DegodsGiveaway #639",     "symbol": "DG"   } ]

Congratulations! You now know how to use Moralisโ€™ NFT API to get the balance of an address on Solana! If you want to learn more about this, check out the get SPL NFT balance of address documentation page! 

EVM Example: Get NFT Balance of an Address

Set up a new โ€index.jsโ€ file in your projectโ€™s root folder and add the following code: 

const Moralis = require("moralis").default; const { EvmChain } = require("@moralisweb3/common-evm-utils");  const runApp = async () => {   await Moralis.start({     apiKey: "YOUR_API_KEY",     // ...and any other configuration   });    const address = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";    const chain = EvmChain.ETHEREUM;    const response = await Moralis.EvmApi.nft.getWalletNFTs({     address,     chain,   });    console.log(response.toJSON()); };  runApp();

From here, swap out YOUR_API_KEY with the key you fetched when dealing with the prerequisites: 

Solana and EVM API code example on how to get NFT balance of an address

Next, configure the address and chain constants to fit your query: 

Showing how to change the chain parameter to build on Solana and EVM

We then pass along address and chain as parameters when calling the getWalletNFTs() endpoint: 

getwalletNFTs example when building on Solana and EVM chains

That covers the code; you can now run the script by opening a new terminal and executing the following command in the root folder of the project: 

node index.js

In return for running the script, youโ€™ll get a response containing an array of all NFTs held by the address in question. Hereโ€™s an example of what it might look like: 

{   "total": 1456,   "page": 1,   "page_size": 100,   "cursor": "eyJhbGciOiJIUzI1NiIs//...",   "result": [     {       "token_address": "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85",       "token_id": "4765809967066625256798886812262830659450023020194524584471225959000376492819",       "amount": "1",       "owner_of": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",       "token_hash": "ba6d44b5f16be94283cecffeb784b7ca",       "block_number_minted": "15572796",       "block_number": "15573017",       "contract_type": "ERC721",       "name": "Ethereum Name Service",       "symbol": "ENS",       "token_uri": null,       "metadata": null,       "last_token_uri_sync": null,       "last_metadata_sync": "2022-09-20T06:06:08.153Z",       "minter_address": null     },   ],   "status": "SYNCED" }

Thatโ€™s it! You now know how to use the NFT API to get the balance of an address on an EVM network! If you want to learn more about this, explore the get NFTs owned by address documentation page! 

Summary: Build with Solana and EVM Compatible APIs

In todayโ€™s article, we introduced you to Moralisโ€™ cross-chain compatible APIs โ€“ the ultimate tools allowing you to build on both Solana and EVM. In doing so, we primarily dove into the following three examples: 

  • NFT API
  • Token API
  • Wallet API

We also demonstrated the accessibility of our APIs by showing you two examples of how you can get the NFT balance of any address on both Solana and all EVM chains. As such, if you have followed along this far, you know the basics of building cross-chain compatible dapps! 

If you liked this guide, consider checking out some more content here on the Web3 blog. For instance, read about meta transactions or explore our complete blockchain API tutorial. 

Also, donโ€™t forget to sign up with Moralis if you want access to all our cross-chain compatible APIs. You can create an account for free, and youโ€™ll be able to immediately start leveraging the full power of blockchain technology! 



Read More: moralis.io

Tags: BuildEVMSolanaweb 3.0Web3
ADVERTISEMENT

Recent

Polygon co-founder steps down, says he can no longer give his best

Polygon co-founder steps down, says he can no longer give his best

May 24, 2025
Crypto, NFTs are a lifeboat in the sinking fiat system: Finance Redefined

Crypto, NFTs are a lifeboat in the sinking fiat system: Finance Redefined

May 23, 2025
'Major Wake-Up Call': How $400M Coinbase Breach Exposes Crypto's Dark Side

'Major Wake-Up Call': How $400M Coinbase Breach Exposes Crypto's Dark Side

May 23, 2025

Categories

  • Bitcoin (4,655)
  • Blockchain (11,042)
  • Crypto (8,978)
  • Dark Web (487)
  • DeFi (8,217)
  • Ethereum (4,698)
  • Metaverse (7,107)
  • Monero (265)
  • NFT (1,255)
  • Solana (4,963)
  • Web3 (20,190)
  • Zcash (475)

Category

Select Category

    Advertise

    Advertise your site, company or product to millions of web3, NFT and cryptocurrency enthusiasts. Learn more

    Useful Links

    Advertise
    DMCA
    Contact Us
    Privacy Policy
    Shipping & Returns
    Terms of Use

    Resources

    Exchanges
    Changelly
    Web3 Jobs

    Recent News

    Polygon co-founder steps down, says he can no longer give his best

    Polygon co-founder steps down, says he can no longer give his best

    May 24, 2025
    Crypto, NFTs are a lifeboat in the sinking fiat system: Finance Redefined

    Crypto, NFTs are a lifeboat in the sinking fiat system: Finance Redefined

    May 23, 2025

    ยฉ 2022 Altszn.com. All Rights Reserved.

    No Result
    View All Result
    • Home
      • Home โ€“ Layout 1
      • Home โ€“ Layout 2
      • Home โ€“ Layout 3

    ยฉ Altszn.com. All Rights Reserved.

    • bitcoinBitcoin (BTC) $ 107,968.00
    • ethereumEthereum (ETH) $ 2,533.76
    • tetherTether (USDT) $ 1.00
    • xrpXRP (XRP) $ 2.33
    • bnbBNB (BNB) $ 667.34
    • solanaSolana (SOL) $ 176.18
    • usd-coinUSDC (USDC) $ 0.999799
    • dogecoinDogecoin (DOGE) $ 0.225499
    • cardanoCardano (ADA) $ 0.747608
    • tronTRON (TRX) $ 0.270489
    • staked-etherLido Staked Ether (STETH) $ 2,532.80
    • wrapped-bitcoinWrapped Bitcoin (WBTC) $ 107,754.00
    • suiSui (SUI) $ 3.65
    • hyperliquidHyperliquid (HYPE) $ 34.99
    • wrapped-stethWrapped stETH (WSTETH) $ 3,051.67
    • chainlinkChainlink (LINK) $ 15.36
    • avalanche-2Avalanche (AVAX) $ 23.03
    • stellarStellar (XLM) $ 0.286086
    • shiba-inuShiba Inu (SHIB) $ 0.000014
    • bitcoin-cashBitcoin Cash (BCH) $ 421.83
    • leo-tokenLEO Token (LEO) $ 8.81
    • hedera-hashgraphHedera (HBAR) $ 0.188555
    • the-open-networkToncoin (TON) $ 3.04
    • moneroMonero (XMR) $ 402.82
    • litecoinLitecoin (LTC) $ 95.86
    • wethWETH (WETH) $ 2,537.89
    • polkadotPolkadot (DOT) $ 4.54
    • usdsUSDS (USDS) $ 0.999779
    • bitget-tokenBitget Token (BGB) $ 5.59
    • wrapped-eethWrapped eETH (WEETH) $ 2,706.92
    • binance-bridged-usdt-bnb-smart-chainBinance Bridged USDT (BNB Smart Chain) (BSC-USD) $ 1.00
    • pepePepe (PEPE) $ 0.000014
    • pi-networkPi Network (PI) $ 0.782120
    • ethena-usdeEthena USDe (USDE) $ 1.00
    • whitebitWhiteBIT Coin (WBT) $ 31.73
    • coinbase-wrapped-btcCoinbase Wrapped BTC (CBBTC) $ 108,063.00
    • aaveAave (AAVE) $ 262.15
    • bittensorBittensor (TAO) $ 432.08
    • daiDai (DAI) $ 0.999923
    • uniswapUniswap (UNI) $ 6.14
    • nearNEAR Protocol (NEAR) $ 2.78
    • aptosAptos (APT) $ 5.33
    • jito-staked-solJito Staked SOL (JITOSOL) $ 211.96
    • okbOKB (OKB) $ 52.20
    • ondo-financeOndo (ONDO) $ 0.941996
    • blackrock-usd-institutional-digital-liquidity-fundBlackRock USD Institutional Digital Liquidity Fund (BUIDL) $ 1.00
    • crypto-com-chainCronos (CRO) $ 0.095847
    • kaspaKaspa (KAS) $ 0.108094
    • ethereum-classicEthereum Classic (ETC) $ 18.40
    • internet-computerInternet Computer (ICP) $ 5.22
    • bitcoinBitcoin (BTC) $ 107,968.00
    • ethereumEthereum (ETH) $ 2,533.76
    • tetherTether (USDT) $ 1.00
    • xrpXRP (XRP) $ 2.33
    • bnbBNB (BNB) $ 667.34
    • solanaSolana (SOL) $ 176.18
    • usd-coinUSDC (USDC) $ 0.999799
    • dogecoinDogecoin (DOGE) $ 0.225499
    • cardanoCardano (ADA) $ 0.747608
    • tronTRON (TRX) $ 0.270489
    • staked-etherLido Staked Ether (STETH) $ 2,532.80
    • wrapped-bitcoinWrapped Bitcoin (WBTC) $ 107,754.00
    • suiSui (SUI) $ 3.65
    • hyperliquidHyperliquid (HYPE) $ 34.99
    • wrapped-stethWrapped stETH (WSTETH) $ 3,051.67
    • chainlinkChainlink (LINK) $ 15.36
    • avalanche-2Avalanche (AVAX) $ 23.03
    • stellarStellar (XLM) $ 0.286086
    • shiba-inuShiba Inu (SHIB) $ 0.000014
    • bitcoin-cashBitcoin Cash (BCH) $ 421.83
    • leo-tokenLEO Token (LEO) $ 8.81
    • hedera-hashgraphHedera (HBAR) $ 0.188555
    • the-open-networkToncoin (TON) $ 3.04
    • moneroMonero (XMR) $ 402.82
    • litecoinLitecoin (LTC) $ 95.86
    • wethWETH (WETH) $ 2,537.89
    • polkadotPolkadot (DOT) $ 4.54
    • usdsUSDS (USDS) $ 0.999779
    • bitget-tokenBitget Token (BGB) $ 5.59
    • wrapped-eethWrapped eETH (WEETH) $ 2,706.92
    • binance-bridged-usdt-bnb-smart-chainBinance Bridged USDT (BNB Smart Chain) (BSC-USD) $ 1.00
    • pepePepe (PEPE) $ 0.000014
    • pi-networkPi Network (PI) $ 0.782120
    • ethena-usdeEthena USDe (USDE) $ 1.00
    • whitebitWhiteBIT Coin (WBT) $ 31.73
    • coinbase-wrapped-btcCoinbase Wrapped BTC (CBBTC) $ 108,063.00
    • aaveAave (AAVE) $ 262.15
    • bittensorBittensor (TAO) $ 432.08
    • daiDai (DAI) $ 0.999923
    • uniswapUniswap (UNI) $ 6.14
    • nearNEAR Protocol (NEAR) $ 2.78
    • aptosAptos (APT) $ 5.33
    • jito-staked-solJito Staked SOL (JITOSOL) $ 211.96
    • okbOKB (OKB) $ 52.20
    • ondo-financeOndo (ONDO) $ 0.941996
    • blackrock-usd-institutional-digital-liquidity-fundBlackRock USD Institutional Digital Liquidity Fund (BUIDL) $ 1.00
    • crypto-com-chainCronos (CRO) $ 0.095847
    • kaspaKaspa (KAS) $ 0.108094
    • ethereum-classicEthereum Classic (ETC) $ 18.40
    • internet-computerInternet Computer (ICP) $ 5.22