A NFT trading market on a local blockchain.
purple-ice-lite is a mini NFT trading market that runs on a local blockchain and can perform Connect wallet, Mint, Sale, and Buy operations. It includes
- Local blockchain
- Two smart contract source codes, testing and deployment
- A native JS-written DApp
- A tutorial that teaches you how to develop step-by-step
It is hoped that it can help you:
- Get started with writing NFT smart contracts
- Understand the transaction process of NFT
- Start developing DApp applications
You can deploy and run this project locally quickly according to the guidelines in this section.
Directory structure:
.
├── chain -- Contains a local blockchain (hardhat-CLI), smart contracts (code, testing, deployment)
├── webapp -- Front-end application (DApp) for NFT Marketplace
├── README.md
└── tutorial.md
Steps:
-
Clone this repository to your local machine:
git clone https://github.com/wbxl2000/purple-ice-lite
-
Navigate to the
chain
directory in the project and install the dependencies:cd .\purple-ice-lite\chain\ && yarn
. -
Run the local blockchain:
yarn hardhat node
. If the operation is successful, the address and private key of the test account will be output. -
Keep the local blockchain running, open a new terminal, navigate to the
chain
directory, and deploy the contract:
yarn hardhat run .\scripts\deploy_BadgeToken.ts --network localhost
yarn hardhat run .\scripts\deploy_Marketplace.ts --network localhost
The address generated after successful deployment is used in
./webapp/logic.js
The generated ABI is imported in./webapp/index.html
If the contract has not been modified in the previous step, it will be automatically imported. -
Configure MetaMask.
- Add network: Fill in the network name as
hardhat
. The RPC address ishttp://127.0.0.1:8545/
. The chain ID is31337
, and the currency isETH
. - Import account: Import using private key. The private key will be output in the terminal when running the local blockchain. The account used to deploy the contract is
Account #0
.
- Add network: Fill in the network name as
-
Navigate to the
webapp
directory:cd ../webapp
, and run anywhere or other web static services, such as Go Live.The command for running anywhere quickly is:
yarn add anywhere && yarn anywhere
-
Access purple-ice-lite in your browser. After connecting the wallet, mint an initial NFT, and then it is recommended to open two browser tabs to simulate Sale or Buy.
If you want to learn more, you can check the contents of the tutorial written for this project in tutorial.md.
This project is licensed under the MIT license.