Skip to main content

Migrating from The Graph to Moralis

Moralis is a drop-in alternative to The Graph. Moralis combines RPC node access, an enriched Web3 Data API, and real-time Streams behind a single API key — so you can replace The Graph’s Token API, retire the custom subgraphs you maintain for standard token/NFT/wallet data, and move Substreams real-time workloads to webhooks. This page maps the The Graph surface to Moralis endpoint-by-endpoint so the swap is mostly search-and-replace.
The Graph exposes blockchain data three ways: subgraphs (custom GraphQL APIs you define with a schema and mappings, then deploy and wait to index), the Token API (a prebuilt REST service for balances, transfers, holders, prices, and NFTs), and Substreams (high-throughput streaming extraction). Moralis delivers the same data through a prebuilt REST Web3 Data API plus Streams — with no subgraph to write, deploy, or keep in sync, and no indexing lead time. For standard token, NFT, wallet, and price data, the migration is mostly search-and-replace; most subgraphs exist to reindex exactly this kind of data.

Quick reference: The Graph → Moralis

Token API (REST)

Subgraphs (custom GraphQL) → prebuilt Moralis endpoints

Most subgraphs reindex standard token, NFT, wallet, and DeFi data. Those become a single prebuilt Moralis call — no schema, mappings, deployment, or indexing wait.

Substreams & real-time → Streams

Solana (SVM)

Endpoint details

Each section shows the The Graph call, the Moralis URL(s) that replace it by chain, and a runnable example. The Graph Token API calls are REST against https://token-api.thegraph.com with a Bearer token; the Moralis equivalents are plain REST with an X-API-Key header.

Token balances by wallet

The Graph: GET /v1/evm/balances
Notes: Moralis returns balance, decimals, USD price, USD value, and token metadata (symbol, name, logo, verified flag, spam flag) in one call.

Token transfers

The Graph: GET /v1/evm/transfers
Notes: For transfers of one token, use Get ERC20 Transfers; for a full decoded, chronological feed of native, ERC20, NFT, swap, and contract activity for a wallet, use Get Wallet History.

Token holders

The Graph: GET /v1/evm/holders Notes: For aggregate metrics (holder count, distribution, acquisition over time) use Token Holder Stats and Historical Token Holders — common targets for custom holder-tracking subgraphs.

Swaps & OHLC prices

The Graph: GET /v1/evm/swaps and GET /v1/evm/pools/ohlc Notes: Moralis pricing is sourced from on-chain DEX liquidity with USD conversion. For pair-level analytics see Pair Stats and Token Pairs.

NFTs by wallet & by contract

The Graph: GET /v1/evm/nft/ownerships and GET /v1/evm/nft/items
Notes: Moralis returns ERC721 and ERC1155 holdings with normalized metadata, hosted media previews, and a possible_spam flag inline. For owner sets use Get NFT Owners by Contract or by Token ID; for sales/trades use Get NFT Trades by Contract.

Replacing a subgraph GraphQL query

A typical subgraph query for a wallet’s token transfers maps to one Moralis REST call — no subgraph deploy or indexing wait.

Substreams & real-time → Moralis Streams

The Graph: Substreams / polling a subgraph for new entities
Notes: Where Substreams is a streaming-extraction primitive you wire into your own sink, Moralis Streams pushes decoded events to an HTTP webhook with retries and dynamic address management, plus ABI-decoded contract events and smart-filter expressions.
The Graph’s fully custom subgraphs — indexing bespoke protocol state, derived entities, or arbitrary contract business logic — have no prebuilt Moralis equivalent. Moralis ships standard token, NFT, wallet, price, and DeFi data out of the box; it is not a general-purpose custom indexer. If a subgraph encodes domain-specific logic you can’t express as standard data, keep that on Streams plus your own processing, or retain it on The Graph and use Moralis for everything standard. The decentralized network, curation, and GRT query economics likewise have no Moralis counterpart — Moralis is a managed API with a single key.

Chain coverage

The Graph Token API covers Ethereum, BNB Smart Chain, Polygon, Optimism, Arbitrum, Base, Unichain, Avalanche, and Solana; subgraphs can index many more chains via custom deployments. Moralis covers a comparable footprint across EVM, Solana, and Bitcoin — see Supported Chains. Before cutover, diff the chains you index on The Graph against the supported list and flag any gaps.

Migration checklist

  1. Get an API keyGet your API key.
  2. Map Token API calls — replace each /v1/... REST call with the Moralis equivalent above. Field names differ; most teams write a thin response adapter.
  3. Retire standard subgraphs — any subgraph that indexes balances, transfers, holders, NFTs, prices, or swaps can be replaced by a prebuilt Moralis endpoint. Delete the schema/mappings you were maintaining and drop the deploy + indexing wait.
  4. Move Substreams / polling to Streams — create one Stream per event class and attach addresses dynamically for push delivery.
  5. Verify chain coverage — diff your indexed chains against Supported Chains.
  6. (Optional) Add RPC — The Graph isn’t a JSON-RPC provider; if you also need RPC, Moralis RPC Nodes consolidate it onto the same key.

Beyond The Graph: what Moralis adds

Once migrated, teams commonly adopt Moralis endpoints that would each require a separate custom subgraph on The Graph:

Need help migrating off The Graph?

If you’re moving production subgraphs or Token API traffic to Moralis, the support team can help size the migration and review which subgraphs map cleanly to prebuilt endpoints — reach out via moralis.com.