Giter Club home page Giter Club logo

nftpawnshopsmartcontract's Introduction

NFT Pawning Shop

This application is for people who own some NFT token, they need money but don't want to sell their's token, they can list the token in our application as collateral, and other users can give them a loan. So, the borrower got the money, their token is locked in our smart contract. When the time of repayment comes in, the borrower has to pay the original money plus interest to the lender, if they are not, then the token will be transferred to the lender.

Run project

1. Install Metamask

1.1 Install Metamask extension in Chrome here
1.2 After that, create an account.
Remember to keep the mnemonic of your accounts in secret.
Mnemonic contains 12 words and it look like: jealous expect hundred young unlock disagree major siren surge acoustic machine catalog
We gonna need this mnemonic when create workspace in Ganache\

2. Install Ganache

2.1 Install Ganache here
2.2 Start Ganche UI
Ganache UI
2.3 Choose New Workspace
2.4 Fill in the information

Just fill workspace name, and then switch to tab Account & Key and fill in the mnemonic you got from step 1.
2.5 Save workspace
Now you got an new workspace in Ganache, and all the accounts you see on the UI are the same with accounts in Metamask wallet.
\

Remember the Network ID and RPC Server, because we gonna need it later.
So this Ganache server is running on host http://127.0.0.1 and port 7545.\

3. Connect Metamask to Ganache

3.1. Click on Metamask icon in Chrome
3.2. Click button to show all availabe networks

So, our Ganache network is just like Ethereum but it run on local machine, now we want to add our network to Metamask.
3.2. Click on Custom RPC
3.3. Fill in information like bellow

3.4. Finally connect to Ganache\

4. Deploy smart contract to Ganache

4.1. Go to /solidity folter
4.2. Run command npm install
4.3. Run command truffle migrate --network ganache --reset
4.4. You can view some information about the smart contracts in Contracts tab.
Do you see the address of the PawningContract, keep it, because we need it in the later step.
\

5. Install Go

Go here\

6. Run api

6.1 Go to /api folder
6.2 Run command go get . to install packages
6.3 Update mongodb uri in app.env
6.4 Run command go run .\

7. Run event listener

7.1 Go to /event_listener folder
7.2 Run command go get . to install packages
7.3 Update address of PawningShop contract to app.env, because your contract address is changed when deployed
7.4 run command go run .\

8. Run UI

8.1 Go to /client folder
8.2 Run command npm install
8.3 Run command npm run serve\

nftpawnshopsmartcontract's People

Contributors

khanh1998 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.