Skip to main content
In this guide, you will make your first JSON-RPC call using your Moralis Node URL. We’ll use ethers.js to query the Ethereum blockchain, but you can use any JSON-RPC compatible library.

Prerequisites

  • Node.js installed on your machine.
  • A Moralis Node URL. If you haven’t created one yet, see Get Your API Key.

Step 1: Install Dependencies

Create a new project and install the required packages:

Step 2: Set Up Environment Variables

Create a .env file in your project root and add your Moralis Node URL:

Step 3: Write the Code

Create a file called index.js:

Step 4: Run the Script

You should see output like:

Using Extended RPC Methods

Moralis provides extended RPC methods that offer richer data beyond standard JSON-RPC. These methods map to Moralis API endpoints:
MethodDescription
eth_getTransactionsGet native transactions by wallet address
eth_getDecodedTransactionsGet decoded wallet history
eth_getTokenBalancesGet ERC20 token balances by wallet
eth_getTokenPriceGet ERC20 token price
eth_getTokenMetadataGet ERC20 token metadata
eth_getNFTBalancesGet NFTs by wallet address
eth_getNFTCollectionsGet NFT collections by wallet
Extended RPC methods have higher compute unit costs than standard methods. See Pricing for details.

Next Steps

  • Pricing — Understand compute unit costs for each RPC method.
  • Batch Requests — Combine multiple requests into a single API call.
  • Rate Limits — Learn about throughput limits per plan.