Deploy a Smart Contract on Polygon (MATIC)
Tags: polygon, evm, thirdweb, web3
Published: 2023-03-27 21:15:13

This guide will show you how to deploy any smart contract to the [Polygon](https://www.polygon.technology) network.

By the end, you'll learn how to create a simple NFT Drop smart contract, deploy it to the [Polygon Mumbai](https://thirdweb.com/mumbai?utm_source=devto&utm_medium=crosspost&utm_campaign=deploy-contract-polygon) testnet, and mint an NFT on the smart contract.

Let's get started!

## What is Polygon?

Polygon has exponentially lower (approximately ~10,000x lower) gas fees than Ethereum does, and utilises Proof-of-Stake (POS) consensus, which has a less negative impact on the environment than Proof-of-Work (POW).

Using Polygon is a great choice for all kinds of blockchain projects,especially those that require a lot of interaction with the blockchain; because of its low gas fees.

Brands such as [Instagram](https://about.fb.com/news/2022/05/introducing-digital-collectibles-to-showcase-nfts-instagram/?ref=thirdweb) and [Adidas](https://news.adidas.com/originals/adidas-originals-and-prada-announce-a-first-of-its-kind-open-metaverseuser-generated-nft-project/s/30a29dad-6ded-4302-ae40-f9f2338e7298?ref=thirdweb) have recently started using Polygon for their projects, adding credibility and a growing audience for the Polygon network.

## Create a smart contract on Polygon

To begin, head to the Contracts page in your thirdweb Dashboard and hit "Deploy new contract":

![deploy new contract](https://blog.thirdweb.com/content/images/2023/03/SCR-20230304-uu3-1-.png)

You will be taken to our [Explore](https://thirdweb.com/explore?utm_source=devto&utm_medium=crosspost&utm_campaign=deploy-contract-polygon) page — where you can browse smart contracts built by the top protocols in web3 and deploy them in just a few clicks!

_Note: You can also use the thirdweb_ [_CLI_](https://portal.thirdweb.com/cli?utm_source=devto&utm_medium=crosspost&utm_campaign=deploy-contract-polygon) _to set up a smart contract environment by running the below command from your terminal:_

_This will take you through an easy-to-follow flow of steps for you to create your contract. Learn more about this in our_ [_CLI guide_](https://blog.thirdweb.com/guides/the-ultimate-guide-to-thirdweb-cli/)_._

Otherwise, let's get back to [Explore](https://thirdweb.com/explore?utm_source=devto&utm_medium=crosspost&utm_campaign=deploy-contract-polygon):

![thirdweb explore page](https://blog.thirdweb.com/content/images/2023/03/SCR-20230309-bpg-2.png)

Here, select your smart contract of choice. For this guide, we're going to use the [NFT Drop (ERC721)](https://thirdweb.com/thirdweb.eth/DropERC721?utm_source=devto&utm_medium=crosspost&utm_campaign=deploy-contract-polygon) contract to create our NFT collection:

![thirdweb's NFT Drop Contract](https://blog.thirdweb.com/content/images/2023/03/SCR-20230304-rkv-2.png)

Set up your smart contract with an image, name, description, etc., and configure which wallet address will receive the funds from primary and secondary sales:

![Populate metadata of your contract](https://blog.thirdweb.com/content/images/2023/03/contract-metadata-2-1-1.png)

In the network/chain section select Polygon Mainnet or Polygon Mumbai (testnet) as you wish. For the sake of this guide, I am going to use Polygon Mumbai

![Select Polygon Mumbai network](https://blog.thirdweb.com/content/images/2023/03/select-mumbai-network-2.png)

Once you have selected the network, click on deploy now. It will prompt you to switch your network to Mumbai

![Switch Wallet to Polygon Mumbai Testnet](https://blog.thirdweb.com/content/images/2023/03/SCR-20230309-k6h.png)

Click on the switch Wallet button and if you don't already have the network in your wallet it will prompt you to add the network and then switch to the network:

![Switch network to Polygon Mumbai](https://blog.thirdweb.com/content/images/2023/03/add-polygon-mumbai-to-wallet-2.png)

Now let's deploy the smart contract on the Polygon Mumbai testnet! But before that, we need testnet funds.

## **Get Mumbai matic in your wallet**

Once you have added the Mumbai network to your wallet. You can either navigate there [directly](https://faucet.polygon.technology) or open the Wallet button and hit **"Request Testnet Funds"** in the thirdweb dashboard:

![Click on Request Testnet Funds from the dropdown](https://blog.thirdweb.com/content/images/2023/03/SCR-20230309-k9s.png)

This will take you to the Polygon Mumbai faucet. Here, paste your wallet address and hit submit

![](https://blog.thirdweb.com/content/images/2023/03/polygon-mumbai-faucet.png)

You will be prompted to review the details and confirm:

![Confirm the details of your request](https://blog.thirdweb.com/content/images/2023/03/confirm-details-2.png)

Once you confirm the details, funds will arrive in your wallet:

![Request for funds submitted](https://blog.thirdweb.com/content/images/2023/03/submit-request-2.png)

Once you have completed this process, you will have testnet funds in your wallet on Mumbai testnet, meaning you're now ready to deploy your smart contract!

## Deploying the contract

Now that you have your testnet ETH, let's go back to the thirdweb Dashboard where we were building our [**NFT Drop**](https://thirdweb.com/thirdweb.eth/DropERC721?utm_source=devto&utm_medium=crosspost&utm_campaign=deploy-contract-polygon) contract.

We have already filled out the metadata so click on "Deploy Now" after selecting the chain. It will prompt a transaction, you have to approve that.

![Confirm the transaction to deploy the contract](https://blog.thirdweb.com/content/images/2023/03/SCR-20230309-kko-2.png)

And you're done! You have just deployed to the Polygon Mumbai testnet.

## **Calling Smart Contract Functions**

Let's see how we can use the smart contract by calling some functions on it, such as minting an NFT into our collection!

From the `Explorer` tab, you can view all of the available functions on your smart contract and execute them directly from your connected wallet:

![Calling the Read name function from Explorer](https://blog.thirdweb.com/content/images/2023/03/contract-explorer-2.png)

### Setting Up Our NFT Collection

In our example, we created an NFT drop smart contract, so we'll quickly set it up and mint our first NFT by performing the following steps:

1. [Lazy mint](https://portal.thirdweb.com/pre-built-contracts/nft-drop?utm_source=devto&utm_medium=crosspost&utm_campaign=deploy-contract-polygon#lazy-minting-nfts) a batch of NFTs.
2. Configuring our [claim conditions](https://portal.thirdweb.com/pre-built-contracts/nft-drop?utm_source=devto&utm_medium=crosspost&utm_campaign=deploy-contract-polygon#setting-claim-phases).
3. Mint an NFT from the drop!

Once we've set up our NFTs, we can click the `Claim` button in the `NFTs` tab to mint our first NFT, and voilà! We just minted an NFT on the Polygon testnet!

![Claimed NFT](https://blog.thirdweb.com/content/images/2023/03/image-94.png)

### What's Next?

Now that you've deployed your smart contract, you can use our [SDK](https://portal.thirdweb.com/sdk?utm_source=devto&utm_medium=crosspost&utm_campaign=deploy-contract-polygon) to build a web3 application! Where users can connect their wallets and interact with the functions of your smart contracts. Learn more from our guide below:

## **Wrapping up**

In this guide, you've learned how to create a simple NFT Drop smart contract, deploy it to the [Polygon Mumbai](https://thirdweb.com/mumbai?utm_source=devto&utm_medium=crosspost&utm_campaign=deploy-contract-polygon) testnet, and mint an NFT on the smart contract. We hope it was helpful!

If you have any questions jump into the [**thirdweb Discord**](https://discord.gg/thirdweb) and join 32,000+ other builders! And if you're looking to build on Polygon and want to learn more about how to do that with thirdweb's tools, [**reach out**](https://thirdweb.typeform.com/to/ZV3gUhiP) to the team directly. Please let us know if you have any feature requests or guide requests [here](https://feedback.thirdweb.com/?utm_source=devto&utm_medium=crosspost&utm_campaign=deploy-contract-polygon).