Deploy a Smart Contract on the Linea testnet

Deploy a Smart Contract on the Linea testnet

This guide will show you how to deploy any smart contract to the Linea network.

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

Let's get started!

What is the Linea Blockchain?

Linea is a type 2 zero knowledge Ethereum Virtual Machine (zkEVM). A zkEVM replicates the Ethereum environment as a rollup and allows developers to build on it as they would on Ethereum mainnet. Linea allows you to deploy any smart contract, use any tool, and develop as if you're building on Ethereum. For users, this enables the experience and security guarantees of Ethereum, but with lower transaction costs.

Create a smart contract on Linea

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

deploy new 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:

thirdweb explore page


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's NFT Drop Contract

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

Our smart contracts are deployable to any EVM chain, so let's deploy this to the Linea Testnet!

Add the Linea Testnet network to your dashboard & wallet

To deploy a smart contract to Linea we first need to add it as a network to the Dashboard.

To do this, click on the chain dropdown.

Search for "Linea" and select Linea Testnet:

Search for "Linea" and select Linea Testnet

Once you have selected the network. This will prompt you to switch your network to Linea Testnet.

Switch to linea testnet

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

Get Linea testnet ETH in your wallet

Once you have added the Linea Testnet to your wallet. Navigate to the bridge and Connect your wallet.

💡
If you do not have any Goerli ETH, you can use Goerli Faucet or Paradigm Faucet.

Once you have connected your wallet you will be able to bridge funds:

Bridge funds from Goerli to Linea

Click on send and wait for a while for the transaction to go through

Transaction processing

Finally, once the transaction goes through you will see the funds in your wallet

Funds transferred from Goerli to Linea

Deploy a smart contract to the Linea blockchain

Now that you have your Linea ETH, let's go back to the thirdweb Dashboard where we were building our NFT Drop contract.

We 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.

Confirm the transaction to deploy the contract

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

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 Linea testnet!

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


Need help?

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