Hardhat is a development environment to compile, deploy, test, and debug your smart contract.
There are a few technical requirements before we start. Please install the following: Requirements:
There are a few technical requirements before we start. Please install the following: Requirements:
Windows, Linux, or Mac OS X
First, you need to create an empty project npm init --yes
Once your project is ready, you should run
It's recommended to install some dependencies.
To use your local installation of Hardhat, you need to use npx
to run it (i.e. npx hardhat
).
To create your Hardhat project run npx hardhat in your project folder:
Initialize your project:
Once this project is initialized, you'll now have a project structure with the following items:
contracts/: Directory for Solidity contracts
scripts/: Directory for scriptable deployment files
test/: Directory for test files for testing your application and contracts
hardhat-config.js: Hardhat configuration file
You can write your own smart contract or download the ERC20 token smart contract template.
Go to hardhat.config.js
Update the config
Note
It requires a mnemonic to be passed in for Provider, this is the seed phrase for the account you'd like to deploy from. Create a new .secret
file in the root directory and enter your 12-word mnemonic seed phrase to get started. To get the seed words from metamask wallet you can go to Metamask Settings, then from the menu choose Security and Privacy where you will see a button that says reveal seed words.
To compile a Hardhat project, change to the root of the directory where the project is located and then type the following into a terminal:
Run this command at root of the project directory:
Remember your address, transaction_hash and other details provided would differ, Above is just to provide an idea of structure.
Congratulations! You have successfully deployed ERC20 Smart Contract. Now you can interact with the Smart Contract.
You can check the deployment status here: https://scan.bosagora.org or https://testnet-scan.bosagora.org
Three deploy methods are described in this section.
There are a few technical requirements before we start. Please install the following: Requirements:
Windows, Linux, or Mac OS X
Recommendations for Windows
If you're running Truffle on Windows, you may encounter some naming conflicts that could prevent Truffle from executing properly. Please see the section on resolving naming conflicts for solutions.
Once we have those installed, we only need one command to install Truffle:
To verify that Truffle is installed properly, type truffle version
on a terminal. If you see an error, make sure that your npm modules are added to your path.
The first step is to create a Truffle project. We'll use the *MegaCoin as an example, which creates a token that can be transferred between accounts:
To initialize your project use the following command
Once this operation is completed, you'll now have a project structure with the following items:
contracts/: Directory for Solidity contracts
migrations/: Directory for scriptable deployment files
test/: Directory for test files for testing your application and contracts
truffle-config.js: Truffle configuration file
You can write your own smart contract or download the ERC20 token smart contract template.
To compile a Truffle project, change to the root of the directory where the project is located and then type the following into a terminal:
Go to truffle-config.js
Update the truffle-config
Notice, it requires a mnemonic to be passed in for Provider, this is the seed phrase for the account you'd like to deploy from. Create a new .secret file in the root directory and enter your 12-word mnemonic seed phrase to get started. To get the seed words from Metamask wallet you can go to Metamask Settings, then from the menu choose Security and Privacy where you will see a button that says reveal seed words.
Run this command the root of the project directory:
A contract will be deployed on Agora(BizNet) Testnet, it looks like this:
Remember your address, transaction_hash and other details provided would differ, Above is just to provide an idea of structure.
Congratulations! You have successfully deployed ERC20 Smart Contract. Now you can interact with the Smart Contract.
You can check the deployment status here: https://scan.bosagora.org or https://testnet-scan.bosagora.org
Deploys a ERC20 smart contract with a message, and renders it in the front-end. You can interact with the smart contract easily!
Remix is an online IDE to develop smart contracts.
You need to choose Solidity Compiler and Deploy and Run Transactions.
Go to File Explorers, And Create a new file, Name it ERC20Token.sol
Copy/Paste the Smart contract below into the newly created file ERC20Token.sol
Modify "TOKEN_NAME", "TOKEN_SYMBOL", "DECIMALS" and "TOTAL_SUPPLY" according to your requirements.
Step1: Click the button to switch to compile page
Step2: Select the "ERC20Token" contract
Step3: Enable "Auto compile" and "optimization"
Step4: Click "ABI" to copy contract ABI and save it.
Now, We have to deploy our smart contract on BizNet Network. For that, we have to connect to web3 world, We will be using Metamask.
Copy your address from Metamask
Now, let's Deploy the Smart Contract on Testnet
Select "Injected Web3" in the ENVIRONMENT dropdown and your contract
Metamask accepts the Connection Request!
From the CONTRACT dropdown menu, select the ERC20Token.sol you created earlier.
Click the Deploy button in Remix and accept another Metamask popup that requires transaction confirmation once connected!
This dApp implements a "Hello World" style application that echoes a message passed to the contract to the front end. This tutorial is intended to be followed using the online IDE available at .
Create a new contract ERC20Token.sol and copy the contract code from the ERC20 token template
In the first line, pragma solidity ^0.8.0
specifies that the source code is for a Solidity version greater than 0.8.0. are common instructions for compilers about how to treat the source code (e.g., pragma once).
A contract in the sense of Solidity is a collection of code (its functions) and data (its state) that resides at a specific address on the Ethereum blockchain. Learn more about the and in the docs.
Head over to Faucet - and request test BOA
Congratulations! You have successfully deployed an ERC20 Contract. Now you can interact with the Smart Contract. Check the deployment status here: