Using Hardhat
Setting up and launching an DRC20 Token Smart Contract on the Deelance Testnet using Hardhat.
Using Hardhat
What is Hardhat ?
Hardhat is a popular development framework and tool suite designed for building, testing, and deploying smart contracts and decentralized applications (DApps) on blockchain platforms. Like Truffle, Hardhat streamlines the development process and provides a range of features to aid developers in working with blockchain technologies.
Configuring the Development Workspace
Before we dive in, ensure you have the following essentials installed: Requirements:
Windows, Linux or Mac OS X
Initialize Project
Our first task is to set up a Hardhat project.
Create a new directory for your Hardhat project
mkdir PepeDeelance
cd PepeDeelanceNext, execute
npm init -yto generate a package.json file.Afterward, install Hardhat with the following command:
npm install --save-dev hardhatNow, If you run npx hardhat, you will be shown some options to facilitate project creation:
We recommend selecting the option "Create a JavaScript project."
After selecting the "Create a JavaScript project" option, you will be prompted to install the following dependencies.
Finally, the Hardhat project is initialized.
To initially familiarize yourself with the available features and the current status, execute npx hardhat within your project directory. This will produce the following output in the terminal:
The things you can do are shown in a list. Some are already there, and some come when you add extra tools/packages. Learn More.
After initialization, your Hardhat project's folder structure will look like this.
Create an DRC20 Token Contract on Deelance Testnet using Hardhat.
Make a file named "PepeDeelance.sol" in the "contracts/" folder of your project.
Copy and paste the code provided below.
Now, in your terminal, run the command
npx hardhat compile, This will compile the contracts located in the "contracts/" folder.Once the contract compiles without errors, generate a
deploy.jsfile within thescripts/directory and insert the following code:
Next, copy the following code into the
hardhat.config.jsfile.
Deploying on Deelance Testnet
We're now set to deploy our Smart Contract on the Deelance Testnet. To proceed with the deployment, execute the following command in your terminal:
Executing this will produce an output in the terminal similar to the following:
Keep in mind that your address, transaction_hash, and other details might vary. The above is merely an illustration of the expected structure.
Well done! You've successfully deployed the PepeDeelance DRC20 Token Smart Contract. You can now engage with the Smart Contract.
Last updated