Aptos 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 is a measure of the requests needed to query computationally expensive API endpoints. Each request has both price and rate limit cost that are measured in terms of compute units. 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.
Price
Request price refers to the amount of compute units that will be calculated towards your API usage billing.
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 1 CU. If we wanted to fetch the balances of 5 addresses at once, then the CU cost for that particular call would be 5 CU.
Rate limit Cost
On the other hand, request rate limit cost refers to the amount of compute units that an API request cost in terms of rate limits.
Name | Path | Price | Rate Limit Cost | |
Base | Additional | |||
getAccount | /accounts/{address} | 20 | 0 | 20 |
getAccountModules | /accounts/{address}/modules | 20 | 0 | 20 |
getAccountModule | /accounts/{address}/resource/{module} | 20 | 0 | 20 |
getAccountResources | /accounts/{address}/resources | 20 | 0 | 20 |
getAccountResource | /accounts/{address}/resource/{resource_type} | 20 | 0 | 20 |
getAccountTransactions | /accounts/{address}/transactions | 30 | 0 | 30 |
getBlockByHeight | /blocks/{block_height} | 20 | 0 | 20 |
getBlockByVersion | /blocks/by_version/{version} | 20 | 0 | 20 |
getEventsByCreationNumber | /accounts/{address}/events/{creation_number} | 20 | 0 | 20 |
getEventsByEventHandle | /accounts/{address}/events/{event_handle}/{field_name} | 20 | 0 | 20 |
getTransactions | /transactions | 30 | 0 | 30 |
getTransactionsByHash | /transactions/by_hash/{txn_hash} | 20 | 0 | 20 |
getTransactionsByVersion | /transactions/by_version/{txn_version} | 20 | 0 | 20 |
simulateTransaction | /transactions/simulate | 30 | 0 | 30 |
submitTransaction | /transactions | 20 | 0 | 20 |
submitBatchTransactions | /transactions/batch | 50 | 0 | 50 |
encodeSubmission | /transactions/encode_submission | 20 | 0 | 20 |
estimateGasPrice | /transactions/estimate_gas_price | 20 | 0 | 20 |
getNFTsById | /nfts | 30 | +30 CUs per token_ids | 30 |
getNFTsByCollection | /nfts/collections/{collection_data_id_hash}/tokens | 50 | 0 | 50 |
getNFTsByCreators | /nfts/creators | 50 | +50 CUs per creator_addresses | 50 |
getNFTCollections | /collections | 30 | 0 | 30 |
getNFTCollectionsById | /collections/ids | 50 | +50 CUs per ids | 50 |
getNFTCollectionsByCreator | /collections/creators | 50 | +50 CUs per creator_addresses | 50 |
getNFTOwnersByCollection | /nfts/collections/{collection_data_id_hash}/owners | 50 | 0 | 50 |
getNFTOwnersByToken | /nfts/owners | 50 | +50 CUs per token_ids | 50 |
getNFTOwnersOfCollection | /nfts/collections/{collection_data_id_hash}/owners/list | 50 | 0 | 50 |
getNFTTransfersByIds | /nfts/transfers | 30 | +30 CUs per token_ids | 30 |
getNFTTransfersByCollection | /nfts/transfers/collections/:collection_data_id_hash | 50 | 0 | 50 |
getNFTTransfersByCreators | /nfts/transfers/creators | 50 | +50 CUs per creator_addresses | 50 |
getNFTTransfersByWallets | /nfts/transfers/wallets | 50 | +50 CUs per wallet_addresses | 50 |
getCoinInfoByCoinTypeHashes | /coins | 30 | +30 CUs per coin_type_hashes | 30 |
getLatestCoins | /coins/latest | 30 | 0 | 30 |
getCoinsByNameRange | /coins/names | 50 | 0 | 50 |
getCoinsBySymbolRange | /coins/symbols | 50 | 0 | 50 |
getCoinsByCreators | /coins/creators | 50 | +50 CUs per creator_addresses | 50 |
getCoinTransfersByCoinType | /coins/transfers/{coin_type} | 50 | 0 | 50 |
getCoinTransfersByOwnerAddresses | /coins/transfers/wallets | 50 | +50 CUs per owner_addresses | 50 |
getCoinTransferByBlockHeights | /coins/transfers/blocks | 50 | +50 CUs per undefined | 50 |
getCoinTransfersByWalletAddresses | /wallets/coins/transfers | 50 | +50 CUs per wallet_addresses | 50 |
getTopHoldersByCoin | /coins/owners/{coin_type_hash}/top-holders | 50 | 0 | 50 |
getCoinBalancesByWallets | /wallets/coins | 30 | +30 CUs per owner_addresses | 30 |
getHistoricalCoinBalancesByWallets | /wallets/coins/history | 100 | +100 CUs per owner_addresses | 100 |
getWalletNFTTransfers | /wallets/nfts/transfers | 50 | +50 CUs per owner_addresses | 50 |
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.endpointWeights();
console.log(response?.toJSON());
Your output for the API request will be as follows:
[
{
"endpoint": "getBlock",
"path": "/block/{block_number_or_hash}",
"price": 5,
"rateLimitCost": 5
},
{
"endpoint": "getContractEvents",
"path": "/{address}/events",
"price": 2,
"rateLimitCost": 2
},
{
"endpoint": "getTransactions",
"path": "/transaction/{transaction_hash}",
"price": 1,
"rateLimitCost": 3
}
]
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.