0%
HomeBlogLearn
How to Use Alchemy’s Application Monitoring Tools

How to Use Alchemy’s Application Monitoring Tools

Author: Deric Cheng

Reviewed by Brady Werkheiser


Published on November 10, 20215 min read

So you’ve read our article about using nodes to communicate with the blockchain and why you might need a node provider such as Alchemy as opposed to running your own nodes! 

What we haven’t fully discussed though, are the additional benefits you get when using us as compared to your average node provider. 

In particular, one of the main reasons we have 70% of the top apps in the Ethereum ecosystem is because we provide a whole suite of developer-friendly tools that make life waaaay easier as a developer. 

These tools cover a ton of bases, from helping you build your app faster, to analyzing requests and responses that are sent through our node endpoints, to monitoring the health of your traffic and users in real-time! If you’d like to try them out instead of reading this article, you can play with them here. 

The home page for our dashboard
The home page for our dashboard

‍Even if you don’t need this dashboard early on in the development process, trust us - once you push your dApp out publicly and other people start sending requests through your infra, these tools will be a lifesaver when it comes to debugging.

When you send a single request to the blockchain, you’ll typically get a response back immediately from your node with the answer to your query. But what do you do in the following cases?

  • Some of your requests are malformed, and you’d like to see all failing requests in the past day to determine a pattern (e.g. finding all responses with a -32000 node error code).

  • You’ve pushed your dApp to production, and users are sending requests that trigger blockchain requests in your infrastructure. They start reporting that certain transactions are failing to make it through to the blockchain, and you’d like to debug their transaction send requests.

Without a tool to help you manage this process, you’d be trawling through pages of logs stored in zipped text files, sorting these files by time, and using grep statements to try to isolate the information you need. Archaic, we know - that’s where the Request Explorer comes in!

Previously on “Debugging Your JSON-RPC API Request”
Previously on “Debugging Your JSON-RPC API Request”
‍Your new, improved request debugger!
‍Your new, improved request debugger!

Our Explorer allows you to search through historical requests and responses sent through our infrastructure anywhere from 1 second to 10 days ago! No more log-hunting - you’ve got modern technology at your fingertips. 

On these requests, you can filter the queries by all sorts of parameters, such as the type of method, HTTP responses, or node-specific errors! You can see requests based on their timestamps, the duration of the request, and many more options.

Once you’ve found a request that catches your eye, there’s a few things you might typically want to do: 

  1. Search for similar requests in the logs to determine the prevalence of a particular issue.

  2. Attempt to make that identical request again, to verify if it’s still failing. 

For the first, we’ve got a handy  little button “Explore Similar” next to each request that allows you to perform a new search with matching parameters! For the second, this is a great lead into: 

Do you ever feel like it takes way longer to manually make one-off API requests than it needs to? Believe me, we feel the same way. Whether you’re meticulously writing curl requests in the terminal or looking up a Postman library that you misnamed two months ago - it’s always just a little annoying. 

The Alchemy Composer essentially allows you to make one-off blockchain requests via a browser-based GUI, and get the response back immediately on the same webpage. 

Instead of 

  • writing curl requests and selecting an endpoint, you simply pick the blockchain, network, and method you’d like to test.

  • guessing parameters for each method, you simply select them from the dropdowns!.

  • parsing JSON objects, they’re pre-parsed in the browser!

The Alchemy Composer
The Alchemy Composer

One additional feature that’s particularly useful: if you want to share a request you’re looking at with your pair programmer, just click “Copy config URL” in the top right corner and you can share that URL directly with them while retaining all the request information! A fast and easy way to validate requests between friends.

First off, it’s important to understand what the Mempool does. Essentially, the mempool is a waiting room inside each node for pending transactions. These are transactions that have been sent by a user that have yet to be “mined”, or written onto the blockchain.

Here’s a summary of the typical flow of a transaction before it gets confirmed on the blockchain: 

  1. User generates and signs a transaction, creates a sendTransaction request, and sends the request to a node.

  2. That node places the pending transaction in its mempool. The mempool does a bunch of validation on the transaction and rejects it otherwise.

  3. That node shares the pending transaction with as many of its peers as possible and so on, so that nodes across the network will have this specific pending transaction in their mempools.

  4. Once a block is mined, the miner selects the pending transactions from its mempool that have the highest gas price and includes them in the block. These pending transactions are now mined. 

  5. Over time, a pending transaction that never gets mined may eventually be dropped by nodes.

If you still have questions, this article on pending transactions might help you out! 

One major issue is that the mempool is basically opaque to the user - the only way to access information about its contents is through API requests to check on the status that return endless log streams. 

This is a real-life, successful request to the mempool to fetch its status. Lovely, isn’t it.
This is a real-life, successful request to the mempool to fetch its status. Lovely, isn’t it.

‍Seeing how painful this was, we decided to build a GUI to allow you to access your mempool state in the dashboard instead of the CLI! 

Here’s what it looks like to browse the mempool with our Mempool Watcher: 

Alchemy mempool watcher
Alchemy mempool watcher

‍Have you ever wondered why your pending transactions aren’t going through? The vast majority of the time, it’s because the gas price for your transactions is less than the current going rate. With a tool like this, you should be able to quickly identify transactions that are getting stuck in the mempool, see the gas prices associated with them, and compare with the market rate to determine if it’s time to resubmit a transaction with a higher gas price. 

Charts and Analytics on Alchemy
Charts and Analytics on Alchemy

There’s a lot of useful information that we’re able to collect for you as your node provider - and we’re doing the best job we can to share it with you! Things we’re able to graph for you that you wouldn’t otherwise see: 

  • Your request counts over time, broken down by app.

  • The IP addresses of your requests mapped on a U.S.A. and world map (very useful if you have client apps send traffic directly to Alchemy!)

  • A visualization of recent requests sent through your app.

  • Your usage history, sortable by app and month, helping you identify trends in your traffic!

Alchemy provides node infrastructure for the blockchain, which means we manage all the infrastructure associated with sending and receiving requests to the Ethereum blockchain (among a few others!). Here’s some information on why you need a node provider. 

Once you’re sending your requests through our system, you get all the benefits we’ve discussed above: visualizations and web-based browser tools making it easier to build and monitor your dApps.

On top of that, we’ll give you: 

  • Access to Supernode, our proprietary node infrastructure that solves scalability and consistency issues that plague the blockchain.

  • Access to Alchemy Notify, a tool providing push notifications (webhooks) for events such as transactions happening on the blockchain.

  • Access to our Enhanced APIs, which allow you to make requests from the blockchain that are otherwise computationally expensive or impossible. 

  • And plenty more, including access to these features across a variety of chains such as Flow, Crypto.org, and L2s such as Polygon and Arbitrum!

Setting up Alchemy as a node provider is insanely simple - in fact, it should only be a single line of code! If you've been using web3.js or ethers.js, it's as simple as creating an Alchemy account via our dashboard, generating an API key, and replacing the instantiation with something like this:

Copied
const web3 = createAlchemyWeb3("https://eth-mainnet.alchemyapi.io/");

If you'd like a full tutorial, check out our Getting Started With Alchemy documentation here! And finally, we're always available to help 24/7 on our Alchemy Discord. Stop by and say hi - we'd love to help you on your journey in blockchain development!

Section background image

Build blockchain magic

Alchemy combines the most powerful web3 developer products and tools with resources, community and legendary support.

Get your API key