A Complete Guide to the Mumbai Testnet
Does Polygon have a Testnet?
Yes, the Polygon testnet is called Mumbai, which is a layer-two (L2) scaling platform for Ethereum. Like other testnets, Mumbai allows developers to deploy and test their applications on the Polygon network without having to spend real money.
In the case of Polygon, their native token is called MATIC, which is trading at around $1 as of May 2022. On the other hand, the test tokens for Mumbai, or testnet MATIC, are distinct from the actual MATIC tokens and do not carry any monetary value. Therefore, developers often use what are called faucets to receive free testnet MATIC for development on Mumbai.
In this guide, we will cover everything you need to know as a developer working on the polygon testnet. First, we will provide you with an overview of the testnet. Then, we will show you how you can get 2 times more testnet MATIC with Alchemy’s Mumbai faucet and how to send them using Metamask. Finally, we will list some common developer tools that you will need to build, monitor, and test a decentralized app (dApp).
Without further ado, let’s get started!
What is the Mumbai testnet?
The Mumbai testnet is the testnet of the Polygon network, which replicates the Polygon mainnet. It enables developers to deploy, test, and execute their dApps in the blockchain environment risk-free and at no cost.
Like Polygon, which launched in 2017, Mumbai also uses the proof-of-stake (PoS) consensus mechanism to agree upon the state of the blockchain.
Retaining the features of Polygon, Mumbai offers very high throughputs and extremely low transaction fees while leveraging Ethereum’s security. This makes Mumbai (and developing on Polygon, in general) particularly desirable for developers as it expedites the testing process dramatically.
Indeed, since Mumbai is essentially a replica of the Polygon mainnet, this allows developers to clearly visualize how their dApps would behave in production. Furthermore, because Polygon is Ethereum Virtual Machine (EVM)-compatible, Mumbai provides an easy way for developers who wish to migrate their dApps from the Ethereum main chain to connect to Polygon to test them before deploying onto the mainnet.
How to get started using the Mumbai testnet?
To use Mumbai to test your dApps, you will first need to set up a node in the network. A popular method is to connect your wallet to the virtual crypto wallet Metamask, which connects to a node by using a node provider like Alchemy.
If you haven’t already done so, sign up for a free Alchemy account now. You will see how this is beneficial for getting more free testnet MATIC later on in the guide!
After you have created a new app in Alchemy, there is some Mumbai RPC network details you may need to fill out in the Metamask settings to connect to the network:
- Network Name: Mumbai Testnet
- New RPC URL: https://polygon-mumbai.g.alchemy.com/v2/your-api-key
- Chain ID: 80001
- Currency Symbol: MATIC
- Block Explorer URL: https://mumbai.polygonscan.com/
Remember to replace “your-api-key” in New RPC URL with the API key of your Alchemy app. The Chain ID is one of the default Ethereum chains supported by Metamask. The block explorer URL points to Mumbai Polygonscan, the Mumbai block explorer. For more details, you can also check out the Mumbai testnet RPC URL documentation.
Although this guide is dedicated to the Mumbai testnet, there are many other options out there of testnets you can connect with. If you have any questions about selecting which testnet to use for your dApp development, check out our overview of Ethereum testnets and guide on choosing a web3 network, or reach out to us on Discord or Twitter!
How to get Mumbai testnet MATIC?
You can receive Mumbai testnet MATIC through the Mumbai faucet, which basically provides you with free fake MATIC for development purposes. Using Alchemy’s Mumbai faucet, you should receive the testnet MATIC within a few seconds.
This is significantly faster than other faucets which may take up to a few minutes. If you sign in with your Alchemy account, you will be able to receive 5x as much test MATIC!
If you have any questions, feel free to check out our guide on how to use the Mumbai faucet.
How to send Mumbai testnet MATIC?
To send Mumbai testnet MATIC, you will need a Metamask account that is connected to the Mumbai network.
You may need to manually add Mumbai using the information provided in the first section into the settings tab.
Once finished, you can now send testnet MATIC to another Metamask account that is also connected to Mumbai.
Step 1: Connect MetaMask to the Mumbai Testnet
Open Metamask and confirm that you are on the Mumbai testnet in the network selection dropdown and you have sufficient funds in your wallet (I currently have the 5 test MATIC I received from Alchemy’s Mumbai faucet), then click the “Send” button in the middle.
Step 2: Enter the Recipient's Mumbai Testnet Wallet Address
After you have clicked “Send,” Metamask should guide you to an interface where you can enter the recipient’s public address (which can be copied from the top of the main page). If you have sent to other addresses before, they will be conveniently displayed under “Recents.”
You can either ask for a friend’s Mumbai address or create a second account in your own Metamask wallet. Using your metamask wallet is recommended for quick testing.
Step 3: Enter the Amount of Test MATIC to Send
After pasting in the address of the recipient account (or clicking the “Transfer between my accounts” button), enter the amount you would like to send! We’ll send 1 MATIC for now. But if you are feeling generous, you can click on the “Max” button under “Amount” to send all your MATIC funds!
Step 4: Confirm the Mumbai Testnet Transaction
Next, Metamask will ask you to confirm your total transaction amount, which is the sum of the amount you hope to send and the gas fee incurred by the blockchain.
As you can see, on Mumbai (and also Polygon), the gas fee is extremely low and the transaction speed is also super fast. If you are satisfied with the total amount, click on “Confirm” to send the transaction.
Step 5: Transaction Complete
The transaction will take a few seconds to be validated and added to the blockchain.
Once it is complete, you should see the confirmation under the “Activity” tab on the main page of your Metamask account. If you’ve directly switched to your second account, you can also double-check that the transaction has been received.
What are the best Mumbai testnet tools?
To monitor, test, and build your dApp on the Mumbai testnet, the best tools include:
1. Mumbai Polygonscan
The Mumbai Polygonscan is the block explorer for the Mumbai testnet. This allows you to search for the details of all the addresses, transactions, and other activities that have ever happened on the network.
2. Alchemy Composer
The Alchemy Composer allows you to quickly test Ethereum JSON-RPC APIs and Alchemy Enhanced APIs. This is extremely helpful if you want to experiment with different methods that you may want to use or if you want to debug failing requests in your current dApp.
In particular, the Composer requires zero code set-up and allows you to work directly from the browser. It also includes support for all major Ethereum + L2 chains (including their mainnets and testnets)!
For the sake of this guide, we will choose the Polygon chain with the Polygon Mumbai network to perform tests. For instance, we can get the balance of the Mumbai address that we sent 1 testnet MATIC to in the previous section.
We receive a response with a result of “0xde0b6b3a7640000” in hexadecimal form, which is “1000000000000000000” in decimal form in units of Wei, which is equal to 1 MATIC, as expected!
To view the details of all the methods that Alchemy supports for Mumbai development, please read the Polygon API Documentation.
3. Alchemy Enhanced APIs
Apart from the APIs provided in the composer, there are also more Alchemy Enhanced APIs that you can use on the Mumbai testnet for building your dApp.
For instance, you may want to include Alchemy Notify/Webhooks to notify users whenever their transactions are mined and dropped or when they send or receive tokens.
You can easily create these webhooks for the Mumbai testnet on the Alchemy Notify dashboard by selecting Polygon Mumbai in the network dropdown list and adding your webhook URL.
You made it! Now you have all the knowledge you need to start developing on the Mumbai testnet. As always, if you found this documentation helpful, we would really appreciate it if you could share it with other developers in need.
At Alchemy, we are always very excited to see the amazing projects built using our platform and services. So, if you are doing cool things with Alchemy, don’t forget to tag us on Twitter @AlchemyPlatform. Happy hacking!