Deploy a smart contract on Base testnet

Deploy a smart contract on Base testnet (Coinbase L2)  - thirdweb Guides

This guide will show you how to deploy any smart contract to Base network — an Ethereum L2 network incubated by Coinbase.

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":

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:

thirdweb explore page

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:

thirdweb NFT Drop Contract

Hit the "Deploy now" button and configure your smart contract:

Add metadata for the 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:

Configure Networks

Search for "Base Goerli" and select it:

Search for base goerli

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.

Metadata of the Base Goerli Network

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:

  1. 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
  2. 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:

Request Testnet Funds

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:

Base Goerli ETH Faucet | Coinbase
Base Goerli ETH Faucet | Coinbase

This will take you into the Coinbase Wallet interface. Click "Approve" in the first screen and then "Sign" in the next:

Sign in using the Coinbase wallet

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":

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:

Eth sent successfully

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:

Switch network to Base Goerli
💡
Note: This will only work if you are currently on the browser window for a dApp you're connected to — like Coinbase's faucet or the thirdweb Dashboard.

From here, go to the Testnets tab in your wallet and you'll see your Base Goerli ETH is now there:

Testnets in Coinbase Wallet

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:

Base bridge

Select "Injected Wallet":

Connect wallet to Base Bridge

This will prompt you through a flow to add the network to your wallet. Click Approve and switch network:

Approve and switch to Base Goerli network

From here, bridge your Goerli funds to Base Goerli:

Bridge Goerli funds to Base Goerli
💡
If you don't have any Goerli ETH, you can get some from Alchemy's faucet — or if you have a Coinbase Wallet, get Base Goerli directly from Coinbase's faucet and you won't have to bridge.

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":

Switch network to 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:

Switch Wallet 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.

💡
If you bridged your funds through the Base Bridge, you will already have the Base testnet in your wallet.

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.

Deploy Now

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!

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

Use the explorer to execute functions on your smart contract.

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 a batch of NFTs.
  2. Configuring our claim conditions.
  3. Mint an NFT from the drop!
💡
We won't go into too much detail about this process in this guide, check out our other NFT Drop Guides for more information!

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!

Click the "Claim" button to mint your NFT.

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:

Learn how to build a web3 app to interact with your smart contract

Wrapping up

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!


Need help?

For support, join the official thirdweb Discord server or share your thoughts on our feedback board.