This project is a decentralized file storage system built using Ethereum blockchain, IPFS, and React. It allows users to upload, retrieve, and manage files with version control capabilities.
- Upload files to IPFS and store metadata on Ethereum blockchain
- Retrieve files from IPFS using blockchain metadata
- Version control: upload multiple versions of a file
- View version history of files
- Revert to previous versions of a file
- Delete files
- Basic CSV data visualization for uploaded CSV files
This project implements client-side encryption to ensure the highest level of data privacy:
- Files are encrypted in the browser before being uploaded to IPFS.
- The encryption key never leaves the user's device.
- Files are automatically decrypted in the browser when retrieved.
- Uses AES encryption from the crypto-js library.
This approach ensures that even if the IPFS network or the blockchain were to be compromised, the file contents would remain secure. Only users with the correct encryption key can view the decrypted contents of the files.
- Solidity for smart contracts
- Foundry for Ethereum development environment
- IPFS for decentralized file storage
- Node.js and Express for the backend server
- React for the frontend
- Ethers.js for Ethereum interaction
- Recharts for data visualization
- Tailwind CSS for styling
- Node.js (v14 or later)
- npm
- Foundry (for Ethereum development)
- IPFS Desktop
-
Clone the repository:
git clone https://github.com/yourusername/decentralized-file-storage.git cd decentralized-file-storage
-
Install backend dependencies:
npm install
-
Install frontend dependencies:
cd client npm install
-
Compile and deploy the smart contract:
forge build forge create src/Contract.sol:FileStorage --interactive
Note the deployed contract address.
-
Update the contract address in
server.js
:const contractAddress = "YOUR_DEPLOYED_CONTRACT_ADDRESS";
-
Start the IPFS Desktop application.
-
Start the backend server:
node server.js
-
In a new terminal, start the React app:
cd client npm start
-
Open your browser and navigate to
http:https://localhost:3001
- Upload a File: Enter a file name, select a file, and click "Upload".
- View Files: The list of uploaded files is displayed on the main page.
- Retrieve a File: Click "View" next to a file name to retrieve its content.
- Delete a File: Click "Delete" next to a file name to remove it from the system.
- View Version History: After retrieving a file, its version history is displayed.
- Revert to a Previous Version: In the version history, click "Revert" next to the desired version.
- CSV Visualization: If the uploaded file is a CSV with specific headers (created_at, temperature, humidity, distance), a chart will be displayed after retrieval.
src/Contract.sol
: Solidity smart contract for file metadata storageserver.js
: Express server handling IPFS and Ethereum interactionsclient/src/App.js
: Main React component for the user interfaceclient/src/CSVAnalysis.js
: React component for CSV data visualization
- User authentication and authorization
- Advanced search and filtering options
- Folder structure for better file organization
- Diff view between file versions
- Mobile-responsive design
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.