We already have web2 drives where we can store files and share them with users via links, but the problem with this approach is:
→ general lack of privacy
→ no guarantee of data uptime/loss
→ information overload and duplication
… and many more aargh!
<<< Here comes De-File Drive to rescue >>>
What De-File Drive is?
A decentralised file storage system, with secure files, minimum duplication and capability to create groups where we can add our closed ones or the people we want to share the file with.
Features?
-
Group/Private space:
- Users can create groups where they can add members via their wallet address
- Only users who are currently in the group can on-board new members
- There is no hierarchy in group and no admins. Everyone who is added is equal. (still we can create admin functionality in future, for making it more robust and private and also role based access).
- You can only join a group if someone adds you in, no other way!!!
-
File Storage and Management:
- Users can view/download files shared to the groups they are part of.
- Uploaded file is first encrypted, with encryption keys mapped with respective groupId
- The encrypted file is uploaded on IPFS and can be accessed via its CID
- On receiver’s end, file is again decrypted via the encryption key mapped to its group
- A file shared in a group will be visible to all users in the group.
Pre-requisites to use the app?
- Access the app here: https://de-file-drive.vercel.app/
- After onboarding, user would need to connect wallet (tested on MetaMask) to the FileCoin - Wallaby Testnet network
- Make sure to get some TFIL from faucet here: https://wallaby.network/#faucet, to make transactions and to be able to proceed.
How it works and how to use?
Group creation:
- After onboarding user first need to create group.
- Hit Create Group Button and provide some unique groupId/group name.
- After submitting, Sign the transaction and wait for you group to be created.
Add Files:
- Click on your group.
- After Selecting files, firstly the files are encrypted using encryption key associated with the groupId.
- The encrypted files are then uploaded on IPFS and then on FileCoin via web.storage’s JS APIS
- We receive the root CID of the uploaded file.
- Using this CID we can access the encrypted file and decrypt it, via the same encryption key, to show under the Synced Files section.
Add Friends in the group:
- Click on your group.
- Hit Add Friend CTA and enter friend’s valid wallet address
- After submitting, Sign the transaction and wait for your friend to get added to the group.
- Your friend can now see the groups as well as the files shared with them.
Limitation(s)?
- Currently due to FVM limitation of events, polling has been used for checking data availability.
- Error handling for failure scenarios to be tested and managed. (ps: was short of hands)
Hurdles?
We need a better way user and group discovery to make it secure and available at the same time.
Tech behind, how are they pieced and sponsor tech?
-
We used remix for smart contract prototyping and FEVM HardHat Starter Kit for deployment.
-
The smart contract is written in Solidity and deployed on FileCoin Wallaby Testnetwork.
-
Following is the address of deployed smart contract: 0x5b8DfeA556e6EE8401Ea4C0884a5B43AE5462931
-
The client is built using Next.js - a framework powered by React.js with out of the box support for SSR and SSG
-
web3modal is used to be able to interact and connect wallets.
-
To communicate with our deployed contract and execute the methods exposed by the contract’s ABI we used ethers.js
-
To communicate with IPFS and retrieve the contents CID post uploading it we used web3.storage, also it helps to store the file on FileCoin.
-
Files metadata as well as its encryption key is stored on the FileCoin blockchain to perform on-chain computation on the state data.
-
Deployment of App is managed by vercel and CI is configured with Github.
-
We used various other open source libs and design patters to build the neat UI and performant app.
How I'm impressed?
I am impressed by fact that tools which are used are all open-source and even the contract is public, but still the data is hidden and seems to be private within my network of users!
Glossary:
SSR - Server Side Rendering,
SSG - Static Site Generation,
ABI - Application Binary Interface,
FEVM - FileCoin Ethereum Virtual Machine,
CID - Content Identifier