NFT Pawning Shop – NFT当铺区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,NFT Pawning Shop – NFT当铺区块链毕设代写 是一篇很好的国外资料

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 with Docker

  1. In root folder of project, run: docker-compose up -d Deploy shard tutorial
  2. Setup config server sudo docker-compose exec mongocfg mongosh
rs.initiate({ 	_id : 'rsmongo1cfg', 	configsvr: true, 	members: [ 		{ _id : 0, host : "mongocfg:27017" }, 		{ _id : 1, host : "mongocfg1:27017" }, 	] });
  1. docker-compose exec mongo mongosh to open mongodb shell. Pass bellow command and enter to initilize MongoDB replica set:
rs.initiate({ 	_id : 'rsmongo', 	members: [ 		{ _id : 0, host : "mongo:27017" }, 		{ _id : 1, host : "mongo1:27017" }, 	] });

rs.secondaryOk() to allow query on secondary node. rs.status() to see current status 4. docker-compose exec mongo2 mongosh to open mongodb shell. Pass bellow command and enter to initilize MongoDB replica set:

rs.initiate({ 	_id : 'rsmongo1', 	members: [ 		{ _id : 0, host : "mongo2:27017" }, 		{ _id : 1, host : "mongo3:27017" }, 	] });

rs.secondaryOk() to allow query on secondary node. rs.status() to see current status 5. docker-compose exec mongos mongosh and run bellow command to register shards to mongos router

sh.addShard('rsmongo/mongo:27017,mongo1:27017'); sh.addShard('rsmongo1/mongo2:27017,mongo3:27017');

sh.status() to see shards status.

Run project without Docker

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 or Ganache-cli

2.1 Install Ganache here [or Ganache CLI]
2.2 Start Ganche UI
NFT Pawning Shop - NFT当铺
2.3 Choose New Workspace
2.4 Fill in the information
NFT Pawning Shop - NFT当铺
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.
NFT Pawning Shop - NFT当铺

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
NFT Pawning Shop - NFT当铺 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
NFT Pawning Shop - NFT当铺 3.4. Finally connect to Ganache

4. Deploy smart contract to Ganache

4.1. Go to /solidity folter
4.2. Run command npm install -g truffle @truffle/hdwallet-provider dotenv
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.
NFT Pawning Shop - NFT当铺

5. Install Go, NodeJS

Go here

6. Run api

6.1 Go to /api folder
6.2 Run command go mod download to install packages
6.3 Update mongodb uri in app.env
Add file dev.env to /api folder, contains bellow content:

MONGODB_URI=mongodb+srv://username:[email protected] HOST=localhost:4000 DATABASE_NAME=cooking_recipe SYMMETRIC_KEY=this is my secret symmetric keya TOKEN_DURATION=15m 

and prod.env:

MONGODB_URI=mongodb://khanh:[email protected]:27017 HOST=:4000 DATABASE_NAME=pawningshop SYMMETRIC_KEY=this is my secret symmetric keya TOKEN_DURATION=15 

6.4 Run command ENV=DEV go run .

7. Run event listener

7.1 Go to /event_listener folder
7.2 Run command go mod download to install packages
7.3 Update address of PawningShop contract to dev.env, because your contract address is changed when deployed
Add a new dev.envto /event_listener folder, contains bellow content:

API_HOST=pawningshop:4000 PAWN_PATH=/pawns BID_PATH=/bids BID_PAWN_PATH=/bids-pawns NOTIFY_HOST=http://localhost:7789 NOTIFICATION_PATH=/notifications NETWORK_ADDRESS=ws://localhost:8545 CONTRACT_ADDRESS=0xF8eC32B1884F17275aEed75DFd877DAd54ab2Ce4 

and prod.env:

API_HOST=http://api:4000 PAWN_PATH=/pawns BID_PATH=/bids BID_PAWN_PATH=/bids-pawns NOTIFY_HOST=http://notify:7789 NOTIFICATION_PATH=/notifications NETWORK_ADDRESS=ws://ganache:8545 CONTRACT_ADDRESS=0xF8eC32B1884F17275aEed75DFd877DAd54ab2Ce4 

CONTRACT_ADDRESS is address of PawningShop contract.

7.4 Because this project using go-ethereum library, and it requires gcc, g++ and make. In Ubuntu, these tools are available by default, but in Windows you have to install those tools by yourself. 7.5 Run command ENV=DEV go run .

8. Run notify

8.1 Go to /notify folder 8.2 Run command npm install 8.3 Run command npm run dev

9. Run UI

Add .env for local development and env.production for production mode. .env file:

VUE_APP_API_HOST=http://localhost:4000 VUE_APP_SOCKET_HOST=http://localhost:7789 

.env.production file:

VUE_APP_API_PATH=/api VUE_APP_HOST=http://localhost:80 VUE_APP_SOCKET_PATH=/notify 

9.1 Go to /client folder
9.2 Run command npm install
9.3 Run command npm run serve


NFT典当行

此应用程序适用于拥有NFT代币的人,他们需要钱但不想出售自己的代币,他们可以在我们的应用程序中将代币列为抵押品,其他用户可以向他们提供贷款。所以,借款人拿到了钱,他们的代币被锁定在我们的智能合约中。当还款时间到来时,借款人必须向贷款人支付原始款项加上利息,如果没有,则代币将转移给贷款人

不使用Docker运行项目。安装元掩码

2。安装Ganache或Ganache cli

3。将元掩码连接到Ganache

4。将智能合约部署到Ganache

5。安装Go、NodeJS

6。运行api

7。运行事件侦听器8。运行notify

9。在项目的根文件夹中运行UI,运行:docker compose up-d Deploy shard tutorial安装配置服务器sudo docker compose exec mongocfg mongosh打开mongodb shell。通过以下命令并输入初始化MongoDB副本集:

  1. In root folder of project, run: docker-compose up -d Deploy shard tutorial
  2. Setup config server sudo docker-compose exec mongocfg mongosh
rs.initiate({ 	_id : 'rsmongo1cfg', 	configsvr: true, 	members: [ 		{ _id : 0, host : "mongocfg:27017" }, 		{ _id : 1, host : "mongocfg1:27017" }, 	] });
  1. docker-compose exec mongo mongosh to open mongodb shell. Pass bellow command and enter to initilize MongoDB replica set:
rs.initiate({ 	_id : 'rsmongo', 	members: [ 		{ _id : 0, host : "mongo:27017" }, 		{ _id : 1, host : "mongo1:27017" }, 	] });

rs.secondaryOk()以允许在辅助节点上进行查询。rs.status()以查看当前状态4。docker编写exec mongo2 mongosh以打开mongodb shell。传递以下命令并输入初始化MongoDB副本集:

rs.initiate({ 	_id : 'rsmongo1', 	members: [ 		{ _id : 0, host : "mongo2:27017" }, 		{ _id : 1, host : "mongo3:27017" }, 	] });

rs.secondaryOk()以允许在辅助节点上进行查询。rs.status()以查看当前状态5。docker compose exec mongos mongosh并运行以下命令将碎片注册到mongos路由器

sh.addShard('rsmongo/mongo:27017,mongo1:27017'); sh.addShard('rsmongo1/mongo2:27017,mongo3:27017');

sh.status()以查看碎片状态

2。安装Ganache或Ganache cli

3。将元掩码连接到Ganache

1.1在此Chrome中安装Metamask扩展
1.2之后,创建一个帐户。
请记住对帐户的助记符保密。
助记符包含12个单词,看起来像:嫉妒期望百年轻人解锁主要汽笛浪涌声学机器目录
在Ganache中创建工作区时,我们需要此助记符。

4。将智能合约部署到Ganache

2.1在此处安装Ganache[或Ganache CLI]
2.2启动Ganche UI
<NFT Pawning Shop>
2.3选择新工作区
2.4填写信息
NFT Pawning Shop - NFT当铺
只需填写工作区名称,然后切换到选项卡帐户&amp;输入并填写从步骤1获得的助记符。
2.5保存工作区
现在您在Ganache中获得了一个新的工作区,并且您在UI上看到的所有帐户都与Metamask wallet中的帐户相同。
NFT Pawning Shop - NFT当铺

记住网络ID和RPC服务器,因为我们以后需要它。
所以这个Ganache服务器正在主机上运行http://127.0.0.1 和7545端口

3.1。单击Chrome
3.2中的Metamask图标。单击按钮显示所有可用网络
NFT Pawning Shop - NFT当铺,因此,我们的Ganache网络与以太坊eth一样,但它在本地计算机上运行,现在我们想将我们的网络添加到Metamask。
3.2。单击自定义RPC
3.3。填写以下信息
NFT Pawning Shop - NFT当铺3.4。最后连接到Ganache

4.1。转到/solidity文件夹
4.2。运行命令npm install-g [email protected]/hdwallet provider dotenv
4.3。运行命令truffle migrate–network ganache–reset
4.4。您可以在“合同”选项卡中查看有关智能合同的一些信息。
是否看到典当合同的地址,请保留它,因为我们在后面的步骤中需要它。
<NFT Pawning Shop><NFT Pawning Shop>

转到这里

6.1转到/api文件夹
6.2运行命令Go mod下载以安装软件包
6.3更新app.env中的mongodb uri
将文件dev.env添加到/api文件夹,包含以下内容:

和prod.env:

6.4运行命令env=Go Run Run

7.1转到/event_侦听器文件夹
7.2运行命令Go mod download安装包
7.3将典当行合同的地址更新到dev.env,因为部署时合同地址会更改
添加新的dev.envto/event_侦听器文件夹,包含以下内容:

和prod.env:

合同地址是典当行合同的地址

7.4因为该项目使用go以太坊eth库,并且需要gcc、g++和make。在Ubuntu中,这些工具默认是可用的,但在Windows中,你必须自己安装这些工具。7.5运行命令ENV=DEV go Run

8.1转到/通知文件夹8.2运行命令npm安装8.3运行命令npm运行开发

Add.env用于本地开发,env.production用于生产模式。env文件:

.env.production文件:

9.1转到/client文件夹
9.2运行命令npm安装
9.3运行命令npm运行服务

NFT典当行

使用Docker运行项目

不使用Docker运行项目。安装元掩码

2。安装Ganache或Ganache cli

3。将元掩码连接到Ganache

4。将智能合约部署到Ganache

5。安装Go、NodeJS

6。运行api

7。运行事件侦听器8。运行notify

9。在项目的根文件夹中运行UI,运行:docker compose up-d Deploy shard tutorial安装配置服务器sudo docker compose exec mongocfg mongosh打开mongodb shell。通过以下命令并输入初始化MongoDB副本集:

记住网络ID和RPC服务器,因为我们以后需要它。
所以这个Ganache服务器正在主机上运行http://127.0.0.1 和7545端口

5。安装Go、NodeJS

3.1。单击Chrome
3.2中的Metamask图标。单击按钮显示所有可用网络
NFT Pawning Shop - NFT当铺,因此,我们的Ganache网络与以太坊eth一样,但它在本地计算机上运行,现在我们想将我们的网络添加到Metamask。
3.2。单击自定义RPC
3.3。填写以下信息
NFT Pawning Shop - NFT当铺3.4。最后连接到Ganache

6。运行api

7。运行事件侦听器8。运行notify

9。在项目的根文件夹中运行UI,运行:docker compose up-d Deploy shard tutorial安装配置服务器sudo docker compose exec mongocfg mongosh打开mongodb shell。通过以下命令并输入初始化MongoDB副本集:

4.1。转到/solidity文件夹
4.2。运行命令npm install-g [email protected]/hdwallet provider dotenv
4.3。运行命令truffle migrate–network ganache–reset
4.4。您可以在“合同”选项卡中查看有关智能合同的一些信息。
是否看到典当合同的地址,请保留它,因为我们在后面的步骤中需要它。
<NFT Pawning Shop><NFT Pawning Shop>

转到这里

6.1转到/api文件夹
6.2运行命令Go mod下载以安装软件包
6.3更新app.env中的mongodb uri
将文件dev.env添加到/api文件夹,包含以下内容:

和prod.env:

6.4运行命令env=Go Run Run

7.1转到/event_侦听器文件夹
7.2运行命令Go mod download安装包
7.3将典当行合同的地址更新到dev.env,因为部署时合同地址会更改
添加新的dev.envto/event_侦听器文件夹,包含以下内容:

和prod.env:

合同地址是典当行合同的地址

7.4因为该项目使用go以太坊eth库,并且需要gcc、g++和make。在Ubuntu中,这些工具默认是可用的,但在Windows中,你必须自己安装这些工具。7.5运行命令ENV=DEV go Run

8.1转到/通知文件夹8.2运行命令npm安装8.3运行命令npm运行开发

Add.env用于本地开发,env.production用于生产模式。env文件:

.env.production文件:

9.1转到/client文件夹
9.2运行命令npm安装
9.3运行命令npm运行服务

NFT典当行

使用Docker运行项目

不使用Docker运行项目。安装元掩码

2。安装Ganache或Ganache cli

3。将元掩码连接到Ganache

4。将智能合约部署到Ganache

5。安装Go、NodeJS

6。运行api

7。运行事件侦听器8。运行notify

9。在项目的根文件夹中运行UI,运行:docker compose up-d Deploy shard tutorial安装配置服务器sudo docker compose exec mongocfg mongosh打开mongodb shell。通过以下命令并输入初始化MongoDB副本集:

7。运行事件侦听器8。运行notify

9。在项目的根文件夹中运行UI,运行:docker compose up-d Deploy shard tutorial安装配置服务器sudo docker compose exec mongocfg mongosh打开mongodb shell。通过以下命令并输入初始化MongoDB副本集:

Go here

7。运行事件侦听器8。运行notify

转到这里

MONGODB_URI=mongodb+srv://username:[email protected] HOST=localhost:4000 DATABASE_NAME=cooking_recipe SYMMETRIC_KEY=this is my secret symmetric keya TOKEN_DURATION=15m 

6.1转到/api文件夹
6.2运行命令Go mod下载以安装软件包
6.3更新app.env中的mongodb uri
将文件dev.env添加到/api文件夹,包含以下内容:

MONGODB_URI=mongodb://khanh:[email protected]:27017 HOST=:4000 DATABASE_NAME=pawningshop SYMMETRIC_KEY=this is my secret symmetric keya TOKEN_DURATION=15 

和prod.env:

9。在项目的根文件夹中运行UI,运行:docker compose up-d Deploy shard tutorial安装配置服务器sudo docker compose exec mongocfg mongosh打开mongodb shell。通过以下命令并输入初始化MongoDB副本集:

7.1转到/event_侦听器文件夹
7.2运行命令Go mod download安装包
7.3将典当行合同的地址更新到dev.env,因为部署时合同地址会更改
添加新的dev.envto/event_侦听器文件夹,包含以下内容:

API_HOST=pawningshop:4000 PAWN_PATH=/pawns BID_PATH=/bids BID_PAWN_PATH=/bids-pawns NOTIFY_HOST=http://localhost:7789 NOTIFICATION_PATH=/notifications NETWORK_ADDRESS=ws://localhost:8545 CONTRACT_ADDRESS=0xF8eC32B1884F17275aEed75DFd877DAd54ab2Ce4 

和prod.env:

API_HOST=http://api:4000 PAWN_PATH=/pawns BID_PATH=/bids BID_PAWN_PATH=/bids-pawns NOTIFY_HOST=http://notify:7789 NOTIFICATION_PATH=/notifications NETWORK_ADDRESS=ws://ganache:8545 CONTRACT_ADDRESS=0xF8eC32B1884F17275aEed75DFd877DAd54ab2Ce4 

合同地址是典当行合同的地址

7.4因为该项目使用go以太坊eth库,并且需要gcc、g++和make。在Ubuntu中,这些工具默认是可用的,但在Windows中,你必须自己安装这些工具。7.5运行命令ENV=DEV go Run

8. Run notify

8.1转到/通知文件夹8.2运行命令npm安装8.3运行命令npm运行开发

9. Run UI

Add.env用于本地开发,env.production用于生产模式。env文件:

VUE_APP_API_HOST=http://localhost:4000 VUE_APP_SOCKET_HOST=http://localhost:7789 

.env.production文件:

VUE_APP_API_PATH=/api VUE_APP_HOST=http://localhost:80 VUE_APP_SOCKET_PATH=/notify 

9.1转到/client文件夹
9.2运行命令npm安装
9.3运行命令npm运行服务

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/25088.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » NFT Pawning Shop – NFT当铺区块链毕设代写

提供最优质的资源集合

立即查看 了解详情