Skip to content

This is a project learning to write a simple smart contract and deploy it to local and testnet.

Notifications You must be signed in to change notification settings

Shih-Yu/Greetings-Dapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Greetings - Dapp

This is a project to learn about writing a simple smart contract using Solidity and using Hardhat's sample project template, deploying it on local and testnet as well as testing with it

Table of contents

Technologies

Setup

  1. Create a directory

  2. cd into that directory and run $ npx create-react-app [project name]

  3. Install project dependencies

$ npm i -D hardhat ethers chai dotenv @nomiclabs/hardhat-ethers @nomiclabs/hardhat-waffle
  1. Create a hardhat project by running
 $ npx hardhat
  1. Select > Create simple project option

Instructions

Config

  • Go to hardhat.config.js

  • Updade Solidity to proper version

  • Set artifacts path in src when project is compiled

paths: {
    artifacts: "./src/artifacts",
  },
  • Configure local network for local testing
networks: {
    hardhat: {
      chainId: 1337,
    },
  • Create .env file in root directory and add dotenv dependency in config file

Compile Contract

$ npx hardhat compile

Deploy (localhost)

  • Generate hardhat local testing enviroment
npx hardhat node

$ npx hardhat run scripts/deploy.js --network localhost

Deploy (testnet)

  • Generate hardhat local testing enviroment
$ npx hardhat node

$ npx hardhat run scripts/deploy.js --network [testnet name]

Connect Metamask

  • Import local testing accounts to metamask using private key or get currency from testnet facuet and connect to testnet

React

  • Connect to react
$ npm start

About

This is a project learning to write a simple smart contract and deploy it to local and testnet.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published