ThirdWeb
Learn how to deploy a smart contract using thirdweb's command line interface.
This tutorial walks through creating and deploying a smart contract using thirdweb's command line interface.
Alternatively, you can deploy a prebuilt contract for NFTs, tokens, or marketplace directly from the thirdweb Explore page:
- Go to the thirdweb Explore page: https://thirdweb.com/explore
- Choose the type of contract you want to deploy from the available options: NFTs, tokens, marketplace, and more.
- Follow the on-screen prompts to configure and deploy your contract.
For more information on different contracts available on Explore, check out thirdweb's documentation.
Creating Contracts
To create a new smart contract using thirdweb CLI, follow these steps:
-
In your CLI run the following command:
-
Input your preferences for the command line prompts:
- Give your project a name.
- Choose your preferred framework: Hardhat or Foundry.
- Name your smart contract.
- Choose the type of base contract: Empty, ERC20, ERC721, or ERC1155.
- Add any desired extensions.
-
Once created, navigate to your project's directory and open in your preferred code editor.
-
In the
contracts
folder, you will find the smart contract written in Solidity.The following is code for an ERC721Base contract without specified extensions. It implements all of the logic inside the
ERC721Base.sol
contract; which implementsERC721A
standard.This contract inherits functionality of ERC721Base through following steps:
- Importing the ERC721Base contract.
- Inheriting the contract by declaring that our contract is an ERC721Base contract.
- Implementing any required methods such as constructor.
-
After modifying your contract with your desired custom logic, you may deploy it on Avalanche with the following command:
Deploying Contracts
Deploy allows you to deploy a smart contract to any EVM compatible network without configuring RPC URLs, exposing your private keys, writing scripts, and other additional setup such as verifying your contract.
-
To deploy your smart contract using
deploy
, navigate to the root directory of your project and execute the following command:Executing this command will trigger the following actions:
- Compiling all the contracts in the current directory.
- Providing the option to select which contracts you wish to deploy.
- Uploading your contract source code (ABI) to IPFS.
-
When it is completed, it will open a dashboard interface to finish filling out the parameters.
_name
: contract name_symbol
: symbol or "ticker"_royaltyRecipient
: wallet address to receive royalties from secondary sales_royaltyBps
: basis points that will be given to royalty recipient for each secondary sale. For example: 500 = 5%.
-
Select "Avalanche" as the network.
-
Manage additional settings on your contract's dashboard as needed such as uploading NFTs, configuring permissions, and more.
For additional information on deploying smart contracts with thirdweb, please reference thirdweb's documentation.
If you have any further questions or encounter any issues during the process, please reach out to thirdweb support at support.thirdweb.com.
Last updated on