Moralis 2026: The Web3 Data API Powering 100K+ DApps with Real-Time On-Chain Data — Setup Guide

Complete guide to Moralis Web3 Data API in 2026. Learn how to fetch real-time blockchain data, NFT metadata, token prices, and wallet balances across 10+ chains with JavaScript, Python, and Unity SDKs.

  • ⭐ 3200
  • MIT
  • Updated 2026-05-20

{{< resource-info >}}

Blockchain data is the lifeblood of every decentralized application. Whether you are building a DeFi dashboard, an NFT marketplace, a wallet tracker, or a trading bot, your application needs fast, reliable access to on-chain data. In 2026, Moralis remains the most widely adopted Web3 Data API, serving over 100,000 decentralized applications with real-time blockchain data across more than ten EVM-compatible chains.

Moralis abstracts away the complexity of running your own blockchain nodes, indexing layers, and data pipelines. Instead of spending weeks setting up infrastructure, developers can start fetching wallet balances, token prices, NFT metadata, and transaction histories within minutes. This guide provides a comprehensive walkthrough of Moralis, from initial setup to advanced integrations, helping you leverage its full potential for your next Web3 project.

Affiliate Disclosure: This article contains affiliate links to Binance. We may earn a commission when you register through our link at no extra cost to you.


What Is Moralis? #

Moralis is a unified Web3 data API and development platform that provides developers with real-time access to blockchain data. Founded in 2021, it has grown to become the infrastructure backbone for over 100,000 DApps, ranging from small indie projects to enterprise-grade DeFi protocols. Moralis handles the heavy lifting of indexing, normalizing, and serving blockchain data through clean, well-documented REST APIs and SDKs.

The platform supports Ethereum, Polygon, BNB Chain, Arbitrum, Optimism, Avalanche, Base, and several other EVM-compatible networks. It also offers non-EVM support for Solana and other chains. The core value proposition is simple: instead of operating complex node infrastructure and building custom indexers, developers can call a Moralis API endpoint and receive structured, human-readable data.

Moralis provides several key API groups:

  • Web3 API — General blockchain queries, block data, and transaction details
  • Token API — Token balances, transfers, price data, and metadata
  • NFT API — NFT ownership, metadata, transfers, and collection statistics
  • Wallet API — Portfolio tracking, net worth calculations, and transaction history
  • Streams API — Real-time webhooks for on-chain events
  • Auth API — Web3 authentication and user session management

Why Choose Moralis in 2026? #

The Web3 infrastructure landscape has matured significantly, yet Moralis continues to lead for several compelling reasons.

Unified API surface. Rather than juggling multiple providers for different data types, Moralis offers a single API key that unlocks token data, NFT information, wallet portfolios, and real-time event streams. This reduces integration complexity and keeps your codebase cleaner.

Cross-chain compatibility. Moralis supports ten-plus EVM chains out of the box. Queries use the same endpoint structure regardless of which chain you target. Switching from Ethereum to Polygon requires changing a single chain parameter, not rewriting integration logic.

Real-time data delivery. The Streams API delivers webhooks within seconds of on-chain events confirming. For trading applications, portfolio trackers, and alert systems, this latency advantage is critical.

Enterprise-grade reliability. Moralis processes billions of API requests per month with a 99.9% uptime guarantee. Its infrastructure auto-scales to handle traffic spikes during NFT drops, token launches, and market volatility.

Rich SDK ecosystem. Official SDKs for JavaScript, Python, and Unity allow you to integrate Moralis in your preferred environment. React hooks and Next.js bindings further accelerate frontend development.


Setting Up Your Moralis Account #

Before writing any code, you need a Moralis account and API key.

Step 1: Visit the Moralis admin console at admin.moralis.io and register a new account. You can use an email address or connect with a Web3 wallet.

Step 2: After logging in, create a new project from the dashboard. Give it a descriptive name such as defi-dashboard or nft-tracker.

Step 3: Navigate to the API Keys section and copy your default API key. Moralis uses a tiered pricing model. The free tier includes a generous number of API calls per month, which is sufficient for development and small production applications.

Step 4: Secure your API key using environment variables. Never commit API keys directly into your source code repository.

# .env
MORALIS_API_KEY=your_api_key_here

Load this variable in your application using dotenv or your runtime’s built-in environment variable support.

// server.js
require('dotenv').config();
const apiKey = process.env.MORALIS_API_KEY;
if (!apiKey) {
  throw new Error('MORALIS_API_KEY is not defined');
}

Installing the Moralis SDK #

Moralis offers official SDKs for multiple programming languages and frameworks. Choose the one that matches your stack.

JavaScript / Node.js #

npm install moralis
// Initialize Moralis in your Node.js application
const Moralis = require('moralis').default;

await Moralis.start({
  apiKey: process.env.MORALIS_API_KEY,
});

console.log('Moralis SDK initialized successfully');

Python #

pip install moralis
# Initialize Moralis in Python
from moralis import evm_api
import os

api_key = os.environ.get('MORALIS_API_KEY')
if not api_key:
    raise ValueError("MORALIS_API_KEY environment variable is required")

print("Moralis Python SDK ready")

Unity #

For Unity developers, Moralis provides a dedicated SDK package available through the Unity Package Manager. Import the package from the official Moralis GitHub repository, then initialize it in your game startup script.

// Unity C# initialization
using MoralisUnity;
using MoralisUnity.Web3Api.Client;

async void Start()
{
    MoralisClient moralis = new MoralisClient(
        hostUrl: "https://deep-index.moralis.io/api/v2",
        applicationId: "your_app_id"
    );
    await moralis.StartAsync();
    Debug.Log("Moralis Unity SDK initialized");
}

Fetching Token Data with the Token API #

The Token API is one of the most frequently used components of Moralis. It provides endpoints for querying ERC-20 token balances, transfer history, price data, and metadata.

Get Token Price #

Fetching the current price of any token is straightforward. Moralis aggregates price data from multiple decentralized exchanges and liquidity pools.

const priceResponse = await Moralis.EvmApi.token.getTokenPrice({
  address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
  chain: '0x1', // Ethereum mainnet
});

console.log('Token Price:', priceResponse.result.usdPrice);
console.log('Price Change 24h:', priceResponse.result.usdPricePercentChange24h);

Get Wallet Token Balances #

Retrieve all ERC-20 tokens held by a specific wallet address with a single API call.

const balances = await Moralis.EvmApi.token.getWalletTokenBalances({
  address: '0x1234567890123456789012345678901234567890',
  chain: '0x1',
});

balances.result.forEach((token) => {
  console.log(`${token.name}: ${token.balance} (${token.symbol})`);
});

Get Token Transfers #

Track incoming and outgoing token transfers for a wallet or a specific token contract.

const transfers = await Moralis.EvmApi.token.getWalletTokenTransfers({
  address: '0x1234567890123456789012345678901234567890',
  chain: '0x1',
  limit: 10,
});

transfers.result.forEach((tx) => {
  console.log(`From: ${tx.fromAddress} To: ${tx.toAddress} Amount: ${tx.value}`);
});

Get Token Metadata #

Retrieve detailed metadata for any ERC-20 token including name, symbol, decimals, and logo.

const metadata = await Moralis.EvmApi.token.getTokenMetadata({
  addresses: [
    '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
    '0x6B175474E89094C44Da98b954EedeAC495271d0F',
  ],
  chain: '0x1',
});

metadata.result.forEach((token) => {
  console.log(`${token.name} (${token.symbol}) - ${token.decimals} decimals`);
});

Working with the NFT API #

The NFT API provides comprehensive coverage for querying NFT ownership, metadata, transfers, and collection-level statistics. It supports both ERC-721 and ERC-1155 standards.

Get NFTs Owned by a Wallet #

const nfts = await Moralis.EvmApi.nft.getWalletNFTs({
  address: '0x1234567890123456789012345678901234567890',
  chain: '0x1',
  limit: 20,
});

nfts.result.forEach((nft) => {
  console.log(`Collection: ${nft.name} Token ID: ${nft.tokenId}`);
  console.log(`Metadata: ${nft.metadata}`);
});

Get NFT Metadata by Token ID #

const nftMetadata = await Moralis.EvmApi.nft.getNFTMetadata({
  address: '0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D',
  tokenId: '1',
  chain: '0x1',
});

console.log('Name:', nftMetadata.result.name);
console.log('Image:', nftMetadata.result.metadata?.image);
console.log('Attributes:', nftMetadata.result.metadata?.attributes);

Get NFT Transfers for a Collection #

const transfers = await Moralis.EvmApi.nft.getNFTContractTransfers({
  address: '0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D',
  chain: '0x1',
  limit: 10,
});

transfers.result.forEach((tx) => {
  console.log(`Token ${tx.tokenId}: ${tx.fromAddress} -> ${tx.toAddress}`);
});

Python Example: Get Floor Price #

from moralis import evm_api

params = {
    "address": "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
    "chain": "eth"
}

result = evm_api.nft.get_nft_floor_price(
    api_key=api_key,
    params=params,
)

print(f"Floor Price: {result['floor_price']} ETH")

Real-Time Webhooks with the Streams API #

One of Moralis’s standout features is the Streams API, which enables real-time webhooks for on-chain events. Instead of polling for changes, your application receives push notifications when specific events occur.

Setting Up a Stream #

const { EvmChain } = require('@moralisweb3/common-evm-utils');

const stream = {
  chains: [EvmChain.ETHEREUM, EvmChain.POLYGON],
  description: 'Track USDC transfers',
  tag: 'usdc_transfers',
  includeNativeTxs: false,
  webhookUrl: 'https://your-app.com/webhooks/moralis',
  includeContractLogs: true,
  abi: [
    {
      anonymous: false,
      inputs: [
        { indexed: true, name: 'from', type: 'address' },
        { indexed: true, name: 'to', type: 'address' },
        { indexed: false, name: 'value', type: 'uint256' },
      ],
      name: 'Transfer',
      type: 'event',
    },
  ],
  topic0: ['Transfer(address,address,uint256)'],
  filter: {
    'address': '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
  },
  includeInternalTxs: false,
};

const newStream = await Moralis.Streams.add(stream);
console.log('Stream created:', newStream.result.id);

Handling Webhook Payloads #

Your webhook endpoint receives structured JSON payloads whenever the monitored event occurs.

// Express webhook handler
const express = require('express');
const crypto = require('crypto');
const app = express();
app.use(express.json());

app.post('/webhooks/moralis', (req, res) => {
  // Verify webhook signature for security
  const signature = req.headers['x-signature'];
  const body = JSON.stringify(req.body);
  const hash = crypto
    .createHmac('sha256', process.env.MORALIS_STREAM_SECRET)
    .update(body)
    .digest('hex');

  if (signature !== hash) {
    return res.status(401).send('Unauthorized');
  }

  const events = req.body.confirmed || req.body.unconfirmed;
  events.forEach((event) => {
    console.log('Transfer detected:', {
      from: event.from,
      to: event.to,
      value: event.value,
      transactionHash: event.transactionHash,
    });
  });

  res.status(200).send('OK');
});

app.listen(3000, () => console.log('Webhook server running on port 3000'));

Authentication with the Auth API #

Moralis simplifies Web3 authentication by providing a complete Auth API that handles message signing, session management, and user profile linking.

Request Message Signature #

const { EvmChain } = require('@moralisweb3/common-evm-utils');

const authMessage = await Moralis.Auth.requestMessage({
  chain: EvmChain.ETHEREUM,
  address: '0x1234567890123456789012345678901234567890',
  network: 'evm',
  domain: 'your-app.com',
  statement: 'Sign this message to authenticate with Your App',
  uri: 'https://your-app.com/login',
  expirationTime: new Date(Date.now() + 86400000), // 24 hours
  timeout: 60,
});

console.log('Sign-in message:', authMessage.result.message);

Verify Signed Message #

const authResult = await Moralis.Auth.verify({
  network: 'evm',
  message: authMessage.result.message,
  signature: '0x...signed_message...',
});

console.log('Authenticated user:', authResult.result.profileId);
console.log('Address:', authResult.result.address);

Cross-Chain Development Patterns #

A powerful aspect of Moralis is the ability to write cross-chain compatible code. The API structure remains consistent regardless of which blockchain you target.

Multi-Chain Portfolio Tracker #

const chains = ['0x1', '0x89', '0x38', '0xa4b1']; // ETH, MATIC, BNB, ARB
const address = '0x1234567890123456789012345678901234567890';

const portfolio = {};

for (const chain of chains) {
  const balances = await Moralis.EvmApi.token.getWalletTokenBalances({
    address,
    chain,
  });
  
  const chainName = chain === '0x1' ? 'Ethereum'
    : chain === '0x89' ? 'Polygon'
    : chain === '0x38' ? 'BNB Chain'
    : 'Arbitrum';
  
  portfolio[chainName] = balances.result.map((t) => ({
    symbol: t.symbol,
    balance: t.balance,
    usdValue: t.usdPrice ? parseFloat(t.balance) * t.usdPrice : null,
  }));
}

console.log('Multi-chain portfolio:', JSON.stringify(portfolio, null, 2));

Advanced Query Patterns and Optimization #

When building production applications with Moralis, several advanced patterns help you optimize performance and reduce API usage.

Pagination Handling #

Most Moralis list endpoints support cursor-based pagination for efficient data retrieval.

let cursor = null;
const allTransfers = [];

do {
  const response = await Moralis.EvmApi.token.getWalletTokenTransfers({
    address: '0x1234567890123456789012345678901234567890',
    chain: '0x1',
    limit: 100,
    cursor,
  });

  allTransfers.push(...response.result);
  cursor = response.pagination.cursor;
} while (cursor);

console.log(`Retrieved ${allTransfers.length} transfers`);

Rate Limit Management #

const axios = require('axios');
const rateLimit = require('axios-rate-limit');

const http = rateLimit(axios.create(), {
  maxRequests: 25,
  perMilliseconds: 1000,
});

async function safeApiCall(apiFunction) {
  try {
    return await apiFunction();
  } catch (error) {
    if (error.status === 429) {
      // Rate limited - implement exponential backoff
      await new Promise((r) => setTimeout(r, 2000));
      return safeApiCall(apiFunction);
    }
    throw error;
  }
}

Caching Layer with Redis #

For high-traffic applications, implement a caching layer to reduce redundant API calls.

const Redis = require('ioredis');
const redis = new Redis();

async function getCachedTokenPrice(tokenAddress, chain) {
  const cacheKey = `price:${chain}:${tokenAddress}`;
  const cached = await redis.get(cacheKey);
  
  if (cached) {
    return JSON.parse(cached);
  }

  const price = await Moralis.EvmApi.token.getTokenPrice({
    address: tokenAddress,
    chain,
  });

  // Cache for 60 seconds
  await redis.setex(cacheKey, 60, JSON.stringify(price.result));
  return price.result;
}

Frequently Asked Questions #

What chains does Moralis support? #

Moralis supports Ethereum, Polygon, BNB Chain, Arbitrum, Optimism, Avalanche, Base, Fantom, Cronos, Gnosis Chain, and several testnets. It also provides Solana API support for NFT and token data on the Solana network.

Is there a free tier available? #

Yes, Moralis offers a free tier that includes a generous allocation of API calls per month, which is typically sufficient for development environments and small-scale production applications. As your usage grows, you can upgrade to paid tiers that offer higher rate limits and priority support.

How does Moralis compare to running your own node? #

Running your own node requires significant infrastructure investment, ongoing maintenance, and engineering time to index and normalize data. Moralis eliminates this operational burden by providing indexed, structured data through simple API calls. The trade-off is that Moralis is a managed service with associated costs at scale, while self-hosted nodes offer complete sovereignty.

Can I use Moralis with serverless functions? #

Absolutely. Moralis is a stateless API service that works perfectly with serverless architectures such as Vercel Functions, AWS Lambda, and Cloudflare Workers. Initialize the SDK inside your handler function and make API calls directly. There are no persistent connections or server-side state requirements.

How secure is the Streams API webhook delivery? #

Moralis signs all webhook payloads with a secret key that you can verify on your server. Always validate the x-signature header against the HMAC-SHA256 hash of the request body using your stream secret. This prevents attackers from sending spoofed webhook requests to your endpoint. Additionally, use HTTPS endpoints and consider implementing idempotency checks to handle duplicate deliveries.

What programming languages are officially supported? #

Moralis officially provides SDKs for JavaScript/TypeScript (Node.js and browser), Python, and Unity (C#). For other languages, you can directly call the REST API using standard HTTP clients. The API follows OpenAPI specifications, so you can also generate client libraries for Go, Rust, Java, or any other language.


Before you deploy any of the tools above into production, you’ll need solid infrastructure. Two options dibi8 actually uses and recommends:

  • DigitalOcean — $200 free credit for 60 days across 14+ global regions.
  • HTStack — Hong Kong VPS with low-latency access from mainland China. This is the same IDC that hosts dibi8.com.

Affiliate links — they don’t cost you extra and they help keep dibi8.com running.

Conclusion #

Moralis has established itself as the essential Web3 data infrastructure for developers building on EVM-compatible chains. Its unified API surface covers the full spectrum of blockchain data needs, from token balances and NFT metadata to real-time event streaming and Web3 authentication. With official SDKs for JavaScript, Python, and Unity, plus a generous free tier, the barrier to entry has never been lower.

As the Web3 ecosystem continues to expand across Layer 2 networks and alternative chains, having a reliable data provider becomes increasingly critical. Moralis handles the complexity of multi-chain indexing so you can focus on building features that differentiate your application.

Ready to start building? Register on Binance to fund your Web3 development wallet and acquire the tokens you need for testing and deployment.

📦 Featured in collections

💬 Discussion