← 返回
数据分析 Key

Moralis Data Api

Query Web3 blockchain data from Moralis API. Use when user asks about wallet data (balances, tokens, NFTs, transaction history, profitability, net worth), to...
通过 Moralis API 查询 Web3 区块链数据。用于用户询问钱包数据(余额、代币、NFT、交易历史、盈亏、净值)等情况。
novnski
数据分析 clawhub v1.3.2 1 版本 100000 Key: 需要
★ 1
Stars
📥 722
下载
💾 45
安装
1
版本
#latest

概述

CRITICAL: Read Rule Files Before Implementing

The #1 cause of bugs is not reading the endpoint rule file before writing code.

For EVERY endpoint:

  1. Read rules/{EndpointName}.md
  2. Find "Example Response" section
  3. Copy the EXACT JSON structure
  4. Note field names (snake_case), data types, HTTP method, path, wrapper structure

Reading Order:

  1. This SKILL.md (core patterns)
  2. Endpoint rule file in rules/
  3. Pattern references in references/ (for edge cases only)

Setup

API Key (optional)

Never ask the user to paste their API key into the chat. Instead:

  1. Check if MORALIS_API_KEY is set in the environment (try running [ -n "$MORALIS_API_KEY" ] && echo "API key is set" || echo "API key is NOT set").
  2. If not set, offer to create the .env file with an empty placeholder: MORALIS_API_KEY=
  3. Tell the user to open the .env file and paste their key there themselves.
  4. Let them know: without the key, you won't be able to test or call the Moralis API on their behalf.

If they don't have a key yet, point them to admin.moralis.com/register (free, no credit card).

Environment Variable Discovery

The .env file location depends on how skills are installed:

Create the .env file in the project root (same directory the user runs Claude Code from). Make sure .env is in .gitignore.

Verify Your Key

curl "https://deep-index.moralis.io/api/v2.2/0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045/balance?chain=0x1" \
  -H "X-API-Key: $MORALIS_API_KEY"

Base URLs

APIBase URL
----------------------------------------------
EVMhttps://deep-index.moralis.io/api/v2.2
Solanahttps://solana-gateway.moralis.io

Authentication

All requests require: X-API-Key: $MORALIS_API_KEY


Quick Reference: Most Common Patterns

Data Type Rules

FieldRealityNOT
---------------------------------------------------------------
block_numberDecimal 12386788Hex 0xf2b5a4
timestampISO "2021-05-07T11:08:35.000Z"Unix 1620394115
balanceString "1000000000000000000"Number
decimalsString or numberAlways number

Block Numbers (always decimal)

block_number: 12386788; // number - use directly
block_number: "12386788"; // string - parseInt(block_number, 10)

Timestamps (usually ISO strings)

"2021-05-07T11:08:35.000Z"; // → new Date(timestamp).getTime()

Balances (always strings unless its a property named "formatted" eg. balanceFormatted, BigInt)

balance: "1000000000000000000";
// → (Number(BigInt(balance)) / 1e18).toFixed(6)

Response Patterns

PatternExample Endpoints
---------------------------------------------------------------------------------
Direct array [...]getWalletTokenBalancesPrice, getTokenMetadata
Wrapped { result: [] }getWalletNFTs, getWalletTransactions
Paginated { page, cursor, result }getWalletHistory, getNFTTransfers
// Safe extraction
const data = Array.isArray(response) ? response : response.result || [];

Common Field Mappings

token_address → tokenAddress
from_address_label → fromAddressLabel
block_number → blockNumber
receipt_status: "1" → success, "0" → failed
possible_spam: "true"/"false" → boolean check

Common Pitfalls (Top 5)

  1. Block numbers are decimal, not hex - Use parseInt(x, 10), not parseInt(x, 16)
  2. Timestamps are ISO strings - Use new Date(timestamp).getTime()
  3. Balances are strings - Use BigInt(balance) for math
  4. Response may be wrapped - Check for .result before .map()
  5. Path inconsistencies - Some use /wallets/{address}/..., others /{address}/...

See references/CommonPitfalls.md for complete reference.


Pagination

Many endpoints use cursor-based pagination:

# First request
curl "...?limit=100" -H "X-API-Key: $KEY"

# Next page
curl "...?limit=100&cursor=<cursor_from_response>" -H "X-API-Key: $KEY"

See references/Pagination.md for details.


Testing Endpoints

ADDRESS="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
CHAIN="0x1"

# Wallet Balance
curl "https://deep-index.moralis.io/api/v2.2/${ADDRESS}/balance?chain=${CHAIN}" \
  -H "X-API-Key: $MORALIS_API_KEY"

# Token Price
curl "https://deep-index.moralis.io/api/v2.2/erc20/0x6B175474E89094C44Da98b954EedeAC495271d0F/price?chain=${CHAIN}" \
  -H "X-API-Key: $MORALIS_API_KEY"

# Wallet Transactions (note result wrapper)
curl "https://deep-index.moralis.io/api/v2.2/${ADDRESS}?chain=${CHAIN}&limit=5" \
  -H "X-API-Key: $MORALIS_API_KEY" | jq '.result'

Quick Troubleshooting

IssueCauseSolution
----------------------------------------------------------------------------------
"Property does not exist"Field name mismatchCheck snake_case in rule file
"Cannot read undefined"Missing optional fieldUse ?. optional chaining
"blockNumber is NaN"Parsing decimal as hexUse radix 10: parseInt(x, 10)
"Wrong timestamp"Parsing ISO as numberUse new Date(timestamp).getTime()
"404 Not Found"Wrong endpoint pathVerify path in rule file

Performance & Timeouts

Most endpoints respond quickly under normal conditions. Response times can vary based on wallet activity volume, chain, and query complexity.

Recommended client timeouts:

  • Simple queries (balance, price, metadata): 10s
  • Complex queries (wallet history, DeFi positions): 30s

Large wallets with extensive transaction histories may take longer — use pagination with reasonable limit values.

See references/PerformanceAndLatency.md for optimization tips.


Default Chain Behavior

EVM addresses (0x...): Default to Ethereum (chain=0x1) unless specified.

Solana addresses (base58): Auto-detected and routed to Solana API.


Supported Chains

EVM (40+ chains): Ethereum (0x1), Polygon (0x89), BSC (0x38), Arbitrum (0xa4b1), Optimism (0xa), Base (0x2105), Avalanche (0xa86a), and more.

Solana: Mainnet, Devnet

See references/SupportedApisAndChains.md for full list.


Endpoint Catalog

Complete list of all 136 endpoints (102 EVM + 34 Solana) organized by category.

Wallet

Balances, tokens, NFTs, transaction history, profitability, and net worth data.

EndpointDescription
-----------------------
getNativeBalanceGet native balance by wallet
getNativeBalancesForAddressesGet native balance for a set of wallets
getWalletActiveChainsGet active chains by wallet address
getWalletApprovalsGet ERC20 approvals by wallet
getWalletHistoryGet the complete decoded transaction history of a wallet
getWalletInsightGet wallet insight metrics
getWalletNetWorthGet wallet net worth
getWalletNFTCollectionsGet NFT collections by wallet address
getWalletNFTsGet NFTs by wallet address
getWalletNFTTransfersGet NFT Transfers by wallet address
getWalletProfitabilityGet detailed profit and loss by wallet address
getWalletProfitabilitySummaryGet profit and loss summary by wallet address
getWalletStatsGet summary stats by wallet address
getWalletTokenBalancesPriceGet token balances with prices by wallet address
getWalletTokenTransfersGet ERC20 token transfers by wallet address
getWalletTransactionsGet native transactions by wallet
getWalletTransactionsVerboseGet decoded transactions by wallet

Token

Token prices, metadata, pairs, DEX swaps, analytics, security scores, and sniper detection.

EndpointDescription
-----------------------
getAggregatedTokenPairStatsGet aggregated token pair statistics by address
getHistoricalTokenScoreGet historical token score by token address
getMultipleTokenAnalyticsGet token analytics for a list of token addresses
getPairAddressGet DEX token pair address
getPairReservesGet DEX token pair reserves
getPairStatsGet stats by pair address
getSnipersByPairAddressGet snipers by pair address
getSwapsByPairAddressGet swap transactions by pair address
getSwapsByTokenAddressGet swap transactions by token address
getSwapsByWalletAddressGet swap transactions by wallet address
getTimeSeriesTokenAnalyticsRetrieve timeseries trading stats by token addresses
getTokenAnalyticsGet token analytics by token address
getTokenBondingStatusGet the token bonding status
getTokenCategoriesGet ERC20 token categories
getTokenHoldersGet a holders summary by token address
getTokenMetadataGet ERC20 token metadata by contract
getTokenMetadataBySymbolGet ERC20 token metadata by symbols
getTokenOwnersGet ERC20 token owners by contract
getTokenPairsGet token pairs by address
getTokenScoreGet token score by token address
getTokenStatsGet ERC20 token stats
getTokenTransfersGet ERC20 token transfers by contract address

NFT

NFT metadata, transfers, traits, rarity, floor prices, and trades.

EndpointDescription
-----------------------
getContractNFTsGet NFTs by contract address
getMultipleNFTsGet Metadata for NFTs
getNFTBulkContractMetadataGet metadata for multiple NFT contracts
getNFTByContractTraitsGet NFTs by traits
getNFTCollectionStatsGet summary stats by NFT collection
getNFTContractMetadataGet NFT collection metadata
getNFTContractSalePricesGet NFT sale prices by collection
getNFTContractTransfersGet NFT transfers by contract address
getNFTFloorPriceByContractGet NFT floor price by contract
getNFTFloorPriceByTokenGet NFT floor price by token
getNFTHistoricalFloorPriceByContractGet historical NFT floor price by contract
getNFTMetadataGet NFT metadata
getNFTOwnersGet NFT owners by contract address
getNFTSalePricesGet NFT sale prices by token
getNFTTokenIdOwnersGet NFT owners by token ID
getNFTTradesGet NFT trades by collection
getNFTTradesByTokenGet NFT trades by token
getNFTTradesByWalletGet NFT trades by wallet address
getNFTTraitsByCollectionGet NFT traits by collection
getNFTTraitsByCollectionPaginateGet NFT traits by collection paginate
getNFTTransfersGet NFT transfers by token ID
getTopNFTCollectionsByMarketCapGet top NFT collections by market cap

DeFi

DeFi protocol positions, liquidity, and exposure data.

EndpointDescription
-----------------------
getDefiPositionsByProtocolGet detailed DeFi positions by protocol for a wallet
getDefiPositionsSummaryGet DeFi positions of a wallet
getDefiSummaryGet the DeFi summary of a wallet

Entity

Labeled addresses including exchanges, funds, protocols, and whales.

EndpointDescription
-----------------------
getEntityGet Entity Details By Id
getEntityCategoriesGet Entity Categories

Price

Token and NFT prices, OHLCV candlestick data.

EndpointDescription
-----------------------
getMultipleTokenPricesGet Multiple ERC20 token prices
getPairCandlesticksGet OHLCV by pair address
getPairPriceGet DEX token pair price
getTokenPriceGet ERC20 token price

Blockchain

Blocks, transactions, date-to-block conversion, and contract functions.

EndpointDescription
-----------------------
getBlockGet block by hash
getDateToBlockGet block by date
getLatestBlockNumberGet latest block number
getTransactionGet transaction by hash
getTransactionVerboseGet decoded transaction by hash

Discovery

Trending tokens, blue chips, market movers, and token discovery.

EndpointDescription
-----------------------
getDiscoveryTokenGet token details
getTimeSeriesVolumeRetrieve timeseries trading stats by chain
getTimeSeriesVolumeByCategoryRetrieve timeseries trading stats by category
getTopCryptoCurrenciesByMarketCapGet top crypto currencies by market cap
getTopCryptoCurrenciesByTradingVolumeGet top crypto currencies by trading volume
getTopERC20TokensByMarketCapGet top ERC20 tokens by market cap
getTopERC20TokensByPriceMoversGet top ERC20 tokens by price movements (winners and losers)
getTopGainersTokensGet tokens with top gainers
getTopLosersTokensGet tokens with top losers
getTopProfitableWalletPerTokenGet top traders for a given ERC20 token
getTrendingTokensGet trending tokens
getVolumeStatsByCategoryGet trading stats by categories
getVolumeStatsByChainGet trading stats by chain

Other

Utility endpoints including API version, endpoint weights, and address resolution.

EndpointDescription
-----------------------
getBondingTokensByExchangeGet bonding tokens by exchange
getEntitiesByCategoryGet Entities By Category
getFilteredTokensReturns a list of tokens that match the specified filters and criteria
getGraduatedTokensByExchangeGet graduated tokens by exchange
getHistoricalTokenHoldersGet timeseries holders data
getNewTokensByExchangeGet new tokens by exchange
getUniqueOwnersByCollectionGet unique wallet addresses owning NFTs from a contract.
resolveAddressENS lookup by address
resolveAddressToDomainResolve Address to Unstoppable domain
resolveDomainResolve Unstoppable domain
resolveENSDomainENS lookup by domain
reSyncMetadataResync NFT metadata
searchEntitiesSearch Entities, Organizations or Wallets
searchTokensSearch for tokens based on contract address, pair address, token name or token symbol.

Solana Endpoints

Solana-specific endpoints (24 native + 10 EVM variants that support Solana chain = 34 total).

EndpointDescription
-----------------------
balanceGets native balance owned by the given address
getAggregatedTokenPairStatsGet aggregated token pair statistics by address
getBondingTokensByExchangeGet bonding tokens by exchange
getCandleSticksGet candlesticks for a pair address
getGraduatedTokensByExchangeGet graduated tokens by exchange
getHistoricalTokenHoldersGet token holders overtime for a given tokens
getMultipleTokenMetadataGet multiple token metadata
getMultipleTokenPricesGet token price
getNFTMetadataGet the global metadata for a given contract
getNFTsGets NFTs owned by the given address
getNewTokensByExchangeGet new tokens by exchange
getPairStatsGet stats for a pair address
getPortfolioGets the portfolio of the given address
getSPLGets token balances owned by the given address
getSnipersByPairAddressGet snipers by pair address.
getSwapsByPairAddressGet all swap related transactions (buy, sell, add liquidity & remove liquidity)
getSwapsByTokenAddressGet all swap related transactions (buy, sell)
getSwapsByWalletAddressGet all swap related transactions (buy, sell) for a specific wallet address.
getTokenBondingStatusGet Token Bonding Status
getTokenHoldersGet the summary of holders for a given token token.
getTokenMetadataGet Token metadata
getTokenPairsGet token pairs by address
getTokenPriceGet token price
getTopHoldersGet paginated top holders for a given token.
getDiscoveryTokenSolana variant: Get token details
getHistoricalTokenScoreSolana variant: Get historical token score by token address
getTimeSeriesVolumeSolana variant: Retrieve timeseries trading stats by chain
getTimeSeriesVolumeByCategorySolana variant: Retrieve timeseries trading stats by category
getTokenAnalyticsSolana variant: Get token analytics by token address
getTokenScoreSolana variant: Get token score by token address
getTopGainersTokensSolana variant: Get tokens with top gainers
getTopLosersTokensSolana variant: Get tokens with top losers
getTrendingTokensSolana variant: Get trending tokens
getVolumeStatsByCategorySolana variant: Get trading stats by categories

Reference Documentation


See Also

  • Endpoint rules: rules/*.md files
  • Streams API: @moralis-streams-api for real-time events

版本历史

共 1 个版本

  • v1.3.2 当前
    2026-03-29 20:34 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

data-analysis

Excel / XLSX

ivangdavila
创建、检查和编辑 Microsoft Excel 工作簿及 XLSX 文件,支持可靠的公式、日期、类型、格式、重算及模板保留功能。
★ 368 📥 140,460
developer-tools

Moralis Streams Api

novnski
通过Webhook实现区块链事件实时监控。适用于设置Webhook、实时事件流及监控钱包地址等场景。
★ 1 📥 799
data-analysis

Data Analysis

ivangdavila
{"answer":"数据分析与可视化。查询数据库、生成报告、自动化电子表格,将原始数据转化为清晰可行的见解。适用于:(1) 您……"}
★ 198 📥 65,120