FoodPrint is a digital, blockchain-enabled, farm-to-fork (fresh produce) supply chain platform for smallholder farmers. This is a repo for the FoodPrint Algorand integration.
TODO
TODO
- Install
PyTeal
and otherPython
dependencies.
pip install -r requirements.txt
- Install
Node.js
dependencies e.g.algosdk
anddotenv
.
npm install1
- Create a
.env
file in the root of the project. This should be .gitignored
touch .env
- Add environment variables to
.env
.
ENV=TESTNET
DEV_ALGOD_API_KEY=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
DEV_ALGOD_SERVER=http://localhost
DEV_ALGOD_PORT=4001
DEV_ALGOINDEXER_PORT=8980
TESTNET_ALGOD_API_KEY=REPLACEME_WITH_PURESTAKE_KEY
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=REPLACEME_WITH_PURESTAKE_KEY
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=REPLACEME_WITH_ACCOUNT1_ADDRESS
ACCOUNT1_MNEMONIC=REPLACEME_WITH_ACCOUNT1_MNEMONIC
ACCOUNT2_ADDRESS=REPLACEME_WITH_ACCOUNT2_ADDRESS
ACCOUNT2_MNEMONIC=REPLACEME_WITH_ACCOUNT2_MNEMONIC
- Run script (from project root) to test import of .env variables
node -r dotenv/config tests/test_env.js
- Run script (from project root) to setup Algorand accounts from project root
node -r dotenv/config scripts/1_algo_account_create.js
- Update Algorand account env variables with details for account 1 and account 2 (i.e. addresses and mnemonics)
ACCOUNT1_ADDRESS=REPLACEME_WITH_ACCOUNT1_ADDRESS
ACCOUNT1_MNEMONIC=REPLACEME_WITH_ACCOUNT1_MNEMONIC
ACCOUNT2_ADDRESS=REPLACEME_WITH_ACCOUNT2_ADDRESS
ACCOUNT2_MNEMONIC==REPLACEME_WITH_ACCOUNT2_MNEMONIC
- Fund the newly created accounts.
- Add funds to DEV account using goal (i.e. ./sandbox goal clerk send -a 12345678) using one of the default accounts created from the unencrypted wallet (i.e. assuming you are running sandbox locally)
- Add funds to TESTNET account using the TestNet Dispenser at https://bank.testnet.algorand.network. This dispenses 10000000 microalgos = 10 ALGOs
- Add funds to MAINNET account using the Algorand Wallet or other source with real ALGOs
- You can view accounts on TESTNET here - https://testnet.algoexplorer.io/address/ and MAINNET here - https://algoexplorer.io/address/
- Run scripts (from project root) to import mnemonics, check balances and send transactions
node -r dotenv/config scripts/2_algo_account_balance.js
node -r dotenv/config scripts/3_algo_account_send.js
- Run tests (from project root) to capture supply chain data (via an Algorand zero value transaction and the note field)
node -r dotenv/config tests/test_algo_supply_chain.js