EVM Compute Units
All Moralis plans have generous limits on the number of requests you can make per month. How many included requests you have depends on the plan you have, check the pricing page for more details.
Some requests are more expensive than others. By giving some heavy requests higher weight, we ensure that you only pay for what you use and not a cent more.
This allows you to get cheaper requests for most use cases while protecting our systems from abuse by weighing the computationally expensive endpoints.
What is a Compute Unit (CU)?β
A Compute Unit (CU) measures the computational complexity of a specific API request. Each API request carries a corresponding CU weight. For instance, simple endpoints like getNativeBalance have a low computational load, whereas more complex ones like getWalletNetworth, which fetches native balance, ERC20 balances, and prices across various chains, are more resource-intensive and therefore carry a higher CU.
Each request has both price and rate limit cost that are measured in terms of compute units. The rate limit cost of an API request is what contributes towards your CU/s throughput.
It is also important to note that some API will have dynamic pricing that will cost more CU the more inputs you add for the request.
CU Priceβ
Request price denotes the number of compute units (CUs) counted towards your monthly or daily API usage billing. This means that the CU cost of an API endpoint will be subtracted from the limits defined by your plan. For instance, the free plan offers 40,000 CUs per day, while paid plans provide 100,000,000 CUs per month or more. If usage exceeds the allocated CUs on a paid plan, overage charges apply, determined by the excess CUs consumed.
CU Rate Limit Costβ
CUs also play a crucial role in regulating the frequency of API requests through rate limits. Rate limit costs help manage your "API health" by preventing system overload caused by an excessive number of requests within a short timeframe.
Each API request is assigned two weights:
- CU price, which contributes to billing as discussed earlier
- Rate Limit CU Cost, which determines the frequency of calls to an endpoint and contributes to the CU/second throughput of your plan
When you're setting up a function call, remember to factor in the query parameters as well! These can sometimes add to the CU cost. To stay on top of it, always check the individual query parameter costs in the query parameters table to have a clear picture of the total CU cost your call will incur. This way, you can make well-informed decisions and prevent any unexpected surprises in your CU usage.
By taking a moment to consult the table before making a call, you can avoid unexpected CU charges and keep your API interactions smooth and efficient.
Compute Units and Rate Limit pricesβ
Name | Path | Price | Rate Limit Cost | |
Base | Additional | |||
getBlock | /block/{block_number_or_hash} | 100 | 0 | 20 |
getContractEvents | /{address}/events | 20 | 0 | 20 |
getTransaction | /transaction/{transaction_hash} | 10 | 0 | 10 |
getTransactions | /{address} | 30 | 0 | 20 |
getTransactionVerbose | /transaction/{transaction_hash}/verbose | 20 | 0 | 10 |
getMultipleNFTs | /nft/getMultipleNFTs | 150 | 0 | 20 |
getTransactionsVerbose | /{address}/verbose | 50 | 0 | 20 |
getInternalTransactions | /transaction/{transaction_hash}/internal-transactions | 20 | 0 | 10 |
getNativeBalance | /{address}/balance | 10 | 0 | 10 |
getNativeBalancesForAddresses | /wallets/balances | 10 | +10 CUs per wallet addresses | 10 |
getWalletTokenBalances | /{address}/erc20 | 100 | 0 | 20 |
getWalletTokenBalancesPrice | /{address}/tokens | 100 | 0 | 20 |
getDefiSummary | /wallets/{address}/defi/summary | 50 | 0 | 20 |
getDefiPositionsByProtocol | /wallets/:address/defi/:protocol/positions | 15 | 0 | 10 |
getDefiPositionsSummary | /wallets/{address}/defi/positions | 50 | 0 | 20 |
getWalletProfitabilitySummary | /wallets/{address}/profitability/summary | 30 | 0 | 20 |
getWalletProfitability | /wallets/{address}/profitability | 50 | 0 | 20 |
getWalletApprovals | /wallets/{address}/approvals | 100 | 0 | 20 |
getTokenTransfers | /{address}/erc20/transfers | 50 | 0 | 20 |
getTokenAddressTransfers | /erc20/{address}/transfers | 50 | 0 | 20 |
getTopProfitableWalletPerToken | /erc20/{address}/top-gainers | 50 | 0 | 50 |
getNFTs | /{address}/nft | 50 | 0 | 20 |
getNFTTransfers | /{address}/nft/transfers | 50 | 0 | 20 |
getNftTransfersByBlock | /block/{block_number_or_hash}/nft/transfers | 20 | 0 | 20 |
getTokenMetadata | /erc20/metadata | 10 | 0 | 20 |
web3ApiVersion | /web3/version | 1 | 0 | 1 |
getTokenMetadataBySymbol | /erc20/metadata/symbols | 10 | 0 | 10 |
getTokenPrice | /erc20/{address}/price | 50 | 0 | 20 |
getMultipleTokenPrices | /erc20/prices | 100 | 0 | 20 |
getTokenAllowance | /erc20/{address}/allowance | 10 | 0 | 20 |
getAllTokenIds | /nft/{address} | 50 | 0 | 20 |
getContractNFTTransfers | /nft/{address}/transfers | 50 | 0 | 20 |
getWalletNFTCollections | /nft/{address}/collections | 50 | 0 | 20 |
getNFTOwners | /nft/{address}/owners | 50 | 0 | 20 |
getNFTMetadata | /nft/{address}/metadata | 50 | 0 | 20 |
syncNFTContract | /nft/{address}/sync | 50 | 0 | 50 |
reSyncMetadata | /nft/{address}/{token_id}/metadata/resync | 50 | 0 | 50 |
getTokenIdMetadata | /nft/{address}/{token_id} | 20 | 0 | 20 |
getTokenIdOwners | /nft/{address}/{token_id}/owners | 50 | 0 | 20 |
getWalletTokenIdTransfers | /nft/{address}/{token_id}/transfers | 20 | 0 | 20 |
getNFTTraitsByCollection | /nft/{address}/traits | 50 | 0 | 20 |
getNFTTraitsByCollectionPaginate | /nft/{address}/nfts-by-traits | 10 | 0 | 10 |
resyncNFTRarity | /nft/{address}/traits/resync | 10 | 0 | 10 |
getNFTByContractTraits | /nft/{address}/nfts-by-traits | 50 | 0 | 20 |
resolveDomain | /resolve/{domain} | 10 | 0 | 10 |
resolveAddressToDomain | /resolve/{address}/domain | 10 | 0 | 10 |
resolveENSDomain | /resolve/ens/{domain} | 10 | 0 | 10 |
resolveAddress | /resolve/{address}/reverse | 10 | 0 | 10 |
getPairReserves | /{pair_address}/reserves | 10 | 0 | 10 |
getLogsByAddress | /{address}/logs | 20 | 0 | 20 |
getNftTransfersFromToBlock | /nft/transfers | 50 | 0 | 20 |
getNFTTrades | /nft/{address}/trades | 40 | 0 | 20 |
getNFTTradesByToken | /nft/{address}/{token_id}/trades | 40 | 0 | 20 |
getNFTTradesByWallet | /wallets/{address}/nfts/trades | 40 | 0 | 20 |
getNFTLowestPrice | /nft/{address}/lowestprice | 40 | 0 | 20 |
getNFTContractSalePrices | /nft/{address}/price | 30 | 0 | 30 |
getNFTSalePrices | /nft/{address}/{token_id}/price | 30 | 0 | 30 |
getWalletActiveChains | /wallets/{address}/chains | 50 | +50 CUs per chains | 50 |
getTopERC20TokensByMarketCap | /market-data/erc20s/top-tokens | 200 | 0 | 20 |
getTopERC20TokensByPriceMovers | /market-data/erc20s/top-movers | 200 | 0 | 20 |
getTopNFTCollectionsByMarketCap | /market-data/nfts/top-collections | 200 | 0 | 20 |
getHottestNFTCollectionsByTradingVolume | /market-data/nfts/hottest-collections | 200 | 0 | 20 |
contractsReview | /contracts-review | 1 | 0 | 10 |
endpointWeights | /info/endpointWeights | 1 | 0 | 10 |
getWalletStats | /wallets/{address}/stats | 50 | 0 | 50 |
getNFTCollectionStats | /nft/{address}/stats | 50 | 0 | 50 |
getNFTTokenStats | /nft/{address}/{token_id}/stats | 50 | 0 | 50 |
getTokenOwners | /erc20/{token_address}/owners | 50 | 0 | 20 |
getTokenStats | /erc20/{address}/stats | 50 | 0 | 50 |
getBlockStats | /block/{block_number_or_hash}/stats | 50 | 0 | 50 |
getLatestBlockNumber | /latestBlockNumber/{chain} | 10 | 0 | 10 |
getWalletNetWorth | /wallets/{address}/net-worth | 500 | +500 CUs per chains | 50 |
getWalletHistory | /wallets/{address}/history | 150 | 0 | 30 |
Dynamic Pricesβ
Some endpoints have a dynamically priced CU cost based on the number of resources being requested. The more resources being requested, the higher the CU cost for that particular request. Taking getNativeBalancesForAddresses as an example; the base CU cost of this endpoint when fetching the balance of a single address is 10 CU. If we wanted to fetch the balances of 5 addresses at once, then the CU cost for that particular call would be 50 CU.
Query Parametersβ
In addition to having compute units charged on each API request, there are additional query parameters that cost additional compute units when added to an API request.
Query parameter | CU Cost |
---|---|
include=internal_transactions on /{address} | 50 |
include=internal_transactions on /transaction/{transaction_hash} | 30 |
include=internal_transactions on /block/{block_number_or_hash} | 100 |
How to Check Compute Units?β
To check the latest compute units of our API offerings, you can use endpointWeights to do so.
- index.js (JavaScript)
- index.ts (TypeScript)
const Moralis = require("moralis").default;
await Moralis.start({
apiKey: "YOUR_API_KEY",
// ...and any other configuration
});
const response = await Moralis.EvmApi.utils.endpointWeights();
console.log(response?.toJSON());
import Moralis from "moralis";
await Moralis.start({
apiKey: "YOUR_API_KEY",
// ...and any other configuration
});
const response = await Moralis.EvmApi.utils.web3ApiVersion();
console.log(response?.toJSON());
Your output for the API request will be as follows:
[
{
"endpoint": "getBlock",
"path": "/block/{block_number_or_hash}",
"price": 100,
"rateLimitCost": 20
},
{
"endpoint": "getContractEvents",
"path": "/{address}/events",
"price": 20,
"rateLimitCost": 20
},
{
"endpoint": "getTransaction",
"path": "/transaction/{transaction_hash}",
"price": 10,
"rateLimitCost": 10
}
]
where price
refers to how much CU does the API request cost in terms of billing and rateLimitCost
refers to how much CU does the API request cost in terms of rate limits.
Streams and Compute Unitsβ
For Moralis Streams, it is important to note that each record has a fixed cost of 50 Compute Units.
You can read the article Records and Pricing to understand how records play a crucial role in the Streams API, allowing you to make the right decisions regarding usage and pricing.