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
mkdir web3task
cd web3task
git clone https://github.com/w3b3d3v/web3task-front.git
git clone https://github.com/w3b3d3v/web3task-contracts.git
Install dependencies
Go to each directory and run the commands to install the dependencies
cd web3task-contracts
yarn
or
npm i
cd web3task-front
yarn
or
npm i
Setting Up Local Blockchain
Run a Hardhat node to start a local blockchain.
cd web3task-contracts
npx hardhat node
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:
0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
0x70997970C51812dc3A010C7d01b50e0d17dc79C8
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
Deploying Smart Contracts in the Localhost
Makefile will set everything for us, just run:
make mocks
Run the frontend
Go to the web3task-front
folder and run the commands below
yarn start
or
npm start
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:
yarn test
See the demo below to understand how to use the Web3Task
Last updated