The Etherscan API is a wonderful instrument for dapp builders. Nevertheless, due to its restricted functionalities, many devs hunt down Etherscan API alternate options to construct extra advanced and scalable Web3 functions. In the event you acknowledge your self right here, comply with alongside in right this moment’s article! Transferring ahead, we introduce you to Moralis’ industry-leading Web3 API suite – the last word instrument for constructing websites just like Etherscan. With our premier APIs, you may seamlessly fetch block knowledge, pockets transactions, token costs, and far mor! In the event you’re desperate to get began, listed below are three outstanding examples of endpoints you need to use to construct your individual blockchain explorer:Â
getBlock() – Get the contents of any block by a hash or block quantity: const response = await Moralis.EvmApi.block.getBlock({
“chain”: “0x1”,
“blockNumberOrHash”: “15863321”
}); getTokenPrice() – Question the native and USD value of any token by deal with:const response = await Moralis.EvmApi.token.getTokenPrice({
“chain”: “0x1”,
“deal with”: “0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0”
}); getNativeBalance() – Fetch the native stability of any pockets: const response = await Moralis.EvmApi.stability.getNativeBalance({
“chain”: “0x1”,
“deal with”: “0x057Ec652A4F150f7FF94f089A38008f49a0DF88e”
});
If you need a extra detailed breakdown of our endpoints and the way you need to use our instruments to construct websites just like Etherscan, be a part of us on this article as we take a deep dive into Moralis’ Web3 API suite!Â
Additionally, if you wish to leverage these Web3 APIs your self, don’t overlook to enroll with Moralis. You’ll be able to arrange an account free of charge, and also you’ll acquire instant entry to all our blockchain improvement instruments!Â
Overview
The Etherscan API is a strong useful resource, providing the performance to get block knowledge, fetch a pockets’s native stability, question transactions, and rather more, making it a strong selection for constructing decentralized functions (dapps). Nevertheless, whereas the Etherscan API is a dependable possibility, there are quite a few suppliers that not solely supply comparable functionalities however extra APIs as effectively. And, as you may think about, utilizing a broader API suite gives many advantages. However what’s the best choice amongst all Etherescan API alternate options? And how will you use instruments like these to construct websites just like Etherescan? In the event you’re in search of the solutions to those queries, be a part of us on this article as we discover the most effective Etherscan API various!
We’ll kick issues off by diving straight into the most effective Etherscan API various: Moralis. In doing so, we’ll discover three outstanding APIs from Moralis’ API suite you may leverage to, for example, construct websites just like Etherscan. Moreover, after introducing Moralis’ API suite, we’ll present you use our interfaces in follow by masking a number of outstanding endpoints. As such, when you comply with alongside on this article, you’ll discover ways to fetch block knowledge, token costs, pockets transactions, balances, and extra with single traces of code!Â
However, with out additional delay, let’s leap straight into the {industry}’s premier Etherscan API various: Moralis!Â
Introducing Moralis – The Final API for Constructing Websites Much like EtherscanÂ
Moralis is an industry-leading Web3 API supplier and the most effective Etherscan API various obtainable. Our API suite contains a number of enterprise-grade interfaces, making Web3 improvement as seamless and accessible as Web2. Consequently, when working with Moralis, it has by no means been simpler to construct every little thing from decentralized exchanges (DEXs) and Web3 wallets to websites just like Etherscan!Â
So, why do you have to be utilizing our Web3 improvement instruments? To reply this query, let’s take a look at three outstanding advantages of Moralis APIs:Â
Excessive Efficiency: Moralis provides the highest-performing APIs in the marketplace. You’ll be able to select any metric, whether or not you wish to choose by velocity, reliability, knowledge protection, and many others., our Web3 APIs at all times blow the competitors out of the water.  Scalability: Moralis’ Web3 APIs are constructed to scale, which means you don’t have to fret about efficiency as your dapps see elevated adoption. Cross-Chain Compatability: Moralis’ Web3 APIs are cross-chain suitable. This implies you may leverage our instruments to construct dapps on all main blockchain networks, together with Ethereum, Solana, Polygon, BNB Good Chain (BSC), Arbitrum, and lots of others.
With an summary of Moralis’ Web3 API suite, let’s get extra particular and take a look at three outstanding interfaces: the Blockchain API, Pockets API, and Token API. And, with out additional ado, let’s kick issues off by exploring the intricacies of the previous!Â
Blockchain API: Entry Blockchain Knowledge and Construct Websites Much like Etherscan
Moralis’ Blockchain API is the last word instrument for unlocking the facility of uncooked and decoded blockchain knowledge with precision and tempo. With this industry-leading instrument, you may effortlessly get block knowledge, sensible contract logs, occasions, transactions, and rather more with solely single traces of code. Consequently, when working with the Blockchain API, it has by no means been simpler to construct websites just like Etherscan, real-time buying and selling platforms, arrange real-time alerts, and many others.
Let’s take a look at among the most important advantages of the Blockchain API:Â
Scalable: The Blockchain API is constructed to scale. When your dapps develop, so does the Blockchain API’s capability to ship. As such, when constructing with this interface, you by no means have to fret in regards to the efficiency of your Web3 tasks. Exact: Moralis’ Blockchain API delivers correct and dependable knowledge, which is paramount when constructing reliable dapps. Actual-Time: Our Blockchain API thrives on velocity, indexing knowledge in actual time, providing you with and your Web3 tasks instant entry to the latest blockchain data. Organized: The Blockchain API gives detailed and digestible knowledge, organizing blocks into transfers, logs, transactions, and many others., providing you with the most effective circumstances for successfully navigating the house.Â
If you wish to study extra about this instrument, try our Blockchain API tutorial!Â
However, that covers an summary of our Blockchain API. Let’s now transfer on to the second interface: the Pockets API!Â
Pockets API: Construct the Subsequent Etherscan with Complete Pockets Knowledge
Moralis’ Pockets API is the {industry}’s premier instrument when you’re seeking to combine pockets knowledge and performance into your Web3 tasks. This instrument boasts an array of options, unparalleled scalability, and distinctive flexibility. It additionally covers over 500 million addresses throughout a number of blockchain networks, together with Ethereum, Polygon, Solana, BSC, and lots of others!Â
So, what precisely does the Pockets API do?Â
Native Balances: Entry historic and real-time native balances for any pockets deal with. ERC-20 Tokens: Get any pockets’s present or historic ERC-20 token balances.NFTs: Question all NFTs and collections held by a pockets, together with metadata and optimized picture previews. Transfers: Fetch real-time transfers, swaps, and purchases for any pockets.  Handle Labels: All switch and transaction endpoints are totally enriched with public deal with labels, permitting you to seamlessly decode transactions. ERC-4337 Compatability: The Pockets API is totally ERC-4337 suitable, permitting you to seamlessly combine account abstraction performance into your dapps.And extra!Â
That briefly covers the Pockets API; let’s now dive into the final interface for this text: the Token API!
Token API: Get Token Knowledge for Constructing Websites Much like Etherscan
The Moralis Token API is the last word instrument for ERC-20 knowledge, and it covers each single token throughout ten+ EVM chains and counting. As such, when working with the Token API, it has by no means been really easy to construct websites just like Etherscan, DEXs, portfolio trackers, or every other Web3 platform!Â
So, what are among the Token API’s most outstanding options?Â
Token Costs: Get any token’s present and historic costs from standard automated market makers (AMMs) like PancakeSwap and Uniswap. Transfers: Entry token transfers in real-time by pockets or contract. You can too fetch historic transfers for any token instantaneously. Balances: Fetch present or historic token balances of any pockets. Wealthy Metadata: Question up-to-date ERC-20 token metadata, together with symbols, names, logos, and rather more. Superior Spam Detection: Expertise enhanced safety with superior spam detection, flagging recognized rip-off tokens and suspicious exercise. Cross-Chain Performance: The Token API enables you to fetch token knowledge throughout all main EVM chains, together with Ethereum, Polygon, BSC, Chiliz, Gnosis, and lots of others. And extra!Â
That covers the three Etherscan API alternate options: Blockchain API, Pockets API, and Token API. Nevertheless, that is simply scratching the floor of Moralis’ Web3 API suite. There are quite a few different industry-leading interfaces price testing, together with the NFT API, Market Knowledge API, and many others. And when you’d prefer to discover all of them, try our Web3 API web page!Â
How you can Construct Websites Much like Etherescan with Moralis’ Web3 API SuiteÂ
Now that you’ve familiarized your self with Moralis’ Web3 API suite, we’ll take this part to discover some outstanding endpoints that may come in useful when constructing websites just like Etherscan. Furthermore, to take action, we have to begin by figuring out some key options of block explorers!Â
Etherscan enables you to discover most elements of the Ethereum blockchain, together with block knowledge, token costs, pockets transactions, balances, and many others. Nevertheless, let’s take a look at a few concrete examples beneath:Â
Exploring Block Knowledge: A central characteristic of Etherscan is which you could lookup the contents of any block. To take action, click on on one of many blocks on the Etherscan touchdown web page:
Doing so shows a bunch of knowledge, together with the block’s timestamp, transactions, gasoline used, gasoline restrict, and rather more:Â
Look Up Pockets Addresses: One other characteristic is which you could lookup any deal with utilizing Etherscan. To take action, merely enter any deal with into the search subject on the high:Â
Looking out an deal with on Etherscan takes you to a web page trying one thing like this the place you 1) get an summary subject exhibiting the native stability, worth in USD, and all tokens of the account and a couple of) can view all transactions, inner transactions, token transfers, NFT transfers, and many others.:
All in all, blockchain explorer websites like Etherscan show block knowledge, token costs, native balances, transactions, transfers, and extra!Â
So, how will you get this data?Â
The simplest option to fetch and combine knowledge like this into your Web3 tasks is to leverage Moralis’ varied APIs. And we’ll present you precisely how this works within the following sections!Â
Get Block Knowledge with the Blockchain APIÂ
With the Blockchain API, you may effortlessly get the contents of any block with a single name to the getBlock() endpoint. All it’s important to do is specify two parameters: chain and blockNumberOrHash:Â
const response = await Moralis.EvmApi.block.getBlock({
“chain”: “0x1”,
“blockNumberOrHash”: “15863321”
});
In return for calling the endpoint, you get a response containing the block’s timestamp, quantity hash, log blooms, transactions, gasoline used, gasoline restrict, and many others. Right here’s an instance of what the response may appear like:Â
{
“timestamp”: “2022-10-30T20:39:11.000Z”,
“quantity”: “15863321”,
“hash”: “0x4f5d3bb78f0311301ef282b281d23e178ced236a7ae465820fe6edeba609954a”,
“parent_hash”: “0x27e61d430386d7b4a144bee6e120a57010fbdb3cf963ca37e2d20b5452203621”,
“nonce”: “0x0000000000000000”,
“sha3_uncles”: “0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347”,
“logs_bloom”: “0x11e9182//…”,
“transactions_root”: “0x1e0b205c9c48af7dfa3f277c8ec2ba403dc4ab63635a18bbfe532097527fb18e”,
“state_root”: “0xcb1df24273693eb33869961233baac112adbdf51e980e5cf8b8aa7084e8063be”,
“receipts_root”: “0x3a3d89417ad3898d47f66155e0e5fdf3e1efde2a6f389e7b051acf729db28617”,
“miner”: “0x388C818CA8B9251b393131C08a736A67ccB19297”,
“issue”: “0”,
“total_difficulty”: “58750003716598352816469”,
“dimension”: “117595”,
“extra_data”: “0x”,
“gas_limit”: “30000000”,
“gas_used”: “19044124”,
//…
}
Fetch Native Balances with the Pockets APIÂ
The Pockets API enables you to fetch the native stability of any pockets with a single name to the getNativeBalance() endpoint. You merely want so as to add two parameters: chain and deal with:Â
const response = await Moralis.EvmApi.stability.getNativeBalance({
“chain”: “0x1”,
“deal with”: “0x057Ec652A4F150f7FF94f089A38008f49a0DF88e”
});
Calling the getNativeBalance() endpoint provides you with a easy response exhibiting the native stability of the pockets in query. That is what the response may appear like:Â
{
“stability”: “123322”
}
Question Token Costs with the Token APIÂ
With the Token API, you will get the value of any token with a single name to the getTokenPrice() endpoint. All it’s important to do is specify a series parameter and add a token’s deal with to deal with:Â
const response = await Moralis.EvmApi.token.getTokenPrice({
“chain”: “0x1”,
“deal with”: “0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0”
});
In return for calling the endpoint above, you’ll get a response with the value denominated within the chain’s native token and USD. That is what it may appear like:Â
{
“tokenName”: “Matic Token”,
“tokenSymbol”: “MATIC”,
“tokenLogo”: “https://cdn.moralis.io/eth/0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0.png”,
“tokenDecimals”: “18”,
“nativePrice”: {
“worth”: “407101727793637”,
“decimals”: 18,
“title”: “Ether”,
“image”: “ETH”,
“deal with”: “0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2”
},
“usdPrice”: 0.7680647947395282,
“usdPriceFormatted”: “0.768064794739528156”,
“exchangeName”: “Uniswap v3”,
“exchangeAddress”: “0x1F98431c8aD98523631AE4a59f267346ea31F984”,
“tokenAddress”: “0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0”
}
Get All Tokens of a Pockets with the Token APIÂ
The Token API additionally enables you to get all tokens owned by a particular pockets. All it’s worthwhile to do is name the getWalletTokenBalances() endpoint whereas passing alongside two parameters: chain and deal with:Â
const response = await Moralis.EvmApi.token.getWalletTokenBalances({
“chain”: “0x1”,
“deal with”: “0x1f9090aaE28b8a3dCeaDf281B0F12828e676c326”
});
In return for calling the getWalletTokenBalances() endpoint, you get an array of all tokens held by the pockets in query. Right here’s an instance of what it’d appear like:Â
[
{
“token_address”: “0x3c978fc9a42c80a127863d786d8883614b01b3cd”,
“symbol”: “USDT”,
“name”: “USDTOKEN”,
“logo”: null,
“thumbnail”: null,
“decimals”: 18,
“balance”: “10000000000000000000000”,
“possible_spam”: true
},
//…
]
The Token API additionally options superior spam detection, marking tokens as possible_spam if they’re potential rip-off cash. This can be a neat characteristic, permitting you to seamlessly filter by the array and take away any suspicious cash so your finish person doesn’t should take care of them:Â
Question All Transactions of a Pockets with the Pockets APIÂ
With the Pockets API, you may seamlessly fetch all transactions of a pockets with a single name to the getWalletTransactions() endpoint. All it’s important to do is move alongside two parameters: chain and deal with:Â
const response = await Moralis.EvmApi.transaction.getWalletTransactions({
“chain”: “0x1”,
“deal with”: “0x1f9090aaE28b8a3dCeaDf281B0F12828e676c326”
});
In return for calling the endpoint above, you get an array of all transactions of the required pockets. Right here’s an instance of what the response may appear like:Â
[
//…
{
“hash”: “0x59034c908cc483eea265dfa359e9cca4d65534f6a27af68c04ae085636b49843”,
“nonce”: “351249”,
“transaction_index”: “167”,
“from_address”: “0x1f9090aae28b8a3dceadf281b0f12828e676c326”,
“from_address_label”: “rsync-builder”,
“to_address”: “0x388c818ca8b9251b393131c08a736a67ccb19297”,
“to_address_label”: “Lido: Execution Layer Rewards Vault”,
“value”: “292138497314265085”,
“gas”: “22111”,
“gas_price”: “35862701891”,
“input”: “0x”,
“receipt_cumulative_gas_used”: “24862993”,
“receipt_gas_used”: “22111”,
“receipt_contract_address”: null,
“receipt_root”: null,
“receipt_status”: “1”,
“block_timestamp”: “2023-11-08T12:56:35.000Z”,
“block_number”: “18527378”,
“block_hash”: “0xd0de438f288648120b7172c17108b70071810ee5a8fcbd24bee451c7e2a6dd19”,
“transfer_index”: [
18527378,
167
]
},
//…
]
Additionally, all transaction and switch endpoints have deal with labels. With this characteristic, you may considerably enhance the person expertise of your dapps by effortlessly displaying human-readable labels moderately than lengthy, bothersome addresses concerned in all transactions:Â
If you wish to study extra about constructing websites just like Etherscan with Moralis’ API suite and combine this knowledge into dapps, try the YouTube video beneath. On this clip, certainly one of our proficient software program engineers reveals you construct a primary Etherscan clone in lower than 12 minutes:Â
What’s extra, you may study extra about all of Moralis’ varied endpoints by testing the official Web3 API documentation web page!Â
Abstract: Finest Etherescan API Different – Construct Comparable Websites to Etherscan with MoralisÂ
Right now’s article launched you to Moralis – the last word Etherscan API various. With our industry-leading Web3 APIs, you may seamlessly construct varied dapps, together with websites just like Etherscan! Â
In Moralis’ Web3 API suite, you’ll discover outstanding interfaces such because the Blockchain API, Token API, Pockets API, NFT API, Market Knowledge API, and lots of others. With the facility of those instruments, you may construct tasks sooner and extra effectively, permitting you to save lots of each time and improvement assets.Â
In the event you preferred this Etherscan API alternate options article, contemplate testing extra content material right here on Moralis. For example, discover our Base faucet information or study Moralis’ Gnosis API.Â
Additionally, if you need entry to Moralis’ API suite, don’t overlook to create your Moralis account right this moment. You’ll be able to arrange an account free of charge and instantly leverage the complete energy of blockchain know-how!