How pragalbhmandaokar/finance-supply-chain-3rd-blockchain works
Project Type and Purpose
• This is a blockchain-integrated full-stack application for finance supply chain management. The README highlights a Hardhat use case for developing and deploying smart contracts. The project incorporates blockchain logic (via Hardhat and chaincode scripts) alongside typical application backend code, suggesting a hybrid architecture that deals with both conventional REST API logic and blockchain-based ledger operations.
Analyzing the File Structure
• The top-level structure shows several major directories:
• app – Contains application code such as utilities, controllers, services, routers, models, and configuration files. This layer implements the business logic (e.g., BankController, CompanyController, FinanceController, InvoiceController) and handles inbound API requests.
• blockchain – Holds Hardhat configurations, deployment scripts, contract artifacts, and other blockchain-specific utilities. It’s where smart contracts are compiled, deployed, and interacted with.
• hyperleader – Appears to extend the blockchain functionality with components like chaincode, smart contract interactions, and even wallet integrations (e.g., Bank and Finance directories, chaincode libraries). This layer might be used for a Hyperledger Fabric style network integration alongside Ethereum-based components.
• company-wallet – Stores wallet IDs that likely correspond to individual identities interacting with the blockchain network.
• dist and server.js – Represent the deployment/build outputs and the main server entry point, indicating how the backend is packaged and run.
• Notice configuration files (in app/config and hyperleader/config) that include connection profiles and export configurations which are critical for establishing connectivity with blockchain networks.
Key Architecture Components
a. Frontend / Client Layer (not explicitly shown, but consider external clients or web UIs connecting via APIs).
b. Application/API Server:
• Modules like Controllers, Services, Routers, Models, and Utilities (from the app directory).
• The controllers and routers handle incoming HTTP requests; services (e.g., bank_service, finance_service, etc.) encapsulate business logic; models represent data entities.
c. Blockchain Integration Layer:
• A dedicated blockchain layer that involves the “blockchain” directory (with Hardhat, contract artifacts, and deployment scripts) to represent the smart contract development environment.
• Separate chain components (e.g., BankChain, CompanyChain, FinanceChain, InvoiceChain from app/blockchainservice) to indicate distinct smart contract interactions.
d. Hyperledger / Advanced Blockchain Components:
• “hyperleader” directory elements which include chaincode, financial modules, and additional contract libraries (e.g., CompanyContract, FinancialContract). This may suggest an integration with a Fabric-based network or an enhanced blockchain network that coexists with the Hardhat-based contracts.
e. Wallet and Identity Management:
f. Database/Storage:
• Although not extensively elaborated, files like database.js and mongo_service.js in the app/service and app/config directories indicate a persistence layer (possibly MongoDB or another DB) that tracks application state or transaction histories.
Relationships and Interactions
• Inside the application server, map the flow from Routers → Controllers → Services.
• Have services interact in two key ways:
• With the database layer (for data persistence and retrieval).
• With the blockchain integration layer, invoking smart contract methods via blockchain service modules.
• From the blockchain layer, illustrate bidirectional interactions where deployment scripts (via Hardhat or Hyperledger chaincode modules) send contract transactions and receive responses.
• Configuration modules providing connection profiles to the blockchain and potentially to the Hyperledger components.
Architectural Patterns and Technologies
• Separation of Concerns: Clearly divide the system into an API layer (app/) and a blockchain integration layer (blockchain/ and hyperleader/).
• Microservices/Modularization: The separation into different chain modules (BankChain, CompanyChain, etc.) and service modules indicates a modular design.
• Use of Hardhat for contract compilation and deployment, and additional blockchain scripts to interact with contracts.
• Frameworks/Libraries: Hardhat, potential Node.js libraries for service location (app/lib/service_locator.js), and smart contract libraries in hyperleader.