Skip to content

Latest commit

 

History

History
78 lines (55 loc) · 3.25 KB

README.md

File metadata and controls

78 lines (55 loc) · 3.25 KB

purple-ice-lite

A NFT trading market on a local blockchain.

Demo Video

简体中文

Introduction

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

How to run

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:

  1. Clone this repository to your local machine: git clone https://github.com/wbxl2000/purple-ice-lite

  2. Navigate to the chain directory in the project and install the dependencies: cd .\purple-ice-lite\chain\ && yarn.

  3. Run the local blockchain: yarn hardhat node. If the operation is successful, the address and private key of the test account will be output.

  4. 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.

  5. Configure MetaMask.

    • Add network: Fill in the network name as hardhat. The RPC address is http://127.0.0.1:8545/. The chain ID is 31337, and the currency is ETH.
    • 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.
  6. 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

  7. 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.

How to develop

If you want to learn more, you can check the contents of the tutorial written for this project in tutorial.md.

License

This project is licensed under the MIT license.