FoodPrint – 食品印刷区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,FoodPrint – 食品印刷区块链毕设代写 是一篇很好的国外资料

FoodPrint

FoodPrint is a small scale farmer food supply chain web application for tracking food from farm to fork. FoodPrint is powered by Blockchain technology.

Overview

FoodPrint has 5 types of users:

  • Super User Admin

The Super User is responsible for setting up the infrastructure and system configuration.

  • System Admin

The System Admin is responsible for the day-to-day running of the platform, providing user support (on-boarding and operations) and basic configuration.

  • Farmer

The Farmer is responsible for capturing produce data at harvest time onto FoodPrint. The Farmer also transports the produce to the Market as per order from Market Admin.

  • Market Admin

The Market Admin is responsible for receiving produce from the Farmer and capturing the relevant data onto FoodPrint.

  • Market Patron

The Market Patron is the customer of the market. They purchase food from the Market. The Market Patron will be able to scan a barcode associated with produce and view the verified produce information and supply chain stories view information on the produce they are buying, it’s source and journey, hence from farm to fork. Android versions 8 & 9 and iOS versions 11 & 12 can automatically scan QR codes using the camera app.

Documentation

  • Business Case

Installation (Development Environment)

In order to run FoodPrint, an environment with the following is required:

  • Node.js
  • Truffle Framework
  • Web3.js
  • Bootstrap
  • MySQL
  • MetaMask (MetaMask is an extension for accessing Ethereum enabled distributed applications, or “Dapps” in your browser! The extension injects the Ethereum web3 API into every website’s javascript context, so that dapps can read from the blockchain.)
  1. Install Truffle globally. Truffle is the most popular smart contract development, testing, and deployment framework.
$npm install -g truffle  
  1. Install node dependencies.
$npm install 
  1. Start Ganache and Create a Workspace (or open an existing one).

  2. Confirm FoodPrint smart contract compiles successfully.

$truffle compile 
  1. Run tests for FoodPrint smart contract.
$truffe test $truffle test --network development 
  1. Deploy FoodPrint smart contract to Ganache (assumes Ganache is running).

truffle migrate will run all migrations located within your project’s migrations directory. If your migrations were previously run successfully, truffle migrate will start execution from the last migration that was run, running only newly created migrations. If no new migrations exists, truffle migrate won’t perform any action at all.

$truffle migrate 

The –reset flag will force to run all your migrations scripts again. Compiling if some of the contracts have changed. You have to pay gas for the whole migration again.

$truffle migrate --reset 

The –all flag will force to recompile all your contracts. Even if they didn’t change. It is more time compiling all your contracts, and after that it will have to run all your deploying scripts again.

$truffle migrate --compile-all --reset 

If for some reason truffle fails to acknowledge a contract was modified and will not compile it again, delete the build/ directory. This will force a recompilation of all your contracts and running all your deploy scripts again.

  1. Update truffle-config.js development network with NetworkID, Host and Port values from your local Blockchain in Ganache.

  2. Create a MySQL database

run dbxml/foodprintDB.sql 
  1. Populate the MySQL database
run dbxml/foodprintDB_schema.sql 
  1. Create a database configuration file in the root folder – dbconfig.json and populate with updated json config as below
{         "db_pool": {         "host"      : <HOSTNAME>,         "user"      : <USERNAME>,         "password"  : <PASSWORD>,         "database"  : <DATABASENAME>     } } 
  1. Create a .env file in the root directory of your project. Add environment-specific variables on new lines in the form of NAME=VALUE. For example
APP_ENV=staging APP_NAME=custom environment app DB_HOST=localhost DB_USER=root DB_PASS=s1mpl3 

You can then access the variables in your code using process.env e.g. console.log(process.env.APP_ENV)

  1. Start the web server (Express) and navigate to http://localhost:3000/ in your browser.
$npm run dev 

Other

  1. Access deployed contract from CLI
$ truffle console $ TheProduct.deployed().then(function(instance) { app = instance }) $ app.noHarvests() 
  1. Add a new migration
$touch 2_deploy_contract.js 
  1. Create infura project at https://infura.io (Infura gives you access to test network). This project will give you an ID that you will use in truffle-config.js infura means you do not have to sync an ether node or rinkeby node to deploy directly.

  2. Get test ether from https://faucet.rinkeby.io/ (you will need to create an Ethereum rinkeby wallet on MetaMask then use the address on twitter). e.g. 0x4B67D20a4F27d248aF0462C23F8C193f073517FB

  3. Update truffle-config.js with rinkeby. This will deploy from the metamask accounts, by default account 0 so specify which one you want.

  4. Deploy to rinkeby.

$truffle migrate --network rinkeby --compile-all --reset 
  1. Check contract on rinkeby etherscan https://rinkeby.etherscan.io

  2. Generate test UUID’s from command line.

$node >const uuidv4 = require('uuid/v4') >uuidv4() 
  1. Generate test QRCode’s from command line.
$node >var QRCode = require('qrcode'); >let produceUrl = "http://www.google.com"; >let supplier = "supplier"; >let produce = "Storage"; >var res2 = await QRCode.toDataURL(produceUrl); >res2 

Production Deployment

  1. To deploy to a production server, first bundle and uglify then deploy
$npm run build $npm run start 

Supported Browsers

FoodPrint - 食品印刷
IE / Edge
FoodPrint - 食品印刷
Firefox
FoodPrint - 食品印刷
Chrome
FoodPrint - 食品印刷
Safari
FoodPrint - 食品印刷
iOS Safari
FoodPrint - 食品印刷
Samsung
FoodPrint - 食品印刷
Opera
IE11, Edge Supported Supported Supported Supported Supported Supported

FoodPrint

FoodPrint是一个小规模的农民食品供应链web应用程序,用于跟踪从农场到叉子的食物。FoodPrint由区块链blockchain技术提供动力。

概述案例
  • 节点.js
  • Truffle框架!该扩展将以太坊ethweb3api注入到每个网站的javascript上下文中,以便dapp可以从区块链blockchain中读取数据。)
  • 在全球范围内安装Truffle。Truffle是最流行的智能合约开发、测试和部署框架。
  • 安装节点依赖项。
  • 启动Ganache并创建一个工作区(或打开一个现有的工作区)。
  • 确认FoodPrint智能合约编译成功。
  • 为FoodPrint智能合约运行测试。
  • 将FoodPrint智能合约部署到Ganache(假设Ganache正在运行)。
  • 更新块菌-配置文件使用您在加纳切的本地区块链blockchain的NetworkID、主机和端口值开发网络。
  • 创建MySQL数据库
  • 填充MySQL数据库
  • 在根文件夹中创建数据库配置文件-dbconfig.json文件并填充更新的json配置,如下所示
  • 在项目的根目录中创建一个.env文件。以NAME=VALUE的形式在新行中添加特定于环境的变量。例如,
  • 启动web服务器(Express)并导航到http://localhost:3000/在您的浏览器中。
  • Access deployed contract from CLI
  • 添加新迁移
  • 在https://infura.io(Infura允许您访问测试网络)。这个项目将给你一个ID,你将使用在松露-配置文件infura意味着您不必同步ether节点或rinkeby节点来直接部署。
  • 从https://faucet.rinkeby.io/(你需要在MetaMask上创建一个以太坊ethrinkeby钱包,然后使用twitter上的地址)。e、 g.0x4B67D20a4F27d248aF0462C23F8C193f073517FB
  • 更新块菌-配置文件和林克比在一起。这将从元掩码帐户(默认帐户为0)进行部署,因此请指定所需的帐户。
  • 部署到rinkeby。
  • 查看rinkeby etherscan上的合同https://rinkeby.etherscan.io
  • 从命令行生成测试UUID。
  • 从命令行生成测试QRCode。
  • 要部署到生产服务器,首先捆绑并丑陋地部署
  • IE11,Edge 支持的 支持的 支持的 支持的 支持的

    FoodPrint有5种类型的用户:

    • 节点.js

    超级用户负责设置基础设施和系统配置。

    • Truffle框架!该扩展将以太坊ethweb3api注入到每个网站的javascript上下文中,以便dapp可以从区块链blockchain中读取数据。)

    系统管理员负责平台的日常运行,提供用户支持(上车和操作)和基本配置。

    • 在全球范围内安装Truffle。Truffle是最流行的智能合约开发、测试和部署框架。

    农民负责将收获时的农产品数据捕捉到FoodPrint上。农场主还根据市场管理员的命令将农产品运到市场。

    • 安装节点依赖项。

    市场管理员负责接收农民的农产品,并将相关数据捕捉到FoodPrint上。

    • 启动Ganache并创建一个工作区(或打开一个现有的工作区)。

    市场赞助人是市场的客户。他们从市场上买食物。市场用户将能够扫描与农产品相关的条形码,并查看已验证的农产品信息和供应链故事查看他们购买的农产品的信息、来源和旅程,从而从农场到岔口。Android版本8&9和iOS版本11&12可以使用摄像头应用程序自动扫描二维码。

    Documentation

    • 确认FoodPrint智能合约编译成功。

    Installation (Development Environment)

    为了运行FoodPrint,需要具有以下特性的环境:

    • 为FoodPrint智能合约运行测试。
    • 将FoodPrint智能合约部署到Ganache(假设Ganache正在运行)。
    • 更新块菌-配置文件使用您在加纳切的本地区块链blockchain的NetworkID、主机和端口值开发网络。
    • 创建MySQL数据库
    • 填充MySQL数据库
    • 在根文件夹中创建数据库配置文件-dbconfig.json文件并填充更新的json配置,如下所示
    1. 在项目的根目录中创建一个.env文件。以NAME=VALUE的形式在新行中添加特定于环境的变量。例如,
    $npm install -g truffle  
    1. 启动web服务器(Express)并导航到http://localhost:3000/在您的浏览器中。
    $npm install 
    1. Access deployed contract from CLI
    2. 添加新迁移
    $truffle compile 
    1. 在https://infura.io(Infura允许您访问测试网络)。这个项目将给你一个ID,你将使用在松露-配置文件infura意味着您不必同步ether节点或rinkeby节点来直接部署。
    $truffe test $truffle test --network development 
    1. 从https://faucet.rinkeby.io/(你需要在MetaMask上创建一个以太坊ethrinkeby钱包,然后使用twitter上的地址)。e、 g.0x4B67D20a4F27d248aF0462C23F8C193f073517FB

    –reset标志将强制再次运行所有迁移脚本。如果某些合同已更改,则进行编译。你得再为整个迁徙付汽油费。

    $truffle migrate 

    –all标志将强制重新编译您的所有合同。即使他们没有改变。编译所有的契约需要更多的时间,之后它将不得不再次运行所有的部署脚本。

    $truffle migrate --reset 

    如果由于某种原因truffle未能确认合同已被修改,并且不会再次编译它,请删除build/目录。这将强制重新编译所有契约并再次运行所有部署脚本。

    $truffle migrate --compile-all --reset 

    更新块菌-配置文件使用您在加纳切的本地区块链blockchain的NetworkID、主机和端口值开发网络。

    1. 更新块菌-配置文件和林克比在一起。这将从元掩码帐户(默认帐户为0)进行部署,因此请指定所需的帐户。
    2. 部署到rinkeby。
    run dbxml/foodprintDB.sql 
    1. 查看rinkeby etherscan上的合同https://rinkeby.etherscan.io
    run dbxml/foodprintDB_schema.sql 
    1. 从命令行生成测试UUID。
    {         "db_pool": {         "host"      : <HOSTNAME>,         "user"      : <USERNAME>,         "password"  : <PASSWORD>,         "database"  : <DATABASENAME>     } } 
    1. 从命令行生成测试QRCode。
    APP_ENV=staging APP_NAME=custom environment app DB_HOST=localhost DB_USER=root DB_PASS=s1mpl3 

    创建infura项目https://infura.io(Infura允许您访问测试网络)。这个项目将给你一个ID,你将使用在松露-配置文件infura意味着您不必同步ether节点或rinkeby节点来直接部署。

    1. 要部署到生产服务器,首先捆绑并丑陋地部署
    $npm run dev 

    Other

    1. Access deployed contract from CLI
    $ truffle console $ TheProduct.deployed().then(function(instance) { app = instance }) $ app.noHarvests() 
    1. Add a new migration
    $touch 2_deploy_contract.js 
    1. 从https://faucet.rinkeby.io/(你需要在MetaMask上创建一个以太坊ethrinkeby钱包,然后使用twitter上的地址)。e、 g.0x4B67D20a4F27d248aF0462C23F8C193f073517FB

    2. 更新块菌-配置文件和林克比在一起。这将从元掩码帐户(默认帐户为0)进行部署,因此请指定所需的帐户。

    3. 部署到rinkeby。

    4. 查看rinkeby etherscan上的合同https://rinkeby.etherscan.io

    $truffle migrate --network rinkeby --compile-all --reset 
    1. 从命令行生成测试UUID。

    2. Generate test UUID’s from command line.

    $node >const uuidv4 = require('uuid/v4') >uuidv4() 
    1. Generate test QRCode’s from command line.
    $node >var QRCode = require('qrcode'); >let produceUrl = "http://www.google.com"; >let supplier = "supplier"; >let produce = "Storage"; >var res2 = await QRCode.toDataURL(produceUrl); >res2 

    Production Deployment

    1. To deploy to a production server, first bundle and uglify then deploy
    $npm run build $npm run start 

    Supported Browsers

    FoodPrint - 食品印刷
    IE / Edge
    FoodPrint - 食品印刷
    Firefox
    FoodPrint - 食品印刷
    Chrome
    FoodPrint - 食品印刷
    Safari
    FoodPrint - 食品印刷
    iOS Safari
    FoodPrint - 食品印刷
    Samsung
    FoodPrint - 食品印刷
    Opera
    IE11,Edge 支持的 支持的 支持的 支持的 支持的 Supported

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

    www.interchains.cc

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

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

    提供最优质的资源集合

    立即查看 了解详情