Deploy a smart contract on Base testnet (Coinbase L2)
This guide will show you how to deploy any smart contract to the Base network — Coinbase's modular, rollup agnostic superchain.
By the end, you'll learn how to create a simple NFT collection smart contract using Solidity, deploy it to the Base Goerli testnet, and mint an NFT on the smart contract.
Let's get started!
What is Base by Coinbase?
Base is an Ethereum Layer 2 (L2) network offering a secure, low-cost, developer-friendly way to build decentralized apps onchain — serving as the home for Coinbase's onchain products and an open ecosystem for anyone to build in.
Base is built on Optimism's OP Stack, and aims to become a standard, modular, rollup agnostic Superchain. Initially, Base will be incubated inside of Coinbase & become progressively more decentralized over time.
Like other Layer 2 networks, Base is built to address the scalability issues of the Ethereum mainnet, like high gas fees and throughput speed (transactions per second).
Create a smart contract on the Base Goerli testnet
We are now ready to create & deploy a smart contract to the Base Goerli testnet. To do this, head to the Contracts page in your thirdweb Dashboard and hit "Deploy new contract":
You will be taken to our Explore page — where you can browse smart contracts built by the top protocols in web3 and deploy them to the Base Goerli testnet 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:
In 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:
Hit the "Deploy now" button and configure your smart contract:
Fill all of the above out. Our smart contracts are deployable to any EVM chain, so let's deploy this to the Base Goerli testnet!
Add the Base Goerli network to your dashboard & wallet
To deploy a smart contract to Base (more specifically, to the Base Goerli testnet that is currently available, with mainnet coming soon) we first need to add it as a network to the Dashboard.
To do this, click the
Configure Networks button here:
Search for "Base Goerli" and select it:
It will now auto-fill all the details required. You can upload an icon for the Testnet if you like and use a custom RPC you can use that as well.
Click on "Add Network" and voilá! You will now see that Base Goerli has been added to the Testnets section of the Your Networks module:
Now let's deploy the smart contract on the Base Goerli testnet! But before that, we need testnet funds.
Get Base Goerli ETH testnet funds in your wallet
To get testnet funds and use the Base Goerli network, there are two options:
- Get Base Goerli ETH directly from Coinbase's Faucet if you have a Coinbase wallet (which you can also create easily or import your existing wallet to in the linked page) - recommended
- Bridge regular Goerli ETH to Base Goerli ETH through Coinbase's Base Bridge if you have some, or if you don't have a Coinbase wallet)
Option 1: Get Base Goerli ETH directly from Coinbase's Faucet
The easiest option to get Base Goerli ETH into your wallet is to do it directly from Coinbase's Base Goerli faucet! For this, you will need to have the Coinbase Wallet Chrome extension installed, which you can get here.
Once you have that installed and have either 1) created a new wallet, or 2) imported an existing wallet, you will then be able to use the Base Goerli faucet. You can either navigate there directly or open the Wallet button and hit "Request Testnet Funds" in the thirdweb dashboard:
This will take you to the Base Goerli ETH faucet. Here, you can either install a Coinbase Wallet or if you've already done so, just hit the "Connect with Coinbase Wallet" button:
This will take you into the Coinbase Wallet interface. Click "Approve" in the first screen and then "Sign" in the next:
Finally, make sure the wallet address in the faucet is correct (it will automatically use the one you're connected with) and click "Request Ethereum Goerli":
And you're all set! You should now get a transaction hash & confirmation that you've been sent 0.15 Base Goerli ETH to your wallet:
Now go into your Coinbase Wallet and ensure you're on the Base Goerli network. If you're on the Ethereum network, click the top right Ethereum icon and switch to Base Goerli:
From here, go to the Testnets tab in your wallet and you'll see your Base Goerli ETH is now there:
You can also quickly verify this if you're connected to the thirdweb Dashboard — simply check the Wallet module in the top right corner (this will update based on which network you're connected to:
Once you have completed this process, you will have testnet funds in your wallet on the Base Goerli testnet, meaning you're now ready to deploy your smart contract! You can skip Option 2 and go directly to the next section.
Option 2: Bridge Goerli ETH to Base Goerli ETH through Coinbase's Base Bridge
Head over to Coinbase's Base Bridge and connect your wallet of choice. Since you're most likely going through this flow because you don't have a Coinbase Wallet, we're using MetaMask wallet here:
Select "Injected Wallet":
This will prompt you through a flow to add the network to your wallet. Click Approve and switch network:
From here, bridge your Goerli funds to Base Goerli:
Once you have completed this process, you will have testnet funds in your wallet on the Base Goerli testnet, meaning you're now ready to deploy your smart contract!
Deploy a smart contract on the Base Goerli testnet
Now that you have your Base Goerli testnet ETH, let's go back to the thirdweb Dashboard where we were building our NFT Drop contract.
Once all of your contract parameters are filled out, open the drop-down menu in the Network / Chain section and select "Base Goerli":
If it doesn't show up, you can also hit the "Configure Networks" button in here.
Once ready, hit "Deploy Now" and switch your wallet's network to Base Goerli:
It will prompt you to add the network to your wallet if you haven't already. Click on approve and switch network.
Finally, click the
Deploy Now button and approve the transaction! Once the transaction goes through, you can use it just like any other smart contract.
And you're done! You have just deployed to the Base Goerli 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!
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 Base testnet!
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:
Coinbase's new Base L2 is a powerful and exciting Layer 2 that improves Ethereum's scalability as a modular, rollup agnostic chain. With thirdweb, you can seamlessly deploy smart contracts to any EVM-compatible chain, including Layer 2's such as Base.
In this guide, you've learned how to create a simple NFT collection smart contract using Solidity, deploy it to the Base Goerli testnet, and mint an NFT on the smart contract. We hope it was helpful!
If you have any questions jump into the thirdweb Discord and join 32,000+ other builders! And if you're looking to build on Base and want to learn more about how to do that with thirdweb's tools, reach out to the team directly.