Multichain NFT API – How to Build Cross-Chain NFT Dapps

Table of Contents

To build cross-chain NFT dapps, using a multichain NFT API is imperative to the success of a project. As the title suggests, we will dedicate this article to the leading cross-chain API for non-fungible tokens, Moralis’ multichain NFT API. In turn, you’ll notice how the API from Moralis makes the development of dapps straightforward. Furthermore, with the API, you can enjoy the following features:

  • Enterprise-grade performance, accuracy, and multichain NFT support.
  • Development time savings – up to 80%!
  • Support for several token standards.
  • Automatically resolves metadata.
  • Compatibility for several game engines.

Moreover, as the “multichain” and “cross-chain” terms suggest, this API allows you to develop NFT dapps on different networks. Also, with this multichain NFT API, you can cross over to other supported chains anytime. 

To get started with the best cross-chain API, all you need is your Moralis Web3 API key. Fortunately, you get to obtain that key right after you create your free Moralis account. Of course, we’ll show you how to do that further down in this article. However, we need to start today’s topic with some basics and ensure you’re all up to speed. Therefore, before we start working with Moralis’ multichain NFT API, let’s look at what an NFT API is.  

To become a more efficient Web3 developer, join Moralis Magazine.

What is an NFT API?

One of the best and simplest ways to explain what something actually entails includes breaking things down. Accordingly, we need to look at the “NFT” and “API” terms separately. So, let’s start with API, which is short for “application programming interface”. The latter is any sort of interface that enables software to interact with other pieces of software. Further, an API achieves different sets of instructions that are transferred or translated for mutual understanding. Hence, it’s pretty obvious that APIs play a significant role in ensuring consistent coding in a stable environment. After all, proper APIs enable developers to deliver all replicable functions with predictability on every request. 

A browser tab showing the mechanics of an API.

On the other hand, “NFT” stands for “non-fungible token” – a special crypto asset. Their uniqueness makes NFTs incredible (as the word “non-fungible” suggests), and this property offers a wide range of applications. Digital art, collectibles, decentralized gaming, online ticketing, and membership authentication, just to name a few. Furthermore, NFTs already play an important part in implementing the “play-to-earn” (P2E) concept. Moreover, some NFTs have already found their purpose in certification issuing and ownership proofing. As such, we can expect a lot from NFTs’ utility in the future. Hence, devs must learn to utilize these types of tokens. This is where a proper multichain NFT API makes things extremely straightforward.

Metadata showing "NFT" in digital letters.

Now that you know what an API is and what NFTs are, we can put them together. In short, an NFT API is an API that focuses on dealing with non-fungible tokens. Furthermore, a quality NFT API simplifies the backend data acquisition related to these tokens. Please note that there are various API options available; however, there’s only one ultimate multichain NFT API – Moralis’ NFT API. 

Billboard announcing Moralis' multichain NFT API.

Introducing the Best Enterprise-Grade Multichain NFT API

The Moralis cross-chain NFT API is an indexed API that is easily manageable and easy to use. Most other API options require the use of multiple requests. In turn, you need to deal with multiple lines of code. On the other hand, the ultimate multichain NFT API provides you with single lines of code. Moreover, simply copy and paste short snippets of code to cover all the heavy lifting on the backend. 

Essentially, with this cross-chain NFT API, you can effortlessly obtain the on-chain data related to a particular NFT. Hence, you get to build all sorts of decentralized applications (dapps) that incorporate NFTs. Some common NFT dapps include NFT wallets, NFT trackers, NFT marketplaces, and NFT games. And, with an enterprise-grade multichain NFT API, you can build any of these dapps without breaking a sweat. 

Before we move forward and take a closer look at Moralis’ API, let’s look at the main reasons why you might want to use this excellent tool. We looked at them briefly earlier; however, here are the key points why developers love this API:

  • High performance, accuracy, and cross-chain support.
  • Saves up to 80% of development time.
  • Provides support for both ERC NFT standards (ERC-721 and ERC-1155) and for non-standard NFTs.
  • Resolves metadata automatically.
  • Fully compatible with game engines such as Unity and Unreal.
Graph illustrating how the leading multichain NFT API works by crossing NFT metadata across blockchain networks.

Cross-Chain API for NFTs – How Does it Work?

In order to understand how Moralis’ multichain NFT API works, let’s look at how getting NFT data without it goes. So, for starters, without Moralis’ API, you would need to parse individual smart contracts. You would then need to sort through all the irregular data sets. Along the way, you must perform a lot of cleansing and stitching. Furthermore, you need to make more than ten calls just to get the required NFT metadata. Not to mention, you need to query nodes for metadata. If you have any experience with any of the above actions, you know it’s quite overwhelming. 

On the other hand, getting non-fungible token data with Moralis’ cross-chain NFT API boils down to one call. Yes, a single call retrieves NFT information across any supported blockchain. You just pick an NFT API endpoint that suits your needs and make a call. As such, the NFT metadata, NFT transfer data, and NFT ownership data become available. Then, you get to incorporate the fetched NFT data in your dapps in any way you desire. For instance, you can gate certain parts of your website or the entire content using NFT API endpoints. 

So, the general workflow would follow these steps:

  1. Decide which development platform and tools you want to work with.
  2. Install the Moralis SDK.
  3. Obtain your Moralis Web3 API key and add it to your code.
  4. Start making NFT API endpoint calls that correspond to your needs.
  5. Incorporate fetched on-chain data into your decentralized applications.

Features of Moralis’ Non-Fungible Token API for Blockchain Networks

As explained above, the best multichain NFT API provides you with more than fifteen endpoints that cover all sorts of features. Moreover, the names of these endpoints are self-explanatory. Hence, you know which one to use without studying all of them in detail.

Here are the available endpoints for the API:

  • getNFTTransfersByBlock
  • getWalletNFTs
  • getWalletNFTTransfers
  • getWalletNFTCollections
  • getNFTTrades
  • getNFTLowestPrice
  • searchNFTs
  • getNFTTransfersFromToBlock
  • getContractNFTs
  • getNFTContractTransfers
  • getNFTOwners
  • getNFTContractMetadata
  • reSyncMetadata
  • syncNFTContract
  • getNFTMetadata
  • getNFTTokenIdOwners
  • getNFTTransfers

Let’s also point out that you can use all of the above features on any of the supported chains. All the details for each of the above await you in the Moralis documentation. However, to assist you further, let us take a closer look at one of the most popular multichain NFT API endpoints. In turn, it will help you better find your way around the docs for other Moralis APIs. 

Exploring the “getNFTMetadata” Endpoint

Looking at the screenshot below, you can see the details of the “getNFTMetadata” endpoint page:

The "getNFTMetadata" endpoint with a code example from Moralis' API for NFTs.

On the left side of the image above, you can see all the NFT API endpoints. In the center, you can enter the required parameters to try the endpoint. Of course, you need to select the language you want to focus on (top-right corner). Then, you can hit “Try It!” to see the results. 

Furthermore, by looking at the above screenshot again, you can see that for the sake of this tutorial, we are focusing on NodeJS. If you were to go with this option, you’d need to use Moralis’ JS SDK. Moreover, we’ll focus on a random NFT collection. As such, we go to Etherscan and select the “ERC-1155 Top Tokens” option:  

Next, we select one of the NFT projects there (“Fantasy SoulMate Limited” from “Hey Bear Club”). By selecting that token, we access its Etherscan page, where we can copy its contract’s address:

Then, we return to the “getNFTMetadata” page and paste the above-copied address in the designated entry field:

Illustration of entering a wallet address into the endpoint to utilize Moralis' multichain NFT API.


Next, we need to enter a token ID. Hence, we go back to Etherscan and scroll down the token’s page to view our options. Essentially, anything between “1” and “100” will work:

Since we like the number 20, let’s use it as the token ID. Finally, we can hit the “Try It!” button:

Response code from the endpoint.


If we now focus on the response section, we see all the pieces of information that this multichain NFT API endpoint provides.

The “getNFTMetadata” API Endpoint Response

The response for our example provides us with the token address and the token ID at the top (our entry values). Further down the “response” box, you can find many other details, including the example token’s URI:

Code showcasing "token_uri" from using the cross-chain NFT API endpoint.



As such, we can simply copy that URI and paste it into our browser to see the NFT’s metadata:

We marked the example token’s image IPFS address in the above screenshot. We can copy that address, tweak it to match the HTTPS format, and use it in our browser:

A web browser showing the fetched token when successfully using the multichain NFT API.

For the sake of this demonstration, we manually worked with the example token’s metadata (URI and image URL). However, you could write some basic code that would do that automatically. As a result, you’d quite effortlessly display NFTs in your dapp. Moreover, we focused on an NFT collection on the Ethereum chain; however, we could easily use the same endpoint for any other supported chain.

How to Easily Integrate a Multichain NFT API

To easily integrate a multichain NFT API, follow along in this section as we look at an essential component for this task: obtaining your Moralis Web3 API key. In the end, you’ll be able to get metadata for NFTs on numerous chains. The exact steps to integrate the API vary depending on the programming language. Hence, make sure to use Moralis’ docs. However, you’ll need to obtain your Moralis Web3 API key in every case. Moreover, to complete that task, you need a Moralis account. So, if you haven’t created your free Moralis account yet, do so now. You can use the “create your free Moralis account” link in the introduction or the “Start for Free” button on the Moralis homepage:

To start using the multichain NFT API, users must click on the "Start for Free" button on Moralis' homepage.

After creating your account, you’ll be able to access your admin area. From there, you’ll be able to copy your API key in two simple steps: 

Process shown to get the API key: log in to Moralis, click on "Web3 APIs", and copy "Your API Key".

With your API key copied, you must return to your code. For example, if you decide to take on our tutorials, you will often use a “.env” file. Inside that file, you must paste your API key next to the “MORALIS_API_KEY” variable:

Code editor showing the line of code where user must enter their API key to use the multichain NFT API.

With your Web3 API key in place, you can start implementing the multichain NFT API endpoints listed above.

Multichain NFT API – How to Build Cross-Chain NFT Dapps – Summary

In this article, we first ensured that you understood what an NFT API is and learned what NFTs and APIs are. Next, we introduced the Moralis multichain NFT API, where you found out the main reasons why devs use this API. Among several advantages, this cross-chain NFT API enables you to save up to 80% of development time. Furthermore, we looked at the API’s endpoints and took a closer look at “getNFTMetadata“. Last but not least, we also showed you how to obtain your Moralis Web3 API key, which is your gateway to using the ultimate multichain NFT API.

If you want to dive deeper into NFT development, we recommend completing the “NFT Use Cases” tutorials that await you in the Moralis documentation. However, you might be interested in exploring other blockchain development topics. In that case, head over to the Moralis YouTube channel or the Moralis blog. Both of these outlets offer a ton of valuable content. For instance, some of the latest topics teach you how to connect MetaMask to website with NextJS, how to connect to PlayFab with Web3 using Azure Functions, how to clone Zapper, how to connect a dapp to Polygon, how to set up and connect a dapp to the Ethereum network, and much more.   

Of course, you can also take a more professional approach to your crypto education by enrolling in Moralis Academy. There, you can complete a wide range of top-tier courses. For instance, you can even learn how to create your metaverse. By becoming blockchain certified, you’ll be one step closer to going full-time crypto. 

October 11, 2022
Join the Moralis Community
Get the latest Moralis Web3 news and updates via email.
Search
Generic filters
MOralis launched
Streams API
Real-Time blockchain data delivered to your backend via webhooks. Used by the biggest dapps.
Real-Time blockchain data delivered to your backend via webhooks. Used by the biggest dapps.
Follow us on Twitter
Real-Time blockchain data delivered to your backend via webhooks. Used by the biggest dapps.
Related Articles