Deploying smart contract using Thirdweb

Introduction
This section will guide you through deploying a Marketplace contract and a corresponding NFT collection contract to Kaia Network using ThirdWeb. Thirdweb is a complete web3 development framework that provides everything you need to connect your apps and games to decentralized networks.
Marketplace contract allows users to list NFTs for direct sale or auction, thus enhancing the buying and selling of NFTs, just like it’s done on OpenSea.
By the end of this guide, you will be able to:
- create and customize contracts using thirdweb.
- compile, deploy, and interact with your smart contract using thirdweb.
Getting Started
In this article, we will explore the different means to create, customize, and deploy contracts using thirdweb, viz.
- Using the thirdweb dashboard
- Using the thirdweb CLI
For this guide, we will be demonstrating how to deploy a MarketPlace contract using the thirdweb dashboard and also deploying a corresponding nft collection to be listed on the marketplace using the thirdweb CLI.
Note: We will not be explaining the mechanics of the marketplace contract as our focus is to explore thirdweb dashboard and CLI for creating, deploying, and interacting with smart contracts.
Creating and deploying marketplace contract using thirdweb dashboard
In this section, we will create and deploy a marketplace contract using thirdweb dashboard. To do this, follow the steps below:
- Head over to thirdweb dashboard and select the MarketPlace contract from the list of contracts.

- Click Deploy Now in the contract overview dashboard.

- Configure the marketplace contract to include the following parameters: the name of the marketplace, its description, and image.

- Click Deploy Now as seen in the image above and wait for the transaction to complete.

Sau khi giao dịch được thực hiện thành công, bạn có thể xác minh việc triển khai của mình bằng cách dán địa chỉ hợp đồng vào thanh tìm kiếm của KaiaScan.
Creating and deploying an NFT collection contract using thirdweb CLI
In this section, we will create and deploy the NFT collection to be listed in our Marketplace using thirdweb CLI. To do this, follow the steps below:
Creating the contract
- Run this command in your terminal to create your contract:
npx thirdweb create --contract
-
Enter your preferred values for the command-line prompts:
i. Give your project a name.
ii. Choose your preferred framework: Hardhat or Foundry.
iii. Name your smart contract.
iv. Choose the type of base contract: Empty, ERC20, ERC721, or ERC1155. Add any desired extensions. For this tutorial, we will select ERC721 and setting the extension to none.

-
Once created, navigate to your project’s root directory and open your project in your preferred code editor.
-
If you open the contracts folder, your contract should look like this:
// SPDX-License-Identifier: MITpragma solidity ^0.8.0;import "@thirdweb-dev/contracts/base/ERC721Base.sol";contract nftcollection is ERC721Base { constructor( address _defaultAdmin, string memory _name, string memory _symbol, address _royaltyRecipient, uint128 _royaltyBps ) ERC721Base( _defaultAdmin, _name, _symbol, _royaltyRecipient, _royaltyBps ) {}}
The contract above demonstrates basic ERC721Base functionality. It imports and inherits the ERC721Base contract, and it also implements the required methods, including the constructor and its dependent parameters.
You can modify the contract to your desired custom logic, and once done, your contract is ready for deployment.