How coder-pranjal202/pharmachain2026_blockchain works
Purpose and Entry Points
This is a small browser-based blockchain/pharmaceutical-chain prototype. The repository has no backend, build system, server code, or smart-contract source; the application is delivered as static frontend assets.
Primary entry point:
• Frontend/index.html loads the UI and browser scripts.
• Frontend/app.js contains application behavior and blockchain interaction flow.
• Frontend/abi.js supplies the contract ABI used by the frontend.
Browser Application Shell
Frontend/index.html defines the page structure, user-facing controls, and script loading order. It is the integration boundary between the UI, styling, wallet/provider libraries loaded by the page, and application logic.
• Frontend/index.html
• Frontend/style.css
• Frontend/app.js
Blockchain Contract Integration
The frontend is designed to communicate with a deployed blockchain contract through its ABI rather than through a repository-local contract implementation. Frontend/abi.js is therefore the contract interface boundary: application code can construct a contract client, call read methods, and submit signed transactions without embedding contract bytecode or Solidity source.
• Frontend/abi.js
• Frontend/app.js
The deployed contract address, active chain, and available methods must be inferred from Frontend/app.js and the ABI; they are not represented elsewhere in the repository.
Wallet and Transaction Control Flow
The expected control path is browser UI → Frontend/app.js → injected wallet/provider → blockchain RPC network → deployed contract.
Frontend/app.js is responsible for:
• requesting or using a connected wallet account;
• creating a provider/signer and contract client from the ABI;
• converting UI actions into contract reads or state-changing transactions;
• reflecting returned data, transaction status, or errors in the page.
Wallet approval and transaction signing occur outside the application in the user’s wallet. The frontend should treat provider access, account changes, chain changes, rejected signatures, and RPC failures as external boundary conditions.
Pharmaceutical-Chain Domain Surface
The repository name indicates a pharmaceutical supply-chain domain, but the domain model itself is not available in the README or source tree beyond the frontend/ABI boundary. Any lifecycle entities—such as products, batches, manufacturers, distributors, pharmacies, or provenance records—are defined by the contract ABI and UI behavior, not by server-side models.
• Frontend/abi.js
• Frontend/app.js
• Frontend/index.html
Presentation Layer
The visual layer is isolated from blockchain behavior. Frontend/style.css controls layout and presentation, while Frontend/index.html provides stable DOM targets that Frontend/app.js can populate or update after wallet and contract operations.
• Frontend/style.css
• Frontend/index.html
• Frontend/app.js
Runtime and Infrastructure
Material runtime dependencies are the user’s browser, a JavaScript-capable injected Ethereum-compatible wallet/provider, an RPC-accessible blockchain network, and a deployed contract matching Frontend/abi.js. Static hosting is sufficient for repository assets; no API service, database, authentication service, CI configuration, or deployment infrastructure is present in the file tree.
Main entry points: app.js Application Logic · index.html Page Shell · style.css Presentation · abi.js Contract ABI
Components 10
Static Frontend
Browser-delivered application assets.
- Static Hosting · Serves the frontend files without an application backend.
- Page Shell · Defines controls, DOM targets, and script loading.
Frontend/index.html - Presentation · Controls page layout and appearance.
Frontend/style.css - Application Logic · Coordinates UI, wallet access, contract calls, and status updates.
Frontend/app.js - Contract ABI · Defines the deployed contract methods available to the frontend.
Frontend/abi.js - UI Controls & Status · Receives user actions and displays reads, transaction state, and errors.
External Runtime
Wallet and blockchain services outside the repository.
- User Browser · Runs the static application.
- Injected Wallet · Handles account access, approval, and transaction signing.
- Blockchain RPC Network · Routes provider requests to the active chain.
- Deployed Pharma Contract · External contract implementing the ABI-defined domain behavior.
Connections 13
- Static Hosting → Page Shell: serves
- Page Shell → Presentation: loads
- Page Shell → Application Logic: loads
- Page Shell → UI Controls & Status: defines
- User Browser → Page Shell: renders
- UI Controls & Status → Application Logic: user actions
- Application Logic → UI Controls & Status: updates results/status
- Application Logic → Contract ABI: uses interface
- Application Logic → Injected Wallet: requests account and signer
- Injected Wallet → Blockchain RPC Network: submits provider requests
- Blockchain RPC Network → Deployed Pharma Contract: reads and transactions
- Injected Wallet → Application Logic: account, signatures, errors
- Deployed Pharma Contract → Application Logic: returned state and transaction status