FoodPrint is a digital, blockchain-enabled, farm-to-fork (fresh produce) supply chain platform for smallholder farmers, primarily in developing countries. FoodPrint is designed to:
- Simplify production and harvest data collection for smallholder farmers.
- Directly connect them to market opportunities - including but not limited to intermediaries such as markets and retailers, as well as consumers.
- Provide them with access to blockchain-based financial and transactional services.
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.
- Intermediary e.g. Wholesaler, Retailers, Farmers Market Admin etc
The Intermediary is responsible for receiving produce from the Farmer and capturing the relevant data onto FoodPrint.
- Consumer
The consumer is the final actor in a food supply chain. They purchase fresh produce from an intermediary. The consumer can scan a barcode associated with produce and view the verified produce information and supply chain stories i.e. 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.
TODO
In order to run FoodPrint, an environment with the following is required:
- Node.js
- Algosdk
- Bootstrap
- MySQL
- Install node dependencies.
$npm install
-
Create a blank MySQL database
-
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>
},
"development": {
"username": <USERNAME>,
"password": <PASSWORD>,
"database": <DATABASENAME>,
"host": <HOSTNAME>,
"dialect": "mysql"
},
"test": {
"username": <USERNAME>,
"password": <PASSWORD>,
"database": <DATABASENAME>,
"host": <HOSTNAME>,
"dialect": "mysql"
},
"production": {
"username": <USERNAME>,
"password": <PASSWORD>,
"database": <DATABASENAME>,
"host": <HOSTNAME>,
"dialect": "mysql"
}
}
- 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
NODE_ENV=staging
PORT=3000
APP_NAME=REPLACE_ME
SESSION_SECRET=REPLACE_ME
EMAIL_ADDRESS=GMAIL_EMAIL_ADDRESS
EMAIL_PASSWORD=GMAIL_EMAIL_PASSWORD
EMAIL_OVERRIDE=OVERRIDE_EMAIL_ADDRESS
BLOCKCHAINENV=TESTNET
DEV_ALGOD_API_KEY=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
DEV_ALGOD_SERVER=http://localhost
DEV_ALGOD_PORT=4001
DEV_ALGOINDEXER_PORT=8980
TESTNET_ALGOD_API_KEY=REPLACE_ME
TESTNET_ALGOD_SERVER=https://testnet-algorand.api.purestake.io/ps2
TESTNET_ALGOINDEXER_SERVER=https://testnet-algorand.api.purestake.io/idx2
TESTNET_ALGOD_PORT=
MAINNET_ALGOD_API_KEY=REPLACE_ME
MAINNET_ALGOD_SERVER=https:https://mainnet-algorand.api.purestake.io/ps2
MAINNET_ALGOINDEXER_SERVER=https://mainnet-algorand.api.purestake.io/idx2
MAINNET_ALGOD_PORT=
ACCOUNT1_ADDRESS=REPLACE_ME
ACCOUNT1_MNEMONIC=REPLACE_ME
ACCOUNT2_ADDRESS=REPLACE_ME
ACCOUNT2_MNEMONIC=REPLACE_ME
You can then access the variables in your code using process.env e.g. console.log(process.env.NODE_ENV)
- Start the web server (Express) and navigate to http://localhost:3000/ in your browser.
$npm run dev
- To deploy to a production server, first bundle and uglify then deploy
$npm run build
$npm run start
- Generating Sequelize Models from an existing database using Sequelize Auto.
For convenience Sequelize Auto provides a programmatic api that can be used in the generation of models in addition to
their cli. You can use the convenience script
src/js/sequelise_auto_export.js
to generate required models by supplying the table names in thetables
section of theoptions
object. The script establishes a connection to the database using the config data specified in step3
. Execute the command below withinsrc/js
to generate the models for the specified tables:
node sequelise_auto_export.js
The generated models can be found in ./models
- Generate test UUID's from command line (i.e. server side).
$node
>const uuidv4 = require('uuid/v4')
>uuidv4()
- Generate test QRCode's from command line (i.e. server side).
$node
>var QRCode = require('qrcode');
>let produceUrl = "http://www.google.com";
>let supplier = "supplier";
>let produce = "Storage";
>var res2 = await QRCode.toDataURL(produceUrl);
>res2
Initial contract was deployed at Ethereum Testnet (rinkeby) at address https://rinkeby.etherscan.io/address/0xfC4d26073650887069dFa7Da686A491535ab8Fd4.
This was followed by a deployment to the Matic Testnet (mumbai) at address https://mumbai.polygonscan.com/address/0x650168110ADa1f089D443904c6759b7349576A0d,
Latest version of FoodPrint is integrated with the Algorand TestNet via the algosdk
and PureStake
service.
![]() IE / Edge |
![]() Firefox |
![]() Chrome |
![]() Safari |
![]() iOS Safari |
![]() Samsung |
![]() Opera |
---|---|---|---|---|---|---|
IE11, Edge | Supported | Supported | Supported | Supported | Supported | Supported |