This guide explains how to install, configure and run the API (including smart contract deployment) on your local machine. All steps assume Python 3.8 (ideally 3.8.10) and use virtualenv.
- Python 3.8 (e.g. 3.8.10) installed on your system
virtualenvpackage (pip install virtualenv)- Internet access to your RPC provider (e.g. Avalanche Fuji via Infura)
- A wallet private key with sufficient test-net funds
cd /path/to/your/project
virtualenv -p python3.8 venv
source venv/bin/activateOpen setup/settings.py and uncomment & fill in the values marked below. In particular, make sure your executor wallet private key has enough funds on the target network.
class settings:
# ─── Web3 / Blockchain ────────────────────────────────
# PROVIDER = "<YOUR_INFURA_OR_RPC_PROVIDER_URL>"
# EXECUTOR_PRIVATE_KEY = "<YOUR_EXECUTOR_WALLET_PRIVATE_KEY>"
# # Must have sufficient funds on the network.
# ─── Contract constructor parameters ──────────────────
BPT_NAME = "Biosample Permission Token"
BPT_SYMBOL = "BPT"
BPT_NAMESPACE = "io.genobank.test"
XBPT_NAME = "Extended Biosample Permission Token"
XBPT_SYMBOL = "XBPT"
BIOSAMPLE_URI = "https://genobank.io/"
USDNA_CONTRACT = "0xB973E2B66f925bFA8206FEF61A1d89D2A664Cd23"
# ─── .env generation control ──────────────────────────
OUTPUT_ENV_FILE_NAME = "generated.env"
COPY_ENV_TO_PROJECT_ROOT = True
# ─── Paths to compiled ABI JSONs (relative to setup/) ─
ABI_BPT_PATH = "../smart_contract/biosample-permission-token.json"
ABI_XBPT_PATH = "../smart_contract/extended_biosample_permission_token/extended_biosample_permission_token.json"
ABI_BIOSAMPLE_PATH = "../smart_contract/Biosample.json"
ABI_POSP_PATH = "../smart_contract/posp.json"
ABI_POSP_FACTORY_PATH = "../smart_contract/posp_factory.json"
ABI_DELIVER_MANAGER_PATH = "../smart_contract/DeliverManager.json"Note: The lines starting with
#must be uncommented and replaced with your own values.
From the setup/ folder:
cd setup
chmod +x install.sh
./install.shThis script will:
- Generate generated.env with boilerplate entries
- Deploy all smart contracts in sequence
- Update generated.env with the deployed contract addresses (quoted)
- Copy generated.env to the project root as .env (if enabled)
Open the newly created .env file in your project root and fill in any remaining placeholders:
# ─── Signing messages ───────────────────────────────────
MESSAGE=<YOUR_MESSAGE_TO_RECOVER_USER_WALLET>
NEW_MESSAGE=<YOUR_MESSAGE_TO_DOWNLOAD_USER_FILE>
ROOT_MESSAGE=<YOUR_ROOT_MESSAGE_TO_SIGN>
# ─── Buckets configuration ─────────────────────────────
BUCKET_PATH=<STORAGE_ENVIRONMENT>
BUCKET_ACCESS_KEY_ID=<YOUR_BUCKET_ACCESS_KEY_ID>
BUCKET_SECRET_ACCESS_KEY_ID=<YOUR_BUCKET_SECRET_ACCESS_KEY_ID>
BUCKET_NAME=<YOUR_BUCKET_NAME>
# ─── API & Database ────────────────────────────────────
API_BASE="https://api-test.genobank.io"
MONGO_DB_HOST=<YOUR_MONGODB_CONNECTION_STRING>
DB_NAME=<YOUR_DATABASE_NAME>
# ─── Root wallet (admin tasks) ────────────────────────
ROOT_GENOBANK=<YOUR_ROOT_WALLET_PRIVATE_KEY>
ROOT_GENOBANK_WALLET=<YOUR_ROOT_WALLET_PUBLIC_ADDRESS>
# ─── Third-party API keys ──────────────────────────────
MAGIC_API_KEY=<YOUR_MAGIC_AUTH_API_KEY>Save and close the file when you’re done.
From the project root, start the API with:
python3 start.pyYour API (and connected smart contracts) should now be running locally.
🎉 All set! You’ve configured your environment, deployed smart contracts, and launched the API.