Blockscout does have a built-in way to monitor addresses: the Watchlist feature under My Account. Add an address there and Blockscout emails you whenever it sends or receives a transaction, with per-token-type controls over what triggers a notification. If you’d prefer to be notified by email, this is a good way to go. In this post we add spped a flexibility: since it’s a script you own, alerts can go to Discord, Slack, a pager, a database, or anywhere else an HTTP endpoint can receive them.
Why push, not polling
Another option for checking addresses is creating a script that polls an address’s transaction list every few seconds and diffs it against what it saw last time. This can work, but is inefficient and costly for 2 main reasons.- Latency. The poll interval delays alerts. Poll every 10 seconds and your fastest possible alert is 10 seconds late, on a chain where blocks land every ~0.1 seconds. By the time a whale move is visible on Twitter, informed traders have often already acted on it, so shaving that delay is the entire value proposition of an alert bot.
- Wasted requests. Most polls return nothing new. You’re paying for the 99% of checks that find no whale activity, just to catch the 1% that does.
Blockscout’s version: the WebSocket API
Blockscout’s Pro API doesn’t currently have a hosted “webhooks” feature where you paste a URL into a dashboard and configure filters. However, with the WebSocket API you can open a multiplexed connection, subscribe to topics like a specific address, and the server pushes JSON events to you as they happen. This provides flexibility but relies on you to turn the websocket message into an outbound webhook call. In this tutorial we’ll create a webhook from the Websocket API that posts directly to Discord, driven by Blockscout’s real-time feed.What you’ll build
A ~100-line Node.js script that:- Opens a WebSocket connection to the Blockscout Pro API
- Subscribes to a Robinhood Chain address
- Watches both native ETH transfers and any token transfer (ERC-20, ERC-721, ERC-1155) involving that address
- Filters each against a low threshold
- POSTs a formatted alert to a Discord webhook when a match hits
- Reconnects automatically, with backoff, if the connection drops
Step 1: Get a Pro API key
- Go to dev.blockscout.com and create an account.
- Open the Keys section and click Create API Key. Keys start with
proapi_and are shown once.
4663). That’s not a problem here: gas is sub-cent ETH, and trading actions are gas-free for users for Robinhood Chain’s first 90 days, so a real test transfer costs you effectively nothing.
Step 2: Create a Discord webhook to receive alerts
This is the easiest possible receiver to test against, and it takes about a minute:- In Discord, go to a server you control (or create one, free, just for this).
- Server Settings → Integrations → Webhooks → New Webhook.
- Name it (e.g. “Whale Watcher”), pick a channel, and click Copy Webhook URL.
{"content": "your message"}, which is all this bot needs to send.
Step 3: Pick an address and thresholds
You need a Robinhood Chain address to watch. For testing, use a wallet you control so you can trigger alerts yourself. For a real deployment, this is where you’d point at a known exchange hot wallet, a bridge contract, or a large holder’s address.1000000000000000 wei is 0.001 ETH, low enough that almost any test transfer trips it. TOKEN_THRESHOLD is in human units (e.g. “0.001” tokens), not raw units, since the relay reads each token’s decimals off the event itself and does the conversion for you. These are placeholders you will adjust, real whale thresholds on a live deployment will be far higher, tuned to whatever counts as “large” for the wallets and tokens you’re tracking.
Step 4: Write the relay
Create a project and install the WebSocket client:npm pkg set type=module tells Node to treat .js files in this project as ES modules, which the import syntax below needs. Without it, running the script fails with Cannot use import statement outside a module.
Create watch.js by pasting this whole block into your terminal, it writes the file for you:
Connected and Subscribed, then silence until a matching transaction fires.
Step 5: Trigger a real alert
Native ETH transfer. Open your wallet (MetaMask or similar), make sure it’s connected to Robinhood Chain mainnet, and send 0.002 ETH to your watched address from any other wallet you control. Within a second or two of the transaction confirming, your script logs the match and your Discord channel gets a message:🐋 Whale move detected (IN) 0.002 ETH Tx: https://robinhoodchain.blockscout.com/tx/0x…Token transfer. If you hold any ERC-20 token on Robinhood Chain, sending even a fraction of one to your watched address triggers the token path instead. Open the token in your wallet the same way you would for any transfer, enter your watched address as the recipient, and send an amount above your
TOKEN_THRESHOLD. If your wallet doesn’t already show the token, you can add it manually using the token contract’s address, findable on robinhoodchain.blockscout.com under that token’s page.
You’ll see a matching Discord message naming the token symbol instead of ETH.
Whale watch is triggered by sending or receiving tokens from the identified address.
Watching 10 wallets on one connection
A single WebSocket connection supports up to 100 subscriptions, so watching a whole list of wallets, say, ten known exchange or bridge addresses, is still only a single connection. Tensubscribe calls run on the same socket, and one shared handler that figures out which address each incoming event belongs to.
To adjust from the single-address version, use the topic field the server echoes back on every event to know which watched address just moved.
Same as before, this creates a separate file, watch-multi.js, so paste the whole block into your terminal to write it:
Subscribed: 0x... lines on startup, one per address, then a single stream of alerts tagged with whichever address triggered each one. Test it the same way as before, a small ETH or token transfer to any one of the ten addresses shows up in Discord within a second or two, with that address named in the message so you know which wallet moved.
Taking the script to production
A few more things worth doing before you use this for real trading decisions:- Keep the dedup set bounded.
seenin this example grows forever; in a long-running process, cap it or expire entries after a few minutes. AMapstoring when each key was first seen, swept periodically, does this cleanly within the code.
if (seen.has(dedupKey)) continue; seen.add(dedupKey); for if (wasSeen(dedupKey)) continue; wherever it appears above.
- Add context to the alert, with more than just the raw number. Whale Alert’s alerts are useful because they name the sending and receiving wallets when known (an exchange, a bridge). Pulling
/api/v2/addresses/{hash}for a name tag before sending the Discord message turns “0.06 ETH moved” into “0.06 ETH moved from Coinbase hot wallet,” which is a meaningfully more useful signal. This code snippet can be added to the above code to provide more context.
getLabel just returns null and the alert falls back to the plain address, so this only adds detail when there’s additional detail to add.
Start building
- Get a free Pro API key: dev.blockscout.com
- Full WebSocket API reference: https://docs.blockscout.com/devs/apis/websocket-api
- Explore Robinhood Chain: robinhoodchain.blockscout.com