How kaymen99/ipfs-storage-dapp works
Main Components
• Blockchain/Smart Contract Layer:
• The “contracts” directory shows that the core functionality is encapsulated in a smart contract (FileStorage) that handles file information, fee-setting, file-upload, and price feed integration.
• There is also inclusion of Chainlink dependencies for real-time price conversion (from USD to MATIC).
• Deployment & Scripting Layer:
• The “scripts” directory contains Python scripts (deploy.py, reset.py, update_front_end.py, etc.) which manage the deployment and updates to the front-end artifacts.
• The “build” folder holds deployment artifacts and contract JSONs (used for connecting the front end to the deployed contracts).
• Front-End Application:
• The “front-end” directory contains a React.js application that manages user interactions (uploading files, connecting to MetaMask, etc.).
• It uses several components (Account, FileStorage, Main, etc.), along with Redux for state management, and utilities for IPFS connectivity (via the web3.storage API).
• External Services:
• IPFS service is used to store files (the code explicitly mentions use of web3.storage for interfacing with IPFS).
• External blockchain networks (Ethereum/Polygon based on brownie network configuration and deployment instructions) plus testing networks like Ganache.
Relationships and Interactions
• The front end interacts with the blockchain:
• Users use React components to connect using MetaMask and sign transactions via ethers.js.
• The connection to smart contracts is enabled by the deployed contract addresses and ABIs (transferred from Brownie via “update_front_end.py” and stored in the “artifacts”).
• The smart contract (FileStorage) acts as the backend service:
• It enforces fee uploads and links with Chainlink for price feeds.
• Handles storage metadata (but not the actual file data).
• File uploads are actually stored on IPFS:
• The front end (through a utility file, StoreContent.js) interacts with IPFS using the web3.storage API.
• The deployment scripts (in the “scripts” directory) serve as a bridge:
• They deploy the contracts on local or test networks (Ganache, Polygon Mumbai etc.) and then update the front end artifacts with the correct addresses.
Architectural Patterns and Design Principles
• Separation of concerns between the blockchain backend and the React-based front-end.
• Use of a microservice-like approach: a smart contract “service” for file metadata and fee enforcement, and an external IPFS service for actual file storage.
• The project leverages a clear separation in the code organization by isolating contracts, tests, front end, and deployment scripts.
• Reliance on configuration files (like brownie-config.yaml, .env) to manage environment-specific variables (API keys, private keys, network URLs).
Final Checklist for the Principal Software Engineer
• Each component should have a clear, descriptive label (e.g., “FileStorage Smart Contract”, “React Front End”, “Brownie Deployment Scripts”, “IPFS via web3.storage”).
• Front-end → Blockchain (transaction calls)
• Front-end → IPFS (file uploads)
• Deployment scripts → Blockchain (contract deployments)
• Annotations where necessary to note key functionalities (e.g., “Chainlink Price Feed integration”, “Redux state management”, “API key integration for IPFS”).