This project is a blockchain-based token exchange application built during the Dapp University Bootcamp. Demonstrating how to create, deploy, and interact with Ethereum smart contracts.
This application includes:
- A custom ERC-20 token smart contract (DAPPU)
- Smart contract testing with Hardhat
- React frontend for interacting with the blockchain
- Integration with MetaMask for wallet connectivity
Before getting started, make sure you have:
- Node.js (v14+ recommended)
- npm (comes with Node.js)
- MetaMask browser extension
- Basic knowledge of JavaScript, React, and blockchain concepts
-
Clone this repository
-
Install dependencies:
To check if node is installed:
node -vIf not installed:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bashRun:
nvm -vIf not installed:
Since macOS 10.15, the default shell is zsh and nvm will look for .zshrc to update, none is installed by default. Create one with
touch ~/.zshrcand run the install script again. Rerun:curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bashUse nvm to install the latest LTS release of Node.js
nvm install --ltsTo install a specific version:
nvm install x.xx.xex: nvm install 8.16.2Example to set the default version of node to use when starting a new shell to 10.0.0:
nvm alias default 10.0.0> nvm alias 20.10To see the entire list of Node.js versions available to install, enter the following:
nvm ls-remoteTo select a version:
nvm use xx>ex=: nvm use 22To upgrade npm to the latest version:
npm install npm --global -
Create a
.envfile in the root directory with your private keys and API keys:PRIVATE_KEYS=your_private_key ALCHEMY_API_KEY=your_alchemy_api_key ETHERSCAN_API_KEY=your_etherscan_api_key
To start new project:
-
mkdir 'hardhat_example'
-
cd 'hardhat_example'
-
npm init --yescreates 'package.json' -
npm install --sav-dev hardhat -
npx hardhatto create new projectselect "no" to installing dependencies
if selected "yes" , delete 'package-lock.json' & 'node_modules' directories
-
{ "name": "hardhat_example", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", "license": "ISC", "devDependencies": { "@nomiclabs/hardhat-ethers": "^2.0.6", "@nomiclabs/hardhat-waffle": "^2.0.3", "chai": "^4.3.6", "ethereum-waffle": "^3.4.4", "ethers": "^5.6.8", "hardhat": "^2.9.7" } } -
After updating 'package.json' , rerun:
npm install -
Added
require("@nomiclabs/hardhat-waffle");/** @type import('hardhat/config').HardhatUserConfig */ module.exports = { solidity: "0.8.19", networks: { localhost: {} }, };changing line 1: require("@nomicfoundation/hardhat-toolbox"); to "@nomiclabs/hardhat-waffle"
To create ABI - json description of smart contract & byte code - human readable code --> machine code for EVM
npx hardhat compile
npx hardhat test
npx hardhat node
npx hardhat run scripts/1_deploy.js --network localhost
or
npx hardhat run --network localhost ./scripts/1_deploy.js
npx hardhat run scripts/1_deploy.js --network sepolia
npx hardhat verify --network sepolia <contract address> <constructor args>
Ex: > npx hardhat verify --network sepolia “Dapp University” “DAPPU” “1000000”
This project was bootstrapped with Create React App. To create react app:
npx create-react-app blockchain-developer-bootcamp --use-npm
Modify app.js file in "src" directory to see reflected changes
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.
The page will reload when you make changes.
You may also see any lint errors in the console.
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
Note: this is a one-way operation. Once you eject, you can't go back!
If you aren't satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
You don't have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
You can learn more in the Create React App documentation.
To learn React, check out the React documentation.
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
/: Test to make ensure VScode UI source control working again after ggshield pre-commit "command not found"