Altszn.com
  • Home
  • Crypto
    • Altcoins
    • Bitcoin
    • Ethereum
    • Monero
    • XRP
    • Zcash
  • Web3
  • DeFi
  • NFTs
No Result
View All Result
Altszn.com
  • Home
  • Crypto
    • Altcoins
    • Bitcoin
    • Ethereum
    • Monero
    • XRP
    • Zcash
  • Web3
  • DeFi
  • NFTs
No Result
View All Result
Altszn.com
No Result
View All Result

Monitor an Ethereum Address โ€“ Crypto Wallet Tracking for EVM Chains

Altszn.com by Altszn.com
January 23, 2023
in Web3
0
Monitor an Ethereum Address โ€“ Crypto Wallet Tracking for EVM Chains
399
SHARES
2.3k
VIEWS
Share on FacebookShare on Twitter


Want to monitor an Ethereum address and receive notifications for on-chain activity? With Moralisโ€™ Web3 Streams API, you can create this sort of crypto wallet tracking dapp in minutes. You can either set this up via Moralisโ€™ admin UI or create a simple JavaScript script. If choosing the latter, the following lines of code are the key to the crypto wallet tracking functionality: 

const newStream = await Moralis.Stream.add(options)       const {id}=newStream.toJSON();      const address=โ€wallet_address_you_want_to_trackโ€      await Moralis.Streams.addAddress({address,id})

To make the above snippet of code work, you also need to import and initialize Moralis. You must also define the options for your Web3 stream. If you want to learn how to properly implement the above lines of code and create a production-ready crypto wallet tracking dapp, dive into the โ€œMonitor Ethereum Addressโ€ section below and follow our lead. But first, create your free Moralis account! 

Monitor an Ethereum Address - Sign Up with the Moralis Crypto Wallet Tracking Tool Today

Overview

In todayโ€™s article, weโ€™ll show you how to utilize Moralisโ€™ Streams API to build crypto wallet tracking dapps (decentralized applications) with minimum effort. We will dive right into our tutorial and first demonstrate how to monitor an Ethereum address using Moralisโ€™ admin UI. However, when working on production-ready dapps, youโ€™ll most likely prefer to set up Web3 streams within your scripts. Thus, weโ€™ll show you how to do that as well. This is where youโ€™ll learn how to correctly implement the above-presented lines of code.

For those who prefer additional context, weโ€™ll also answer what crypto wallet tracking is and provide the theory behind todayโ€™s tutorial. Weโ€™ll also do a quick overview of Moralis and its products so you can use them to level up your dapp development. Finally, weโ€™ll outline the core benefits of the Web3 Streams API. After all, todayโ€™s tutorial reflects only a small portion of what this powerful tool is capable of.    

Illustrative image - physical radar scanning for Ethereum addresses, acting as a crypto wallet tracking tool

Monitor Ethereum Address โ€“ How to Monitor a Wallet Address on Ethereum

Letโ€™s first show you how you can set up a Web3 wallet tracker using Moralisโ€™ admin UI. Since you need an active Moralis account to access the admin area, make sure to create your free Moralis account now in case you havenโ€™t done so yet. You can use the link in the intro or hit the โ€œStart for Freeโ€ button in the top-right corner of Moralisโ€™ homepage:

If you want to test your progress as you proceed with todayโ€™s tutorial, youโ€™ll also need your MetaMask and some โ€œtestโ€ MATIC. In case you need help adding the Polygon Mumbai testnet to your MetaMask and some guidance on obtaining โ€œtestโ€ MATIC, we explain all of that in our article exploring a Polygon Mumbai faucet.  

Crypto Wallet Tracking with Moralis Admin UI

Once inside your Moralis admin area, select the โ€œStreamsโ€ option from the side menu, followed by a click on the โ€œCreate a new streamโ€ button:

Web3 Streams API landing page

Next, select the โ€œCreate it from Adminโ€ option:

Create New Stream page - Monitor Ethereum Address from Admin button

To monitor an Ethereum address, you need to provide an address. For testing purposes, the simplest way is typically to open your MetaMask and copy your address from there:

Then, paste it into the โ€œAdd Address to Streamโ€ entry field:

By entering a wallet address that you want to listen to, the UI will automatically present you with stream configuration options. To use your streams for production purposes, you need to provide a webhook URL and switch from โ€œDemoโ€ to โ€œProdโ€:

Crypto Wallet Tracking Configuration Page

We do not need to provide a webhook URL. For the description and tag fields, we can use the default options. As such, we can proceed to network selection. Since Moralis is fully cross-chain interoperable, you can target all leading EVM-compatible blockchain networks. However, we will focus on the Mumbai testnet:

In the fourth step of our stream setup, we will only select the contract interactions since we are interested in tracking ERC20 tokens:

Web3 Stream Options page selecting what Ethereum address interactions to pick

The โ€œAdvanced Optionsโ€ enable you to filter your tracking agenda further. For example, you can use a smart contractโ€™s ABI to target specific smart contract functions. You can also add multiple other filters, but for the sake of this demo, we wonโ€™t use any advanced options.

Example Transaction

Finally, we execute a transaction of Chainlink (LINK) tokens on the Mumbai testnet:

Our demo stream picks up the above transaction instantaneously:

The above screenshot shows that the stream not only detects the on-chain event but also fetches the related on-chain data. As such, you can see the transaction hash, the smart contract involved in the event, the โ€œfromโ€ and โ€œtoโ€ addresses, the transferred value, and more. Accordingly, you have a trigger plus a lot of useful details that you can neatly incorporate in all sorts of dapps or notifications/bots.

Virtual user literally diving into his screen being transported into the Ethereum grid

Crypto Wallet Tracking with Moralisโ€™ JS SDK

As mentioned above, another way to use Web3 streams from Moralis is by incorporating them programmatically. For most production purposes, this tends to be a preferred method. Therefore, letโ€™s look at the scripts that will make it possible to use NodeJS to create a backend dapp that detects and logs on-chain events.

Before we can focus on creating our stream, we need to have a server that will receive a webhook. For that purpose, we can create a simple NodeJS Express app with a โ€œwebhookโ€ endpoint. These are the lines of code that you should copy-paste into your โ€œindex.jsโ€ file:

const express = require("express");  const app = express();  const port = 3000;  app.use(express.json());  app.post("/webhook", async (req, res) => {    const {body} = req;    try {      console.log(body);    } catch (e) {      console.log(e);      return res.status(400).json();    }      return res.status(200).json();  });  app.listen(port, () => {    console.log(`Listening to streams`);  });

Note: If you are not experienced with creating NodeJS applications and setting up Express servers, use our โ€œQuickstart NodeJSโ€ guide. 

Once you have the above script set in place, use your terminal and run the following command:

npm run start

As a result, your terminal should return the โ€œListening to streamsโ€ message: 

Monitoring Ethereum address and listening to streams message in terminal

Then, open another terminal, and use โ€œngrokโ€ to create a tunnel to port โ€œ3000โ€œ. This will generate a URL address serving your streamโ€™s webhook URL. To do this, use the following command:

ngrok http 3000

Now that you have your local server and tunnel ready, itโ€™s time to take a closer look at the code that will make crypto wallet tracking possible. This is also where youโ€™ll learn to paste the above-marked URL address in the right place.

Crypto Wallet Tracking Script โ€“ Code Walkthrough

Initialize another NodeJS app. Then, create a new โ€œindex.jsโ€ file and first require Moralis and โ€œdotenvโ€:

const Moralis = require("moralis").default;  const { EvmChain } = require("@moralisweb3/common-evm-utils");  require("dotenv").config();

You must also create a โ€œ.envโ€ file and store your Moralis Web3 API key in that file under the โ€œMORALIS_KEYโ€ variable. At this point, you should have your Moralis account up and running, and you can obtain your Web3 API key from your admin area in these two simple steps:

Web3 API landing page showing 2 steps on how to obtain Web3 API key

With your API key in place, itโ€™s time to initialize Moralis by adding the following lines of code below the โ€œrequire (โ€œdotenvโ€).config();โ€ line:

Moralis.start({      apiKey: process.env.MORALIS_KEY,  });

Next, you need to define the streamโ€™s options. These are the lines of code to use:

async function streams(){    const options = {      chains: [EvmChain.MUMBAI],        tag: "transfers",    description: "Listen to Transfers",      includeContractLogs: false,      includeNativeTxs: true,      webhookUrl: "your webhook url"    }

Looking at the above code snippet, you can see that it defines a chain to focus on, a description, a tag, and a webhook URL. If you remember the Web3 Streams UI, you see that we are defining the same options as requested by the streamโ€™s configuration. By setting โ€œincludeContractLogsโ€ to โ€œfalseโ€œ, we are not listening to ERC20 transactions. Also, by setting โ€œincludeNativeTxsโ€ to โ€œtrueโ€œ, we are focusing on native currency transfers. For the Mumbai network, thatโ€™s โ€œtestโ€ MATIC. So, all you have to do is copy-paste the above lines of code to your โ€œindex.jsโ€ file and replace โ€œyour webhook urlโ€ with the above-obtained โ€œngrokโ€ URL:

As highlighted in the above image, do not forget to add โ€œ/webhookโ€ at the end of your URL. 

Create a New Stream

At this point, you have everything ready to finally implement the lines of code provided in the introduction of todayโ€™s article. So, inside the streamโ€™s โ€œasyncโ€ function of your โ€œindex.jsโ€ file below โ€œwebhookUrlโ€œ, add these simple lines of code:

const newStream = await Moralis.Streams.add(options)    const {id} = newStream.toJSON();    const address = "wallet_address_you_want_to_track";    await Moralis.Streams.addAddress({address, id})    console.log("Fin")  }  streams()

The โ€œMoralis.Streams.add(options)โ€ method takes the above-defined options and creates a new stream. Then, the code gets the ID of the new stream with โ€œconst {id}โ€œ. Next, it defines a wallet address to monitor. Here, make sure to replace โ€œwallet_address_you_want_to_trackโ€ with your address (the one you can test). By using the โ€œMoralis.Streams.addAddressโ€ method, you add the wallet address to your stream based on its ID. Finally, the above code console logs โ€œFinโ€œ, which signals it has done its thing.  

Again, use the โ€œnode index.jsโ€ command to run this โ€œstream-creatingโ€ sample script. As a result, you should see โ€œFinโ€ in your terminal:

If you now open the terminal again where you are running your local Express server, you should see the empty webhook initializing: 

With everything set up correctly, we encourage you to test your stream โ€“ use your MetaMask and transfer some โ€œtestโ€ MATIC from or to the address you added above. As a result, youโ€™ll be able to see the details of your test transaction in your terminal:  

Console log message stating that a user is monitoring an Ethereum address

Crypto Wallet Tracking Explained

Tracking crypto wallets is all about listening to real-time activities related to a specific public blockchain address and fetching the details of those activities. For instance, in the above tutorial, we focused on ERC20 transfers (when using the UI) and native transfers (when using the JS SDK). However, these are just two popular examples of on-chain events. All in all, countless dapps can greatly benefit from this sort of signaling and data fetching. 

Title - Crypto Wallet Tracking

What is Crypto Wallet Tracking?

Crypto wallet tracking focuses on detecting the activity of Web3 wallets, and these signals can then be used in various ways. Essentially, the โ€œmonitor Ethereum addressโ€ feature enables devs to create dapps that detect activities on monitored wallets and do something useful based on those signals and related data. After all, detected activities can trigger all sorts of actions. For instance, they can trigger notifications or unlock special features of a dapp. 

Best Crypto Wallet Tracking Tool

Crypto wallets are public blockchain addresses. In turn, anyone can track every wallet address. However, it can be challenging to register when events occur and fetch parsed data without the proper means. This is why Moralisโ€™ Streams API is such a popular tool. In todayโ€™s tutorial, you saw this crypto wallet tracking tool in action. If youโ€™d like to explore it further, you can review the main benefits of Web3 Streams API below.

While detecting real-time, on-chain events is extremely useful, exploring past activities and crypto assets related to any Web3 wallet can also be of great value. It can be the key to creating the ultimate wallet tracking dapp. This is where Moralisโ€™ Web3 Data API โ€“ the best Ethereum API in 2023 โ€“ enters the scene. This API enables you to fetch any type of on-chain data with a single line of code. It allows you to get Ethereum logs and events, get Ethereum transaction details, get contract logs, and much more.

Last but not least, Moralis also offers the ultimate Web3 Auth API. This tool lets you add all of the most popular Web3 login methods to your dapps. That way, your users can participate in a frictionless Web3 onboarding experience. 

Web3 Streams API Benefits โ€“ Monitor EVM Chains, Not Just Ethereum

In our examples above, we exclusively focused on Polygonโ€™s testnet: Mumbai. However, as you were able to see in the admin UI, Moralis supports all leading EVM-compatible chains. So, aside from monitoring an Ethereum address, you can monitor any other supported chain or multiple networks at once. In fact, cross-chain interoperability is one of the greatest benefits of all Moralisโ€™ products. Not only does this allow you to target multiple chains, but it also future-proofs your work, as youโ€™ll never be stuck to a particular chain. 

Another significant benefit of the Streams API is its user-friendliness. We used NodeJS above, but you can work with other leading legacy programming languages and frameworks to make the most out of the Web3 Streams API. Whatโ€™s more, you can access this power with a free Moralis account.

Since todayโ€™s objective was to monitor an Ethereum address, we focused on listening to wallet events. However, the Streams API enables you to listen to any smart contract address as well. This further expands the possibilities of utilizing on-chain events. For example, you can create a Twitter bot for crypto whale alerts. 

Hereโ€™s a list of major Web3 Streams API benefits:

  • โœ… Cross-chain interoperability
  • โœ… User-friendliness (cross-platform interoperability)
  • โœ… Listening to crypto wallets and smart contracts
  • โœ… Speed and efficiency
  • โœ… Advanced filtering options
  • โœ… Accessible with a free account

Additionally, with the Streams API, thereโ€™s no more:

  • โŒ Connecting and maintaining buggy RPC nodes
  • โŒ Building unnecessary abstractions
  • โŒ Wasting time building complex data pipelines

If you are still using ethers.js to listen to the blockchain and you need more than the above benefits to help you decide which tool is best for the job, check out our ethers.js vs Web3 streams comparison.

TRUSTED BY INDUSTRY LEADERS

Title - Moralis Streams API - Ultimate Crypto Wallet Tracking Tool

Monitor an Ethereum Address โ€“ Crypto Wallet Tracking for EVM Chains โ€“ Summary

By tackling todayโ€™s tutorial, you had an opportunity to follow our lead and create your own Web3 streams. You explored how to do that via Moralisโ€™ admin UI or with Moralisโ€™ SDK. Each of the two methods has its benefits, one is more beginner-friendly, and the other is more suitable for production purposes. Still, they both provide the same results that support ultimate crypto wallet tracking. Todayโ€™s article also taught you that the Streams API allows you to implement the โ€œmonitor Ethereum addressโ€ feature on any EVM-compatible chain. You also learned what โ€œcrypto wallet trackingโ€ is!

With all the main benefits of the Web3 Streams API in mind, you are probably eager to start building killer dapps. On your way, make the most out of Moralisโ€™ docs and other Moralis resources. With our blockchain development YouTube channel, you can practice Web3 development by following our in-house expertsโ€™ steps. You can also expand your Web3 horizons with the content on our crypto blog. Among many other topics, this is the place to learn what danksharding is, why you need the best Ethereum faucet, and how to implement Supabase authentication. Additionally, if you want to go full-time crypto sooner rather than later, enrolling in Moralis Academy tends to provide the edge. There, you can complete a wide range of high-quality courses; however, we recommend building strong blockchain and Bitcoin fundamentals first. 



Read More: moralis.io

Tags: addresschainsCryptoEthereumEVMMonitorTrackingWalletweb 3.0Web3
ADVERTISEMENT

Recent

Metric signals $250K Bitcoin is โ€˜best case,โ€™ SOL, HYPE tipped for gains: Trade Secrets

Metric signals $250K Bitcoin is โ€˜best case,โ€™ SOL, HYPE tipped for gains: Trade Secrets

June 1, 2025
Sui vote on $162M Cetus funds ignites decentralization debate in DeFi

Sui vote on $162M Cetus funds ignites decentralization debate in DeFi

May 30, 2025
Xend Finance, Risevest Launch Tokenization Platform in Africa

Xend Finance, Risevest Launch Tokenization Platform in Africa

May 30, 2025

Categories

  • Bitcoin (4,522)
  • Blockchain (10,788)
  • Crypto (8,729)
  • Dark Web (443)
  • DeFi (8,107)
  • Ethereum (4,550)
  • Metaverse (6,803)
  • Monero (249)
  • NFT (1,094)
  • Solana (4,910)
  • Web3 (19,837)
  • Zcash (458)

Category

Select Category

    Advertise

    Advertise your site, company or product to millions of web3, NFT and cryptocurrency enthusiasts. Learn more

    Useful Links

    Advertise
    DMCA
    Contact Us
    Privacy Policy
    Shipping & Returns
    Terms of Use

    Resources

    Exchanges
    Changelly
    Web3 Jobs

    Recent News

    Metric signals $250K Bitcoin is โ€˜best case,โ€™ SOL, HYPE tipped for gains: Trade Secrets

    Metric signals $250K Bitcoin is โ€˜best case,โ€™ SOL, HYPE tipped for gains: Trade Secrets

    June 1, 2025
    Sui vote on $162M Cetus funds ignites decentralization debate in DeFi

    Sui vote on $162M Cetus funds ignites decentralization debate in DeFi

    May 30, 2025

    ยฉ 2022 Altszn.com. All Rights Reserved.

    No Result
    View All Result
    • Home
      • Home โ€“ Layout 1
      • Home โ€“ Layout 2
      • Home โ€“ Layout 3

    ยฉ Altszn.com. All Rights Reserved.

    • bitcoinBitcoin (BTC) $ 104,437.00
    • ethereumEthereum (ETH) $ 2,513.43
    • tetherTether (USDT) $ 1.00
    • xrpXRP (XRP) $ 2.16
    • bnbBNB (BNB) $ 656.18
    • solanaSolana (SOL) $ 154.40
    • usd-coinUSDC (USDC) $ 0.999790
    • dogecoinDogecoin (DOGE) $ 0.190140
    • tronTRON (TRX) $ 0.267431
    • cardanoCardano (ADA) $ 0.678522
    • staked-etherLido Staked Ether (STETH) $ 2,511.26
    • wrapped-bitcoinWrapped Bitcoin (WBTC) $ 104,178.00
    • suiSui (SUI) $ 3.26
    • hyperliquidHyperliquid (HYPE) $ 32.56
    • wrapped-stethWrapped stETH (WSTETH) $ 3,017.20
    • chainlinkChainlink (LINK) $ 13.86
    • avalanche-2Avalanche (AVAX) $ 20.69
    • stellarStellar (XLM) $ 0.265377
    • bitcoin-cashBitcoin Cash (BCH) $ 409.45
    • leo-tokenLEO Token (LEO) $ 8.69
    • the-open-networkToncoin (TON) $ 3.16
    • shiba-inuShiba Inu (SHIB) $ 0.000013
    • usdsUSDS (USDS) $ 0.999846
    • hedera-hashgraphHedera (HBAR) $ 0.167385
    • litecoinLitecoin (LTC) $ 87.06
    • wethWETH (WETH) $ 2,511.95
    • wrapped-eethWrapped eETH (WEETH) $ 2,676.19
    • polkadotPolkadot (DOT) $ 4.07
    • binance-bridged-usdt-bnb-smart-chainBinance Bridged USDT (BNB Smart Chain) (BSC-USD) $ 1.00
    • moneroMonero (XMR) $ 324.43
    • bitget-tokenBitget Token (BGB) $ 4.70
    • ethena-usdeEthena USDe (USDE) $ 1.00
    • pepePepe (PEPE) $ 0.000012
    • pi-networkPi Network (PI) $ 0.645372
    • coinbase-wrapped-btcCoinbase Wrapped BTC (CBBTC) $ 104,412.00
    • whitebitWhiteBIT Coin (WBT) $ 31.20
    • daiDai (DAI) $ 0.999878
    • bittensorBittensor (TAO) $ 431.38
    • aaveAave (AAVE) $ 241.13
    • uniswapUniswap (UNI) $ 5.97
    • ethena-staked-usdeEthena Staked USDe (SUSDE) $ 1.18
    • crypto-com-chainCronos (CRO) $ 0.102887
    • okbOKB (OKB) $ 50.10
    • aptosAptos (APT) $ 4.73
    • nearNEAR Protocol (NEAR) $ 2.41
    • jito-staked-solJito Staked SOL (JITOSOL) $ 186.65
    • blackrock-usd-institutional-digital-liquidity-fundBlackRock USD Institutional Digital Liquidity Fund (BUIDL) $ 1.00
    • tokenize-xchangeTokenize Xchange (TKX) $ 33.88
    • internet-computerInternet Computer (ICP) $ 4.90
    • ondo-financeOndo (ONDO) $ 0.824648
    • bitcoinBitcoin (BTC) $ 104,437.00
    • ethereumEthereum (ETH) $ 2,513.43
    • tetherTether (USDT) $ 1.00
    • xrpXRP (XRP) $ 2.16
    • bnbBNB (BNB) $ 656.18
    • solanaSolana (SOL) $ 154.40
    • usd-coinUSDC (USDC) $ 0.999790
    • dogecoinDogecoin (DOGE) $ 0.190140
    • tronTRON (TRX) $ 0.267431
    • cardanoCardano (ADA) $ 0.678522
    • staked-etherLido Staked Ether (STETH) $ 2,511.26
    • wrapped-bitcoinWrapped Bitcoin (WBTC) $ 104,178.00
    • suiSui (SUI) $ 3.26
    • hyperliquidHyperliquid (HYPE) $ 32.56
    • wrapped-stethWrapped stETH (WSTETH) $ 3,017.20
    • chainlinkChainlink (LINK) $ 13.86
    • avalanche-2Avalanche (AVAX) $ 20.69
    • stellarStellar (XLM) $ 0.265377
    • bitcoin-cashBitcoin Cash (BCH) $ 409.45
    • leo-tokenLEO Token (LEO) $ 8.69
    • the-open-networkToncoin (TON) $ 3.16
    • shiba-inuShiba Inu (SHIB) $ 0.000013
    • usdsUSDS (USDS) $ 0.999846
    • hedera-hashgraphHedera (HBAR) $ 0.167385
    • litecoinLitecoin (LTC) $ 87.06
    • wethWETH (WETH) $ 2,511.95
    • wrapped-eethWrapped eETH (WEETH) $ 2,676.19
    • polkadotPolkadot (DOT) $ 4.07
    • binance-bridged-usdt-bnb-smart-chainBinance Bridged USDT (BNB Smart Chain) (BSC-USD) $ 1.00
    • moneroMonero (XMR) $ 324.43
    • bitget-tokenBitget Token (BGB) $ 4.70
    • ethena-usdeEthena USDe (USDE) $ 1.00
    • pepePepe (PEPE) $ 0.000012
    • pi-networkPi Network (PI) $ 0.645372
    • coinbase-wrapped-btcCoinbase Wrapped BTC (CBBTC) $ 104,412.00
    • whitebitWhiteBIT Coin (WBT) $ 31.20
    • daiDai (DAI) $ 0.999878
    • bittensorBittensor (TAO) $ 431.38
    • aaveAave (AAVE) $ 241.13
    • uniswapUniswap (UNI) $ 5.97
    • ethena-staked-usdeEthena Staked USDe (SUSDE) $ 1.18
    • crypto-com-chainCronos (CRO) $ 0.102887
    • okbOKB (OKB) $ 50.10
    • aptosAptos (APT) $ 4.73
    • nearNEAR Protocol (NEAR) $ 2.41
    • jito-staked-solJito Staked SOL (JITOSOL) $ 186.65
    • blackrock-usd-institutional-digital-liquidity-fundBlackRock USD Institutional Digital Liquidity Fund (BUIDL) $ 1.00
    • tokenize-xchangeTokenize Xchange (TKX) $ 33.88
    • internet-computerInternet Computer (ICP) $ 4.90
    • ondo-financeOndo (ONDO) $ 0.824648