基于区块链的毕业设计Demo Vault – 演示保险库

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计Demo Vault – 演示保险库 是一篇很好的国外资料

Demo Vault

This is a simple demo ethereum contract that allows the contract owner to store IP addresses which they can then use to grant access to one of their applications (see eth-demo-api).

Prerequisites

To use it, you will need to have MetaMask installed, and an infura.io project as we will be using the Kovan testnet.

Set Up Accounts

In your MetaMask wallet you will need two accounts. After installing you will already have 1 account. Simply add another one via the UI. After creating this account, send some eth (e.g. 0.5) to this second account.

Upload Contracts to Kovan Testnet

Run the following in a terminal to upload the contract to Kovan Testnet:

$ truffle migrate --network kovan

If you made changes to the contrat after uploading, you can rerun the migrate command as follows:

$ truffle migrate --reset --network kovan

Interact with Contract

You can interact with the uploaded contract via the truffle console:

$ truffle console --network kovan

Once in the console, you can work with the contract as follows:

let vault = await LicenseVault.deployed(); let price = await vault.getPrice(); await vault.add("127.0.0.1", accounts[1], { from: accounts[0] }); await vault.isValid("127.0.0.1");

演示保险库

这是一个简单的以太坊eth协议演示,它允许协议所有者存储IP地址,然后他们可以使用这些IP地址授予对其中一个应用程序的访问权限(请参阅eth demo api)

先决条件

要使用它,您需要安装MetaMask和infura.io项目,因为我们将使用Kovan testnet

设置帐户

在MetaMask钱包中,您需要两个帐户。安装后,您将已有1个帐户。只需通过UI添加另一个。创建此帐户后,向第二个帐户发送一些eth(例如0.5)

将合同上载到Kovan Testnet

在终端中运行以下命令以将合同上载到Kovan Testnet:

$ truffle migrate --network kovan

如果在上载后对合同进行了更改,则可以按如下方式重新运行migrate命令:

$ truffle migrate --reset --network kovan

与合同交互

您可以通过truffle控制台与上载的合同进行交互:

$ truffle console --network kovan

在控制台中执行一次,您可以按如下方式使用合同:

let vault = await LicenseVault.deployed(); let price = await vault.getPrice(); await vault.add("127.0.0.1", accounts[1], { from: accounts[0] }); await vault.isValid("127.0.0.1");

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

www.interchains.cc

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

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计Demo Vault – 演示保险库

提供最优质的资源集合

立即查看 了解详情