How shira98/blockchain-scm works
Main Components
• Frontend Component: Represent the entire "appfrontend" folder which contains the React application. Note key aspects such as:
– Fundamental UI components (many found under "src/components") for features like registration, viewing batch details, and displaying statuses.
– CSS styling and static components that control the user experience.
• Blockchain/Smart Contracts: Represent the "contracts" folder as the core business logic layer written in Solidity. Mention core functionalities related to supply chain management (batch creation, status updates, transaction handling).
• Deployment & Integration Layer: Include the "scripts" folder (specifically "deploy.js") where deployment to a Hardhat network is orchestrated.
• Testing and Simulation: Optionally, show that tests (in "test") validate the contract logic.
• External Services/Dependencies:
– Hardhat blockchain node which the local network (http://127.0.0.1:8545/) represents.
– Wallet integrations (like MetaMask and alternatives such as Coinbase) with browser extensions acting as entry points for users.
• Supporting Artifacts: Include the "images" folder that contains current state images and interface design GIFs, while also noting the configuration files like "hardhat.config.js", package.json files, and GitHub workflows that aid in continuous integration.
Relationships and Data Flow
• That once a user takes an action through the UI (e.g., registering or updating a batch), the frontend calls the smart contracts deployed on the Hardhat network.
• Deployment flow: Hardhat compiles the smart contracts and the "deploy.js" script deploys these contracts, then the compiled contract JSON files are stored (or referenced) by the frontend for interaction.
Architectural Patterns and Design Principles
• Separation of concerns between frontend and blockchain backend.
• Use of Hardhat for contract management and testing, as well as the integration pattern via React/Ethers.js.
• Modern JavaScript/React architecture, with distinct components for handling both smart contract interaction and UI rendering.
– An annotation on external dependencies such as Node, npm, and wallet providers (MetaMask/Coinbase) linked to the frontend.
• This level of detail not only demonstrates the physical file layout and interaction networks but also the underlying architectural decisions such as separation between presentation, business logic, and deployment processes.