How to Build and Monitor dApps Using Alchemy

Introduction

In my previous article, we explored what Alchemy is and why developers prefer it for building dApps. We will take a first look at the Alchemy dashboard. In this article, we’ll continue our journey by creating a new app that supports a blockchain network. We’ll generate an RPC URL, connect that network to a Web3 wallet, and, finally, send some funds while monitoring the Alchemy RPC URL's usage through the Alchemy dashboard's logs.

Creating an App in Alchemy

Let's look at how we can create a new app in Alchemy. Follow the below steps.

Step 1. Log in to Alchemy Dashboard.

Log in to your Alchemy account. If you don’t have one, you can easily create an account by signing up on Alchemy’s website. If you're new to Alchemy or encounter any issues, feel free to refer to my previous article for guidance.

Step 2. Navigate to the "Create App" Section.

Once logged in, go to the "Apps" tab, located on the left sidebar. Here, you’ll see all the apps you’ve created. You can either modify an existing app or create a new one.

To create a new app, simply click the "Create App" button on the right side of the screen.

Create App

Next, fill in the details of the app, such as the name and description.

Description

Select the blockchain networks you want your app to support from the available list.

Blockchain networks

You can also select the services that you want for your App.

App

These services are provided by Alchemy itself, and you can use them with your app. You can also modify/edit your app later. Once you are ready with your blockchain choices and a name for your app, press the Create App button to create the app.

With this, your new Alchemy App is created.

Alchemy

You can create a total of 5 Active apps. If you want to create more, you need to delete previously created apps.

Now, let's see how we can get the RPC URL to connect to a blockchain network.

Step 3. Get the RPC URL.

To get the RPC URL inside the App details sections, visit the Networks tab. Here, you can find all the RPC URLs that your app supports. You can choose the mainnet or testnet of available networks to get the RPC URL accordingly.

RPC URL

With this, we have created our new app and also received the RPC URL that can be used to communicate with the blockchain network.

Adding the network to the external wallet

We now have the RPC URL for our blockchain network; the next step is to link it to an external Web3 wallet. For this article, we'll be using MetaMask, although the procedure is the same for other wallets as well.

Step 1. Open Metamask.

Open your MetaMask wallet extension or app. If you don’t have MetaMask installed yet, you can download it from the official MetaMask website.

Metamask

Step 2. Add a New Network.

Once MetaMask is open, click on the network selector at the top (it usually says Ethereum Mainnet by default). In the dropdown, select Add Network.

Step 3. Enter the Network Details.

You will be prompted to enter network details. Here’s where the RPC URL we generated in Alchemy comes into play. Fill in the following fields.

  • Network Name: Enter the name of the network (e.g., “Alchemy Testnet” or the name of the chain you’re working with).
  • New RPC URL: Paste the RPC URL from Alchemy.
  • Chain ID: Input the chain ID, which corresponds to the blockchain network (e.g., 137 for Polygon Mainnet).
  • Currency Symbol: This can be something like "ETH" for Ethereum or "MATIC" for Polygon.
  • Block Explorer URL: (Optional) You can provide the block explorer URL for the network, such as "https://polygonscan.com" for Polygon.

Ethereum

Step 4. Save the network.

After completing the required information, click Save. The network will now be added to your MetaMask wallet, and you can quickly switch between them by using the network picker at the top.

You’ll now see that your new network has been added to MetaMask. This will allow you to interact with the blockchain using the RPC URL generated in Alchemy. You can switch to this network whenever needed and use it to send transactions or interact with dApps built on that chain.

Let's send a transaction using Metamask to check whether our app is working correctly or not.

Sending a blockchain Transaction(via Metamask)

Now that we’ve added the Alchemy-powered network to MetaMask, we can interact with the blockchain by sending a transaction.

To send a blockchain transaction, simply click on the Send button in MetaMask, paste the recipient's address in the designated field, enter the number of tokens you wish to send, and then press Send.

Send tokens

Remember, you need to have some tokens in your account to complete the transaction. If you're testing on a testnet, you can use testnet tokens from faucets. These testnet tokens have no real value and are intended solely for development and testing purposes

Monitoring Transaction Logs in Alchemy Dashboard

Now that you’ve sent a transaction let’s see how we can monitor its activity using Alchemy’s dashboard.

Go to the Alchemy dashboard after sending tokens. On the app details page, under the Metrics section, you’ll notice some activity.

Alchemy App Metric Data

Initially, the app’s metric data was null, but now you can see requests, along with their status and relevant metrics.

Next, navigate to the Logs section of the dashboard, where you’ll find multiple requests that have been executed.

Request logs

Here, you’ll see all the requests made by MetaMask using the Alchemy RPC URL.

MetaMask uses the RPC URL provided during network configuration to handle all blockchain activities, from balance inquiries to token transfers.

If there are any errors in the blockchain API calls, you’ll be able to find them here.

Conclusion

In this article, we walked through the process of creating a new app in Alchemy, generating an RPC URL, and connecting it to MetaMask to interact with a blockchain network. We also explored how to send transactions and monitor blockchain activity using Alchemy’s dashboard. Alchemy simplifies blockchain development by providing essential tools like real-time transaction tracking and error monitoring, making it an excellent choice for developers building dApps.


Similar Articles