Introduction
In this tutorial, you’ll learn how to detect which blockchain networks a wallet address has activity on using the Moralis API. This is useful for building multi-chain portfolio views, determining which chains to query for a user’s assets, or understanding a wallet’s cross-chain behavior. We’ll use the following Moralis API endpoint:- Get Chain Activity - Detect which chains a wallet has been active on
Prerequisites
- Node.js v18+ installed
- A Moralis API key (get one free)
Step 1: Set Up Your Project
Create a new directory for your project and initialize it:Step 2: Create the Script
Create a file calledindex.js and add the following code:
YOUR_API_KEY with your actual Moralis API key.
Step 3: Run the Script
Execute the script to get the chain activity:Example Response
Understanding the Response
| Field | Description |
|---|---|
address | The wallet address queried |
active_chains | Array of chains where the wallet has activity |
chain | Chain identifier (eth, polygon, arbitrum, etc.) |
chain_id | Hexadecimal chain ID |
first_transaction | Details of the wallet’s first transaction on this chain |
last_transaction | Details of the wallet’s most recent transaction on this chain |
block_number | Block number of the transaction |
block_timestamp | When the transaction was mined |
transaction_hash | Hash of the transaction |
Next Steps
- Get Wallet History - Get full transaction history
- Get Token Balances - Fetch token balances

