How to Deploy Smart Contracts on Mantle Using thirdweb

How to Deploy Smart Contracts on Mantle Using thirdweb

This guide will show you how to deploy smart contracts to the Mantle network.

By the end, you'll learn how to create a simple Edition Drop smart contract, deploy it to the Mantle Testnet, and mint an NFT on the smart contract.

Let's get started!

What is Mantle?

Mantle represents a cutting-edge Ethereum Layer 2 network designed for optimal performance and modularity. It seamlessly integrates an Ethereum rollup with a decentralized data availability layer, offering an impressive throughput for dApps. Users can enjoy the benefits of low fees, enhanced security, and swift transaction times.

Mantle embodies Ethereum's ecosystem and principles, showcasing alignment with its values. It is a community-owned and governed blockchain, fully compatible with the Ethereum Virtual Machine (EVM). Mantle is open, permissionless, and boasts exceptional developer support.

Create a smart contract on Mantle

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

deploy new contract

You will be taken to thirdweb's Explore 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 to set up a smart contract environment by running the below command from your terminal:

npx thirdweb create contract

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.

Otherwise, let's get back to Explore:

thirdweb explore page

Here, select your smart contract of choice. For this guide, we're going to use the Edition Drop (ERC1155) contract to create our NFT collection:

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:

In the network/chain section select Mantle or Mantle Testnet as you wish. For the sake of this guide, I am going to use Mantle Testnet

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:

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

Get Mantle Testnet funds in your wallet

Once you have added the Mantle Testnet to your wallet. You can either navigate there directly click on "Get MNT from faucet" when you click Deploy Now:

This will take you to the Mantle faucet. Here, authenticate your twitter account and mint some test tokens.

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

Deploying the contract on Mantle

Now that you have your testnet funds, let's go back to the thirdweb Dashboard where we were building our Edition Drop 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.

And you're done! You have just deployed to the Mantle 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:

Setting Up Our NFT Collection

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

  1. Lazy mint some NFTs.

  2. Configuring the claim conditions.

  3. Mint an NFT from the drop!

Once we've set up our NFTs, we can click the Transfer, Airdrop, Burn or Mint the NFTs.

What's Next?

Now that you've deployed your smart contract, you can this smart contract to build a web3 application! Where users can connect their wallets and interact with the functions of your smart contracts. You can also use the thirdweb SDK for this purpose or use any other method of your choice to build a beautiful frontend.

Wrapping up

In this guide, you've learned how to create a simple Edition Drop smart contract, deploy it to the Mantle Testnet, and mint an NFT on the smart contract. I hope it was helpful!

Need help?

Drop all your queries down below, I will try my best to help you out!