Deploy a Smart Contract on Scroll zkEVM
This guide will show you how to deploy any smart contract to the Scroll zkEVM network.
By the end, you'll learn how to create a simple NFT Drop smart contract, deploy it to the Scroll Alpha Testnet, and mint an NFT on the smart contract.
Let's get started!
What is Scroll zkEVM?
Scroll zkEVM is a layer two network built to address the scalability issues of the Ethereum mainnet, such as the transactions per second and gas fees.
The "EVM" is the Ethereum Virtual Machine; responsible for storing the state, transactions, and smart contracts of the Ethereum network. "ZK" refers to the fact that it is a zero-knowledge roll-up, meaning it creates bundles or "rolls up" batches of transactions together and executes them off-chain (i.e., not on the EVM).
Zero-knowledge proofs can cryptographically prove the result of these transactions occurring with a validity proof sent to finalize transactions on the blockchain.
Create a smart contract on Scroll zkEVM
To begin, head to the Contracts page in your thirdweb Dashboard and hit Deploy Contract:
You will be taken to the thirdweb 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:
Here, select your smart contract of choice. For this guide, we're going to use the NFT Drop (ERC721) 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:
Our smart contracts are deployable to any EVM chain, so let's deploy this to the Scroll Alpha Testnet!
Add the Scroll Alpha Testnet to your dashboard & wallet
To deploy a smart contract to Scroll we first need to add it as a network to the Dashboard.
To do this, click on the network button, and switch to the testnets tab. Now, search for "Scroll" and select Scroll Alpha Testnet:
It will now prompt you to add and switch to Scroll Alpha Testnet:
We can now see that the network has been added and we can deploy it to it now.
But wait! We don't have funds to deploy it yet, so, let's bridge some Goerli ETH to Scroll Alpha Testnet.
Get Scroll Alpha testnet funds in your wallet
Once you have added the Scroll Alpha Testnet to your wallet. Head over to the Scroll Bridge and bridge some Goerli ETH to Scroll Alpha Testnet.
Once you have entered how much you want to bridge, click on Send ETH to Scroll Alpha Testnet
The funds have now started to bridge, wait for some time while the transaction goes through. Once you have completed this process, you will have testnet funds in your wallet, meaning you're now ready to deploy your smart contract!
Deploy a smart contract to the Scroll blockchain
Now that you have your testnet ETH, let's go back to the thirdweb Dashboard where we were building our NFT Drop contract.
ZWe have already filled out the metadata so click on "Deploy Now" after selecting the chain. It will prompt you to two transactions, you have to approve them.
And you're done! You have just deployed to the Scroll zkEVM Alpha 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 NFT drop smart contract, so we'll quickly set it up and mint our first NFT by performing the following steps:
- Lazy mint a batch of NFTs.
- Configuring our claim conditions.
- 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 Scroll zkEVM Alpha Testnet!
What's Next?
Now that you've deployed your smart contract, you can use our SDK 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:
Need help?
For support, join the official thirdweb Discord server or share your thoughts on our feedback board.