Link to Notion Docs Page: https://www.notion.so/FileHub-b907091b8c8b4d7bb7f8f7525232580a
Link to Demo Video: https://youtu.be/lkm7k1zyecs
The present-day digital arena faces increasing risks of financial frauds, theft, etc. Such crimes call for reliable ways to safeguard people’s digital assets while transferring them. FileHub is a decentralized solution that would allow users to share only the Encrypted Hash of the file and the recipient can then decrypt it by using their unique key. The service employs IPFS(Inter-Planetary File System) to store the documents in a decentralized database. And the data can be retrieved only by the trusted recipient and the users themselves. The Encrypted Hash of the location of the document on the IPFS is stored on Ethereum using a smart contract.
This project was bootstrapped with Create React App.
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
Note: this is a one-way operation. Once you eject, you can’t go back!
If you aren’t satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
You don’t have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
#FileHub Docs
- Ethereum/Solidity Smart Contracts
- React
- Web3JS
- IPFS(Inter-Planetary File System)
The User has Metamask installed to interact with DApp. The recepient need not have Metamask installed and only needs the Encrypted Hash to interact with the DApp.
The smart contract permanently resides on the Goerli Testnet. The Contract Address is: 0x11783B9A3E4992fdDcea76dd6275Ac659dccD686. Smart Contract was Deployed using Remix IDE.
It can be accessed via Etherscan using the link:
https://goerli.etherscan.io/address/0x11783b9a3e4992fddcea76dd6275ac659dccd686
`pragma solidity ^0.4.17; contract Contract { string ipfsHash;
function sendHash(string x) public { ipfsHash = x; }
function getHash() public view returns (string x) { return ipfsHash; } }`
In this project we used the ipfs.infura.io node to deploy the files and get the Hash.
const IPFS = require(‘ipfs-api’); const ipfs = new IPFS({ host: ‘ipfs.infura.io’, port: 5001, protocol: ‘https’ });
The order of flow of App.js is as follows:
- Set the state variables.
- Capture the User’s file.
- Capture recipient's email
- Convert the file to a buffer.
- Send the buffered file to IPFS
- IPFS returns a hash.
- Get the User’s MetaMask Ethereum address
- Send the IPFS for storage on Ethereum.
- Using MetaMask, User will confirm the transaction to Ethereum.
- The IPFS hash is then encrypted using the recipient's email. The encrypted hash is then sent to the smart contract.
- Ethereum contract will return a transaction hash number.
- The transaction hash number can be used to generate a transaction receipt with information such as the amount of gas used and the block number.
- The IPFS and Ethereum information will render as it becomes available in a table using Bootstrap for CSS. NOTE: I didn’t create an isLoading type variable to automatically re-render state for the blockNumber and gasUsed variables. So for now, you will have to click again or implement your own loading icon.
The recipient can enter the Encrypted Hash for IPFS and their email which acts as the key to obtain the URL of the the file.
Ideally a Unique ID would have been used to encrypt the file before deployment. But as this is just a Minimum Viable Product to show working and proof of concept, we have settled to use the email id of the recipient as the security key.
.png)
.png)
