Getting Started with Web3Task
Running Web3Task locally
In this tutorial, we'll go over how to:
Clone the necessary repositories from GitHub
Installing dependencies
Setting up a local blockchain
Deploying the smart contract to the local blockchain
Running the frontend
Prerequisites
Cloning the necessary repositories
Clone the web3task-contracts and web3task-frontend repositories from GitHub into a local directory
Install dependencies
Go to each directory and run the commands to install the dependencies
NOTE When choosing between NPM and Yarn for your project, it's generally recommended to stick with the package manager you started with. If you initially used NPM, it's best to continue using NPM for any future package installations. Likewise, if you began with Yarn, it's best to stick with Yarn for future package installations. This helps to maintain consistency and avoid potential conflicts between the two package managers.
Setting Up Local Blockchain
Run a Hardhat node to start a local blockchain.
The node will generate some accounts. You can realize they are already set at .env.sample, you should just let it be.
Add the first one to Metamask to be the leader and the second to be the member. The account will be:
To add the localhost network to metamask, click on the network dropdown and select Custom RPC
. Fill in the following fields:
Network Name:
localhost
New RPC URL:
http://localhost:8545
Chain ID:
31337
Currency Symbol:
ETH
NOTE Use the recommended accounts to avoid errors.
Deploying Smart Contracts in the Localhost
Makefile will set everything for us, just run:
Run the frontend
Go to the web3task-front
folder and run the commands below
NOTE You must manually add the typescript package to the project in case the module fails to install using yarn.
Usage
If you are not using livenet, you should comment chain configurations at hardhat.config.ts
or mock the keys in the .env
file, otherwise you will get an error from hardhat.
To run all the unitary tests, run:
See the demo below to understand how to use the Web3Task
Last updated