Creating an NFT App with Coinbase Cloud Node

December 2, 2022

By Gustavo Isturiz

At Coinbase Cloud we’ve launched Node to empower developers to build Web3 applications from a user-friendly platform with blazing fast response times. Our NFT optimized API gives developers and creators instant access to data about collections, user transactions, and tokens across 128K+ collections with 106M+ tokens! Our NFT API offers: indexing across ERC-721 and ERC-1155 tokens, cached images for quick and cost-efficient access, and access to an expansive set of data through a single API.

In this post, we’ll walk through creating an NFT App where we can showcase different collections of NFTs, dig into a particular NFT to see the entire collection, and finally get detailed information about specific tokens.

Here’s what we’ll go through:

  1. Creating a Node project on Coinbase Cloud

  2. Securing your API credentials

  3. Getting information about a group of NFT projects

  4. Getting information about a particular NFT project

  5. Getting information about a particular NFT

Step 1: Create a Free Node Project

First, we’ll head to to sign into our account (if you don’t have one, simply create a free account to sign in.) 

Next, once signed into the Coinbase Cloud platform, click on the upper right hand corner “Create new project” button.

This will navigate you to the setup part of your project, where you can choose your plan, Project Name, and network. Let’s go ahead and choose the “Free Plan” giving us access to up to 120,000 requests per day(an API request, or API call, allows one application to request data or services from another application.) I’ve named my project “Coinbase_Cloud_Demo,” but you can choose any name you’d like. Then, choose the Ethereum network you’d like to work on (either Mainnet or the Goerli Testnet.) Lastly, let’s go ahead and hit “Go to project” to spin up our free Node!

Step 2: Securing Your Credentials

After your project setup is complete, a modal will greet you with your API access token in the form of a “Username” and “Password.” 

It is very important that you copy this information and store it somewhere safe as these will be the credentials to authorize your requests. If compromised, you’ll have to delete the project and begin a new one.

It's important to secure your credentials so they’re not stored in plain text within your repository. We’ll be using Python in this tutorial, so we’re going to use the library “python-dotenv” to allow us to reference the .env file when referencing our stored environment variables.

When working on projects, store them as environment variables (“.env” files for example) and include the environment file name in your “gitignore” file so that they aren’t pushed to your repository.

Step 3: Getting information about a group of NFT Projects

Our Node project is working and we have the API endpoint and keys to begin making calls. First up, let’s get a collection of NFT projects which we can display. Let’s begin with fetching the NFT collections: Bored Ape Yacht Club, Doodles, and Cryptopunks.

Here is a Python example we can use to do so:

As we can see in the “NFT_Collection_Array” we have included 3 NFT contract addresses corresponding to: Bored Ape Yacht Club, Doodles, and Cryptopunks which we are passing into our POST request.

Creating your own list of NFT addresses is where you can differentiate yourself. Some potential ideas are populating this list by some trending metric, recommending the newest additions, spotlighting particular collections,or your own algorithm.

Here’s a sample of the response we receive (I have redacted the response to the Bored Ape Yacht Club object, omitting Doodles and Cryptopunks, in the interest of saving space, but all NFT contract addresses will return the same object key-values with their corresponding information.)

As we can see, there’s a lot of information regarding the NFT collection, including “collectionName”, “collectionDescription”, as well as cached images (for a faster user experience), and trading metrics like trading volume by day/week, trends, and average price, among others.

Step 4: Getting information about One NFT project

Now that we are displaying a collection of NFT projects, we want to offer our users the ability to navigate to any of these collections and get more information about them. Querying the Coinbase Cloud API will be similar with a few differences which we’ll go over after looking at a Python sample:

Above, we can see that the API URL is different in that it takes a couple of parameters and is a GET request.

The parameters will be:

  1. The contract address you want to get information about (in our case, we’re querying for Bored Ape Yacht Club)

  2. The network name which is “ethereum-mainnet”

  3. The page size which is very handy for frontend development pagination where you can load a subset of the entire collection and request the remaining (by using strategies like regular pagination or lazy loading.) We simply chose 10 which means the first 10 BAYC tokens will be returned

Here’s a sample of the response we’ll receive (again, I’ve redacted the response to the first BAYC token in our case, but the other objects will contain the same key-value information.)

In our response we see that a tokenList gets returned. Inside, we’ll receive the amount of tokens corresponding to the contract address which was passed in (BAYC in our case) up to the number indicated in the page_size parameter (in our example 10, yet redacted in the response.)

Each of these tokens will include information like contractAddress, tokenID, name, description, but even better, cached images (for speedy loading) in a variety of sizes, and the tokens attributes for our example with things like fur, earring, and clothes.

Part 5: Getting information about a one NFT Token

Alright, so our user is now viewing the entire collection and they want to get more information, this time on a specific NFT token. Like the query above, this is similar, in that it’s also a GET request, and the information will be passed as parameters as well.

In this query, the parameters needed will be:

  1. Once again, the contract address you want to get information about (in our case we’re querying for Bored Ape Yacht Club)

  2. The token ID which will be the ID assigned to the NFT token

  3. The network name which is “ethereum-mainnet”

Here’s a Python sample for getting information about the Bored Ape Yacht Club token “1”:

This would be the response we would receive from the Coinbase Cloud NFT API after making the request for token 1:

We can see that the response returns similar information as does querying for a list of tokens in an NFT contract, but with some key differences. 

The individual token query response includes contractAddress, tokeID, description, name, and the cached images, but it also includes token specific information such as tokenMinter, currentOwner, lastSoldPrice, numberOfUsersOwningToken, and more. This information can be invaluable for marketplace analytics, displaying pricing trends, and creating more useful features for your users.

I hope these examples have given you a small taste of the possibilities with Coinbase Cloud’s NFT APIs and would encourage you to go to the documentation to see what other information can be accessed:

The example app created can be seen here for reference: