How to Index NFT Transfers on Coinbase’s Base (ERC-721) in 10 Minutes With The Graph

TL;DR — In just a few clicks and a handful of CLI commands you’ll spin up a subgraph that captures every Transfer event on any ERC‑721 contract deployed on Base, then query it instantly with GraphQL, no custom backend or node maintenance required.


Why Track NFTs on Base with The Graph?

Base, Coinbase’s Layer‑2 built on the OP Stack, is quickly becoming an NFT hotspot thanks to low fees and an enthusiastic community. The Graph turns Base’s raw blockchain data into a searchable, scalable API, so you can build analytics dashboards, trading bots, and leaderboards without running your own infrastructure.


Step 1: Create our Subgraph in Subgraph Studio

Subgraph Studio where we will interact with our Subgraph after it has been deployed and is indexing our data.

  1. Open Subgraph Studio and click Create a Subgraph.
  2. Name it. For this example, we will call this subgraph base‑nft‑transfers.
  3. Select Base Mainnet from the network list.
  4. Click Save.

Step 2: Scaffold Locally with the Graph CLI

Now, let’s spin up our Subgraph locally to prepare it to deploy to Subgraph Studio.

Install the CLI:

yarn install -g @graphprotocol/graph-cli

# npm, yarn, pnpm, and bun can also be used.

Inside an empty project folder, run:

graph init base-nft-transfers

Then follow the prompts:

  • Choose Base Mainnet.
  • Select Smart Contract.
  • Paste your ERC‑721 contract address when asked.

The CLI autogenerates three core files:

  • subgraph.yaml — Manifest of data sources & handlers.
  • schema.graphql — Entity definitions (already includes a Transfer entity for ERC‑721).
  • mapping.ts — AssemblyScript logic.

Heads‑up: Because Transfer(address,address,uint256) is baked into the ERC‑721 standard, the CLI automatically scaffolds a Transfer entity and its handler for you. In fact, every event emitted by the contract you supply to graph init is mirrored in the generated schema and mapping stubs, so for most vanilla use‑cases you can deploy without hand‑editing these files.


Step 3: Build & Deploy

Now that our Subgraph is scaffolded locally, we can deploy it to Subgraph Studio and begin indexing!

Back in your project folder:

yarn codegen && yarn build

# Authenticate once per machine

graph auth --studio <DEPLOY_KEY>

# Deploy

graph deploy --studio base-nft-transfers

After the initial sync finishes, Studio will display a GraphQL Playground. Copy the endpoint ending in /graphql and test it with:

{
transfers(
first: 10,
orderBy: blockNumber,
orderDirection: desc
) {
tokenId
from
to
txHash
timestamp
}
}

The query returns the latest transfers as JSON—ready for your dashboard, script, or bot.


What Can You Build Next?

  • Collection Leaderboards: Rank wallets by NFTs received.
  • Real‑Time Sales Feed: Subscribe to new Transfer events and tweet notable trades.
  • Cross‑Chain Analytics: Index NFTs on other chains (e.g. Arbitrum, Solana) and merge data client‑side.

Conclusion

Starting with a quick setup in Subgraph Studio and a few CLI commands, you now have a production‑ready API for tracking every NFT transfer on Base. Whether you’re building analytics tools, community dashboards, or trading bots, The Graph delivers reliable, real‑time data without the headache of managing blockchain infrastructure.

Happy building, and tag @graphprotocol when you ship! 🚀

About The Graph

The Graph  is the leading indexing and query protocol powering the decentralized internet. Since launching in 2018, it has empowered tens of thousands of developers to effortlessly build  Subgraphs  and leverage  Substreams  across countless blockchains, including Ethereum, Solana, Arbitrum, Optimism, Base, Polygon, Celo, Soneium, and Avalanche. With powerful tools like Substreams and Token API, The Graph delivers high-performance, real-time access to onchain data. From low-latency indexing to rapid token data, it serves as the premier solution for building composable, data drive dapps.

Discover more about how The Graph is shaping the future of decentralized physical infrastructure networks (DePIN) and stay connected with the community. Follow The Graph on  X LinkedIn Instagram Facebook Reddit Farcaster  and  Medium. Join the community on The Graph’s  Telegram, join technical discussions on The Graph’s  Discord.

The Graph Foundation  oversees The Graph Network.  Edge & Node StreamingFast Semiotic Labs GraphOps and  Pinax  are five of the many organizations within The Graph ecosystem.


Category
Developer Corner
Published
June 10, 2025

Marcus Rein

View all blog posts