Introduction to ETH Transfer Monitoring
Monitoring Ethereum (ETH) transfer transactions is essential for developers building decentralized applications (dApps), traders tracking market movements, or analysts studying blockchain activity. This guide explores how to effectively track all ETH transfers using Moralis's JavaScript SDK and Streams API.
Getting Started with Moralis Streams API
Why Use Moralis SDK?
While the Moralis admin UI provides a user-friendly interface for setting up blockchain monitoring, advanced developers often prefer using the SDK for greater flexibility and programmatic control.
Key benefits:
- Programmatic setup for custom workflows
- Integration with existing Node.js applications
- Advanced filtering capabilities
- Real-time event detection
Prerequisites
- Moralis account (free tier available)
- Node.js environment (v14+ recommended)
- Basic JavaScript knowledge
- Web3 API key from Moralis admin panel
Setting Up ETH Transfer Monitoring
Step 1: Create a Local Webhook Server
First, establish a Node.js Express server to receive webhook notifications from Moralis Streams:
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("Received ETH transfer:", body);
// Process transaction data here
} catch (e) {
console.error("Error processing webhook:", e);
return res.status(400).json();
}
return res.status(200).json();
});
app.listen(port, () => {
console.log(`Webhook server listening on port ${port}`);
});👉 Start building with Moralis today
Step 2: Create a Forwarding Tunnel with Ngrok
Run this command in a new terminal:
ngrok http 3000This creates a public URL that tunnels to your local server, enabling Moralis to send webhook notifications.
Implementing ETH Transfer Monitoring
Monitoring Configuration
const Moralis = require("moralis").default;
const { EvmChain } = require("@moralisweb3/common-evm-utils");
require("dotenv").config();
async function setupETHTransferMonitoring() {
await Moralis.start({
apiKey: process.env.MORALIS_KEY
});
const options = {
chains: [EvmChain.ETHEREUM], // Monitor Ethereum mainnet
tag: "eth-transfers",
description: "Monitor all ETH transfers",
includeContractLogs: false,
includeNativeTxs: true,
webhookUrl: "YOUR_NGROK_URL/webhook"
};
const stream = await Moralis.Streams.add(options);
console.log("ETH transfer monitoring active:", stream.id);
}
setupETHTransferMonitoring();Key Parameters Explained
includeNativeTxs: true- Captures native ETH transfersincludeContractLogs: false- Excludes ERC-20 token transfers- Multiple chains can be monitored simultaneously
Advanced Monitoring Features
Tracking Specific Wallets
// Add this after creating your stream
await Moralis.Streams.addAddress({
id: stream.id,
address: "0x123...abc" // Wallet address to monitor
});Filter Criteria
- Transaction value thresholds
- Specific smart contracts
- Transaction types (internal/external)
ETH Transfer Monitoring Use Cases
Common Applications
- Security Monitoring - Detect suspicious transfers
- Transaction Analytics - Track market movements
- dApp Integrations - Trigger smart contract actions
- Wallet Tracking - Monitor portfolio activity
Frequently Asked Questions
Can I monitor multiple blockchains simultaneously?
Yes, Moralis Streams supports monitoring across multiple chains including Ethereum, Polygon, BSC, and others.
How quickly are transfers detected?
Transfers appear in your webhook typically within 1-2 blocks of confirmation.
Is historical data available?
While Streams focuses on real-time monitoring, you can access historical data via Moralis's Web3 API separately.
👉 Explore more Web3 monitoring solutions
What's the difference between native transfers and token transfers?
Native transfers involve the base currency (ETH), while token transfers involve ERC-20 or other token standards.
Can I filter by transaction amount?
Yes, advanced filters allow monitoring transfers above/below specific value thresholds.
Best Practices for ETH Monitoring
- Rate Limiting - Implement proper handling for high-volume periods
- Error Handling - Account for network delays and reorgs
- Data Storage - Persist important transaction data
- Alert Systems - Create notifications for significant transfers
Conclusion
Monitoring ETH transfers programmatically provides valuable insights for developers and analysts alike. Moralis's Streams API offers the most efficient way to track transactions across multiple blockchains with minimal setup.
By following this guide, you've learned how to:
- Set up a webhook server
- Configure ETH transfer monitoring
- Track specific wallets
- Implement advanced filtering
For more complex monitoring needs, consider exploring Moralis's additional Web3 APIs for comprehensive blockchain data access.