Thursday, September 11, 2025
No Result
View All Result
Ajoobz
Advertisement
  • Home
  • Bitcoin
  • Crypto Updates
    • Crypto Updates
    • Altcoin
    • Ethereum
    • Crypto Exchanges
  • Blockchain
  • NFT
  • DeFi
  • Web3
  • Metaverse
  • Scam Alert
  • Regulations
  • Analysis
Marketcap
  • Home
  • Bitcoin
  • Crypto Updates
    • Crypto Updates
    • Altcoin
    • Ethereum
    • Crypto Exchanges
  • Blockchain
  • NFT
  • DeFi
  • Web3
  • Metaverse
  • Scam Alert
  • Regulations
  • Analysis
No Result
View All Result
Ajoobz
No Result
View All Result

Query the Ethereum Blockchain for ERC-20s, Txs, NFTs, and More

2 years ago
in Web3
Reading Time: 15 mins read
0 0
A A
0
Home Web3
Share on FacebookShare on TwitterShare on E-Mail


Wish to discover the best solution to question the Ethereum blockchain for ERC-20 tokens, transactions, NFTs, and different information? With Moralis’ top-tier APIs, you’ll be able to seamlessly fetch any on-chain information from any blockchain with only some strains of code. As such, when utilizing Moralis, you’ll be able to construct decentralized functions (dapps) sooner and extra effectively!

For a preview of what’s to return, try the endpoints under for querying ERC-20 tokens, transactions, and NFTs from the Ethereum community: 

getWalletTokenBalances() – Question the ERC-20 token balances of any pockets:const response = await Moralis.EvmApi.token.getWalletTokenBalances({
“chain”: “0x1”,
“tackle”: “0x1f9090aaE28b8a3dCeaDf281B0F12828e676c326”
}); getWalletTransactions() – Get the native transaction historical past of any tackle: const response = await Moralis.EvmApi.transaction.getWalletTransactions({
“chain”: “0x1”,
“tackle”: “0x1f9090aaE28b8a3dCeaDf281B0F12828e676c326”
}); getWalletNFTs() – Fetch the NFT steadiness of any pockets: const response = await Moralis.EvmApi.nft.getWalletNFTs({
“chain”: “0x1”,
“tackle”: “0xff3879b8a363aed92a6eaba8f61f1a96a9ec3c1e”
});

Should you’d wish to be taught extra about querying information from the Ethereum blockchain and discover further endpoints, try the official Moralis documentation web page or be part of us on this article! Additionally, for those who want to question the Ethereum blockchain your self, don’t overlook to enroll with Moralis. You possibly can create an account without spending a dime, and also you’ll achieve immediate entry to our premier Web3 APIs! 

Overview 

Whether or not you’re constructing an Ethereum-based decentralized change (DEX), cryptocurrency pockets, portfolio tracker, or every other Web3 venture, you want a straightforward solution to question ERC-20 tokens, transactions, and so forth., from the blockchain. Nonetheless, that is simpler mentioned than finished. And with a number of methods to question blockchain information, how do you discover the most suitable choice? 

On this information, we’ll introduce you to the best solution to question and combine Ethereum blockchain information into your tasks. So, whether or not you’re trying to prototype your individual Web3 venture or scale an present dapp, this learn is for you. Let’s dive straight into it! 

What’s Ethereum Information? 

Ethereum information – additionally sometimes known as ”Ethereum on-chain information” – is all of the publicly accessible info saved on the Ethereum blockchain. With this information, it’s doable to confirm transactions, monitor the motion of belongings, and achieve in-depth market insights. As such, the power to question blockchain information is a necessary a part of constructing dapps and different Web3 tasks on Ethereum! 

Ethereum blockchain information might be divided into three foremost classes: 

Transaction Information: Transaction information is details about every Ethereum transaction. This contains sender and receiver addresses, transaction quantities, charges, and extra.   Sensible Contract Information: Sensible contract information refers to all of the details about good contracts deployed on Ethereum, together with a contract’s code, logs, state, and occasions.  Block Information: Block information is all of the details about every block within the Ethereum chain. This contains info reminiscent of hashes, transactions, miner charges, time stamps, and way more.

All in all, Ethereum information refers back to the publicly accessible info saved on the blockchain, together with transaction, good contract, and block information! 

How Do You Get Information from the Ethereum Blockchain? 

It’s doable to question the Ethereum blockchain in quite a few other ways. Under, we’ll discover three outstanding examples: 

Run a Node: One possibility for querying the Ethereum blockchain is to run a node your self. In doing so, you’ll be able to instantly work together with the Ethereum blockchain to question transactions, ERC-20 tokens, and extra.  Block Explorers: It’s additionally doable to leverage block explorers, that are platforms that help you seamlessly browse all transactions saved on Ethereum. For Ethereum, the go-to selection is Etherscan.   Web3 APIs: You too can use Web3 API suppliers to question the Ethereum blockchain. A Web3 API – quick for ”utility programming interface” – is a set of guidelines, strategies, and protocols that help you work together with a blockchain community.

Art illustration showing developers querying the Ethereum blockchain for data

Whereas you should utilize nodes, block explores, and Web3 APIs to question the Ethereum blockchain, these three choices have their very own benefits and drawbacks. For instance, working a node requires an underlying infrastructure, which might be bothersome to arrange. Moreover, whereas block explores offer you an intuitive interface to learn blockchain transactions, they’re not designed for integrating information into dapps. 

As such, in relation to Web3 growth, your only option is to leverage a Web3 API supplier! However which Web3 API supplier is the perfect? For the reply to this query, be part of us within the following part as we introduce you to Moralis! 

The Best Technique to Question the Ethereum Blockchain 

The best solution to question the Ethereum blockchain is to make use of Moralis – the #1 Web3 API supplier. Our premier Web3 APIs are trusted by {industry} leaders reminiscent of MetaMask, Delta, Opera, and lots of others. As such, Moralis presently powers crypto and blockchain tasks for hundreds of thousands of finish customers throughout the globe! 

Graphic art design illustration - Moralis Logo and Ethereum

In Moralis’ premier suite of growth instruments, you’ll discover a number of use-case-specific Web3 APIs, together with the Token API, Pockets API, and NFT API. With these interfaces, it turns into doable to question and combine Ethereum blockchain information into your dapps with solely single strains of code. Consequently, when working with Moralis, you’ll be able to construct every part from cryptocurrency wallets to decentralized finance (DeFi) platforms with ease.

For a fast introduction to our suite of growth instruments, listed below are three examples of Web3 APIs you should utilize to question the Ethereum blockchain:

Token API: The Token API helps each single token throughout the most important blockchains, making it the {industry}’s most complete API for ERC-20 token information. With this API, you’ll be able to effortlessly fetch token balances, transactions, costs, and extra.  Pockets API: The Pockets API is the {industry}’s main device for constructing wallets and integrating pockets performance into your dapps. With single strains of code, you’ll be able to seamlessly use the Pockets API to fetch balances, transactions, profile information, and so forth., from any tackle.  NFT API: The NFT API offers you every part that you must question NFT information from the Ethereum blockchain. Use this API to get NFT balances, metadata, worth information, and way more with out breaking a sweat. 

If you wish to discover all our growth instruments, please go to our Web3 API web page, the place you’ll discover greater than ten further industry-leading interfaces! 

Advantages of Utilizing Moralis 

With an summary of Moralis, let’s now discover some outstanding advantages of utilizing our industry-leading Web3 APIs when querying blockchain information: 

Complete: We enrich all our API responses with tackle labels, marked information, metadata, and extra from a number of sources. This enables us to offer the {industry}’s most complete Web3 APIs.  Easy and Cross-Chain Appropriate: Request and response buildings comply with the identical patterns and requirements throughout all our APIs, making it tremendous simple so that you can question on-chain information. Furthermore, our APIs are cross-chain suitable, which means you should utilize the identical instruments to construct on networks like Ethereum, Polygon, Solana, and lots of others.  Trusted: Moralis is trusted by a whole bunch of hundreds of Web3 builders and huge enterprise clients, together with MetaMask, Opera, Delta, and so forth. 

Display highlighting projects using Moralis to query Ethereum blockchain data, including MetaMask, Blockchain.com, Delta, etc.

Additionally, do you know you’ll be able to entry our premier Web3 APIs without spending a dime? All it’s a must to do is join with Moralis, and also you’ll have the ability to begin constructing dapps sooner and extra effectively at the moment!

Now, let’s dive into the code and look nearer at how you should utilize our APIs to question information from the Ethereum blockchain! 

Ethereum Instance Queries: Uncover The way to Question Ethereum for Information 

Let’s now dive into the principle matter and present you ways simple it’s to question the Ethereum blockchain when utilizing Moralis. To take action, we’ll dive into three examples of endpoints you’ll be able to make the most of to question ERC-20 tokens, transactions, and NFTs instantly from the Ethereum blockchain! 

The way to Question ERC-20 Tokens?

With Moralis’ Token API, you’ll be able to effortlessly get any pockets’s ERC-20 token balances. In reality, all you want is a single API name to the getWalletTokenBalances() endpoint: 

const response = await Moralis.EvmApi.token.getWalletTokenBalances({
“chain”: “0x1”,
“tackle”: “0x1f9090aaE28b8a3dCeaDf281B0F12828e676c326”
});

In return for calling the endpoint above, you’ll get an array of all tokens held by the required tackle:

[
{
“token_address”: “0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48”,
“symbol”: “USDC”,
“name”: “USD Coin”,
“logo”: “https://cdn.moralis.io/eth/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.png”,
“thumbnail”: “https://cdn.moralis.io/eth/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48_thumb.png”,
“decimals”: 6,
“balance”: “10”,
“possible_spam”: false,
“verified_contract”: true
},
//…
]

The way to Fetch Pockets Transactions?

With the Pockets API, you’ll be able to seamlessly question the native transaction historical past of any tackle on Ethereum. Merely name the getWalletTransactions() endpoint: 

const response = await Moralis.EvmApi.transaction.getWalletTransactions({
“chain”: “0x1”,
“tackle”: “0x1f9090aaE28b8a3dCeaDf281B0F12828e676c326”
});

In return for calling the getWalletTransactions() endpoint, you’ll get an inventory containing the native full transaction historical past of the required pockets: 

//…
“end result”: [
{
“hash”: “0x3d33b9ff55f9a2e3a3b0dd1df6828fbf6df0db7ae1f5fbd253c31764c39bd970”,
“nonce”: “506740”,
“transaction_index”: “172”,
“from_address”: “0x1f9090aae28b8a3dceadf281b0f12828e676c326”,
“from_address_label”: “rsync-builder”,
“to_address”: “0x6d2e03b7effeae98bd302a9f836d0d6ab0002766”,
“to_address_label”: “Fee Recipient: 0x6d2…766”,
“value”: “107843232028388368”,
“gas”: “21000”,
“gas_price”: “19175358613”,
“input”: “0x”,
“receipt_cumulative_gas_used”: “21716381”,
“receipt_gas_used”: “21000”,
“receipt_contract_address”: null,
“receipt_root”: null,
“receipt_status”: “1”,
“block_timestamp”: “2024-02-16T07:48:35.000Z”,
“block_number”: “19239079”,
“block_hash”: “0x699de6e4d3035252f2ca351b95a1bdf7d9be845803a71a34d9d311f9d5a0a618”,
“transfer_index”: [
19239079,
172
]
},
//…
]
}

The way to Get NFTs?

With Moralis’ NFT API, you’ll be able to simply get the NFT steadiness of any tackle. All that you must do is name the getWalletNFTs() endpoint: 

const response = await Moralis.EvmApi.nft.getWalletNFTs({
“chain”: “0x1”,
“tackle”: “0xff3879b8a363aed92a6eaba8f61f1a96a9ec3c1e”
});

Calling the getWalletNFTs() endpoint offers you a response containing an inventory of all NFTs held by the pockets in query: 

//…
“end result”: [
{
“amount”: “1”,
“token_id”: “5021”,
“token_address”: “0xfff54e6fe44fd47c8814c4b1d62c924c54364ad3”,
“contract_type”: “ERC721”,
“owner_of”: “0xff3879b8a363aed92a6eaba8f61f1a96a9ec3c1e”,
“last_metadata_sync”: null,
“last_token_uri_sync”: “2024-02-11T03:14:30.593Z”,
“metadata”: null,
“block_number”: “14647390”,
“block_number_minted”: “14647390”,
“name”: “Youtopia”,
“symbol”: “Youtopia”,
“token_hash”: “d4719eaf84eabcf443065b0a463f5886”,
“token_uri”: “http://api.youtopia-official.xyz/ipfs/5021”,
“minter_address”: “0x13f11fd2c7c7be94674651386370d02b7aac9653”,
“verified_collection”: false,
“possible_spam”: true,
“collection_logo”: “//…”,
“collection_banner_image”: “//…”
},
//…
]
}

Tutorial: The way to Question Ethereum Blockchain Information in 3 Steps 

We’ll now cowl a short tutorial exhibiting you learn how to name the assorted endpoints of Moralis. As such, for those who comply with alongside, you’ll quickly know learn how to question the Ethereum blockchain your self for ERC-20 tokens, transactions, NFT balances, and extra! 

Nonetheless, for this walkthrough, we’ll be utilizing the getWalletTokenBalances() endpoint for example. And we’ll present you learn how to question the Ethereum blockchain in three steps:

Get a Moralis API KeyWrite a ScriptRun the Code

Nonetheless, earlier than continuing, you could take care of a number of conditions! 

Conditions 

You possibly can question Ethereum blockchain information with Moralis utilizing a number of totally different programming languages, together with Python, Go, and so forth. Nonetheless, for this tutorial, we’ll use JavaScript and Node.js. As such, for those who haven’t already, guarantee you might have the next prepared: 

Step 1: Get a Moralis API Key 

Should you haven’t already, join with Moralis by clicking on the ”Begin for Free” button on the high proper of Moralis’ homepage: 

Step 1 to query Ethereum data: Sign up using the Start for Free button on the Moralis homepage

With an account at hand, go to the ”Settings” tab, scroll all the way down to the ”API Keys” part, and replica your key: 

Step 2 - Copy the Ethereum API key

Preserve it for now, as you’ll want it within the subsequent step! 

Step 2: Write a Script 

Open your IDE, arrange a brand new folder, and initialize a venture utilizing the next terminal command: 

npm init

Subsequent, set up the Moralis SDK with the next terminal enter: 

npm set up moralis @moralisweb3/common-evm-utils

You possibly can then open your ”package deal.json” file and add ”sort”: ”module” to the record:

Substep - Adding ”type”: ”module” to the code base

From right here, create an ”index.js” file and add the next code: 

import Moralis from ‘moralis’;

strive {
await Moralis.begin({
apiKey: “YOUR_API_KEY”
});

const response = await Moralis.EvmApi.token.getWalletTokenBalances({
“chain”: “0x1”,
“tackle”: “0x1f9090aaE28b8a3dCeaDf281B0F12828e676c326”
});

console.log(response.uncooked);
} catch (e) {
console.error(e);
}

You then have to configure the code by changing YOUR_API_KEY, which you copied earlier, and configure the tackle parameter to suit your question: 

Substep to query Ethereum - Paste API key into code

That’s it; all that continues to be from right here is working the code! 

Step 3: Run the Code

Open a brand new terminal and run the command under to execute the script: 

node index.js

In return, you’ll get a response containing an array of all tokens held by the pockets in query. It can look one thing like this: 

[
{
“token_address”: “0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48”,
“symbol”: “USDC”,
“name”: “USD Coin”,
“logo”: “https://cdn.moralis.io/eth/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.png”,
“thumbnail”: “https://cdn.moralis.io/eth/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48_thumb.png”,
“decimals”: 6,
“balance”: “10”,
“possible_spam”: false,
“verified_contract”: true
},
//…
]

That’s it! Querying Ethereum information doesn’t should be more difficult than that. From right here, you’ll be able to comply with the identical steps and easily swap the endpoints and parameters to question transactions, NFTs, or different Ethereum information! 

Question Ethereum with Moralis and Construct Subsequent-Gen Dapps 

With Moralis’ numerous suite of APIs, you’ll be able to seamlessly construct any venture you need. Nonetheless, to present you a number of examples, we’ll take this part to discover three outstanding use instances for Moralis’ APIs: 

Token Analytics: Token analytics platforms are web sites and apps that give customers in-depth market perception into cryptocurrencies. These instruments establish, fetch, analyze, and current blockchain information in a readable format, making it simple for merchants to make extra knowledgeable funding choices.

A fantastic instance of a token analytics platform utilizing our Web3 APIs is Moralis Cash. Moralis Cash is a number one token explorer, blockchain information analytics device, and crypto buying and selling platform. As such, it’s primarily a one-stop store for cryptocurrency merchants.

Moralis Money UI Example - Showing what data you can query Ethereum with using Moralis

Portfolio Trackers: Portfolio trackers are apps that enable customers to watch the efficiency of their digital belongings throughout a number of blockchains. Consequently, they primarily enable customers to prepare and handle their fungible tokens and NFTs in a single place.

An instance of a portfolio tracker is Delta, an industry-leading platform for monitoring digital belongings, together with shares, NFTs, and cryptocurrencies. Delta makes use of Moralis’ Why Did It Transfer API to not solely inform customers when the worth of cryptocurrencies modifications but in addition inform customers why the worth motion occurred.

Delta Mobile app with Ethereum data queried by Moralis

Cryptocurrency Wallets: Cryptocurrency wallets are digital platforms that enable customers to retailer and handle their digital belongings, together with fungible tokens and NFTs. Essentially the most outstanding cryptocurrency wallets additionally present performance for promoting, shopping for, and swapping tokens.

A fantastic instance of a cryptocurrency pockets leveraging Moralis’ Web3 APIs is MetaMask. MetaMask is a number one self-custodial pockets with hundreds of thousands and hundreds of thousands of customers worldwide. With this premier cryptocurrency pockets, customers can effortlessly retailer, promote, purchase, and commerce digital belongings.

Crypto portfolio tracker Ethereum example query

Abstract: Question the Ethereum Blockchain for ERC-20 Tokens, Transactions, NFTs, and Extra

When working with Moralis, it’s simple to question the Ethereum blockchain. With our complete APIs, you solely want single strains of code to fetch ERC-20 tokens, transactions, and way more straight from the Ethereum blockchain. Simply try the three endpoint examples under: 

getWalletTokenBalances() – Fetch the ERC-20 token balances of any tackle:const response = await Moralis.EvmApi.token.getWalletTokenBalances({
“chain”: “0x1”,
“tackle”: “0x1f9090aaE28b8a3dCeaDf281B0F12828e676c326”
}); getWalletTransactions() – Question the native transaction historical past of any pockets: const response = await Moralis.EvmApi.transaction.getWalletTransactions({
“chain”: “0x1”,
“tackle”: “0x1f9090aaE28b8a3dCeaDf281B0F12828e676c326”
}); getWalletNFTs() – get the NFT steadiness of any tackle: const response = await Moralis.EvmApi.nft.getWalletNFTs({
“chain”: “0x1”,
“tackle”: “0xff3879b8a363aed92a6eaba8f61f1a96a9ec3c1e”
});

So, when utilizing Moralis, you’ll be able to effortlessly question ERC-20 tokens, transactions, NFTs, and way more from the Ethereum blockchain! 

Should you preferred this tutorial on learn how to question the Ethereum blockchain, contemplate studying extra content material right here on the weblog. As an illustration, try our most up-to-date information on learn how to construct on OP Mainnet. Additionally, if you wish to begin leveraging the total energy of blockchain know-how, don’t overlook to enroll with Moralis. You possibly can create an account without spending a dime, and also you’ll achieve immediate entry to our industry-leading Web3 API suite!



Source link

Tags: blockchainERC20sEthereumNFTsQueryTxs
Previous Post

$100M Ethereum Whale Asserts Claim On Starknet Airdrop Share

Next Post

Animoca Brands’ Yat Siu sees NFTs as a way to protect ownership in the age of AI

Related Posts

Futures Traders Flock to Ethereum as ETF Investors Rotate to Bitcoin
Web3

Futures Traders Flock to Ethereum as ETF Investors Rotate to Bitcoin

12 hours ago
AI agents can now pay APIs with USDC in 200 ms as Coinbase activates x402 Bazaar
Web3

AI agents can now pay APIs with USDC in 200 ms as Coinbase activates x402 Bazaar

1 day ago
QMMM Stock Skyrockets Nearly 1,750% on Bitcoin, Ethereum, Solana Treasury Plan
Web3

QMMM Stock Skyrockets Nearly 1,750% on Bitcoin, Ethereum, Solana Treasury Plan

2 days ago
Strategy Buys 7 Million More In Bitcoin After S&P 500 Snub
Web3

Strategy Buys $217 Million More In Bitcoin After S&P 500 Snub

3 days ago
Wall Street’s Needs Will Advance Ethereum’s Privacy, Says Etherealize
Web3

Wall Street’s Needs Will Advance Ethereum’s Privacy, Says Etherealize

5 days ago
Robinhood Set to Join S&P 500 as Bitcoin Giant Strategy Misses Out
Web3

Robinhood Set to Join S&P 500 as Bitcoin Giant Strategy Misses Out

6 days ago
Next Post
Animoca Brands’ Yat Siu sees NFTs as a way to protect ownership in the age of AI

Animoca Brands’ Yat Siu sees NFTs as a way to protect ownership in the age of AI

Customer service vs. customer experience: Key differentiators

Customer service vs. customer experience: Key differentiators

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

[ccpw id="587"]
  • Disclaimer
  • Cookie Privacy Policy
  • Privacy Policy
  • DMCA
  • Terms and Conditions
  • Contact us
Contact us for business inquiries: cs@ajoobz.com

Copyright © 2023 Ajoobz.
Ajoobz is not responsible for the content of external sites.

No Result
View All Result
  • Home
  • Bitcoin
  • Crypto Updates
    • Crypto Updates
    • Altcoin
    • Ethereum
    • Crypto Exchanges
  • Blockchain
  • NFT
  • DeFi
  • Web3
  • Metaverse
  • Scam Alert
  • Regulations
  • Analysis

Copyright © 2023 Ajoobz.
Ajoobz is not responsible for the content of external sites.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In