/devault

A decentralized alternative to proprietary and centralized cloud storage.

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

Devault

A Blockchain-based, self-hosted, and end-to-end encrypted cloud storage.

maintenance website license release contributors pull-request style docker languages code-of-conduct quality commits lines-of-code chat
Youtube Video · Ropsten Faucet · Live Instance

If you have any improvements, do not hesitate to post an issue or make a pull request.

Your support is very much appreciated! star on GitHub

⚠️ Active development. Unstable. Breaking changes. You get the point. ⚠️

📜 Table of Contents

🎉 About the Project

Devault stands for DEcentralized VAULT

📷 Screenshots

landpage landpage

🎤 What is Devault

Devault is a decentralized, self-hosted, and end-to-end encrypted alternative to proprietary and centralized cloud storage.

🔍 Why Devault

👎 The Problem with Traditional Cloud Storage

  • Data loss
  • Data hack
  • Data surveillance

👍 The Solution with Devault

  • No third party can access your files or prevent you from accessing them.
  • It prevents the censorship of the data.
  • It's nearly impossible to hack AES-256-CBC encryption or even the blockchain.
  • It prevents the data from being tampered with.
  • It breaks apart the users’ files and distributes them across multiple nodes on the network.
  • The smart contract is upgradeable, so the data is never lost when there is a bug fix.

🙈 Features

  • Decentralized
  • Blockchain based
  • End-to-end encryption/decryption
  • Self-hosted
  • Open-source

🔐 How Devault Works

When you upload a file:

  • The file gets encrypted using AES-256-CBC encryption.
  • The encrypted file is split into pieces.
  • The chunks are distributed across the network nodes.
  • The root hash will be stored in your wallet on the blockchain.

When you download a file:

  • The root hash will be retrieved from your wallet on the blockchain.
  • The root hash will be used to retrieve the file chunks.
  • The retrieved chucks will be combined and decrypted to represent the original file.

🛠️ Tech Stack and Tools

The tools used in this project.

Tool Description
Neovim IDE
Next.js Full stack framework
Hardhat Framework for developing, testing, linting and deploying smart contracts
Solidity The smart contract language
Metamask Web3 provider
Ethers.js Library for interacting with the Ethereum blockchain
Ropsten Testnet for deploying smart contracts
Infura Blockchain node as a service to deploy the smart contracts through it
IPFS Storing, retrieving and sharing the encrypted files
Jest Unit testing and code coverage
Etherscan Verifying transactions and blocks
Vercel Production deployment
Docker Deploying and shipping the app for production

🪜 Source Code Directory Structure

A quick look at the top-level files and directories:

.
├── __tests__
├── artifacts
├── components
├── contracts
├── docker-compose.yml
├── Dockerfile
├── docs
├── hardhat.config.js
├── jest.config.js
├── next.config.js
├── out
├── package.json
├── pages
├── public
├── scripts
├── SECURITY.md
├── styles
├── .github
└── utils
    1. __tests__: contains all the unit tests
    1. artifacts: produced by hardhat after compiling the smart contracts and containing smart contracts ABIs.
    1. components: contains all the React components.
    1. contracts: contains all the smart contracts source code.
    1. docker-compose.yml: docker-compose file for serving the production build.
    1. Dockerfile: docker file for building and running next.js app used by docker-compose
    1. docs: contains all the source code documentation.
    1. hardhat.config.js: hardhat config file
    1. jest.config.js: jest config file
    1. next.config.js: next.js config file
    1. out: produced by npm run build2 and contains a static site.
    1. package.json: npm package manager config file
    1. pages: contains all pages routes
    1. public: contains all the assets (ex. images, fonts...)
    1. scripts: contains all the scripts used to automate the development process (ex. deploy, logger...)
    1. SECURITY: defining which version receives updates.
    1. styles: contains all page styles.
    1. .github: contains automated workflows (CI/CD).
    1. utils: contains all javascript functions used by other components.

🚴‍♂️ Getting Started

🟡 Prerequisites

📦 Package Manager

This project uses npm as a package manager

pacman -S npm

🔑 Environment Variables

To run this project, you will need to add the following environment variables to your .env file

PRIVATE_KEY ROPSTEN_URL

To generate those keys you will need to:

    1. create infura account
    1. create a new Ethereum node
    1. copy the private key to .env
    1. copy ropsten url to .env

SMART_CONTRACT_ADDRESS_ROPSTEN

This variable will be set later by the deployment script

🔧 Run for Development

  • Clone the repo
git clone https://github.com/AbdeltwabMF/devault.git
cd devault
  • Install dependencies
npm ci
  • Run the development server and local blockchain node.
npm run deploy localhost
  • Navigate to http://localhost:3000

🟢 Now you're good to go

💉 Run the Tests

  • Run the smart contracts test
npx hardhat test
  • Generates a code coverage report for smart contracts test
npx hardhat coverage
  • Run the whole project tests
npm run test

✨ Deployment | Hosting

  • Deploy using source code and docker
git clone https://github.com/AbdeltwabMF/devault.git
cd devault
docker-compose up --build --force-recreate -d
  • Deploy using official docker image hosted on docker hub
docker container run -p 3000:3000 -d abdeltwabmf/devault
  • Deploy using vercel
npm i -g vercel
vercel --prod
  • Deploy using static site generation

The generated static site will be in the out directory (ex. use nginx to serve it)

npm run build2

🤔 Usage

    1. Create an Ethereum wallet using metamask extension.
    1. Open devault website.
    1. Click connect wallet and follow the steps.
    1. Make sure you're on the ropsten network. (settings > advanced > show test networks)
    1. Go to ropsten faucet and paste your address to get some ethers. (used for transactions)
    1. Navigate to The Vault tab.
    1. Pick a file and press upload.
    1. Give a passphrase to encrypt the file. (you can use different passphrases for different files).
    1. Once the file is successfully uploaded it will appear on the same page with the option to download.
    1. When downloading give the same passphrase you entered when uploading the file.
    1. The file is now being downloaded.

💡 FAQ

Why metamask?
  • It's the most popular wallet out there, and it's the only wallet supported by the current version of devault.
Is it possible to upload files without ethers?
  • No, you should have some ethers to be able to write files' metadata to the blockchain.
What happens when I switch to another account
  • The files that is related to that account will be retrieved instead of the previous one.

⛑️ Future Work

  • Arabic version.
  • Client-side encryption/decryption.
  • Upload a file.
  • Delete a file.
  • Download a file.
  • Secure file sharing.
  • Delete selected files.
  • Search files.
  • Change passphrase.
  • Compress files before uploading.
  • Sort files based on (date, size, name...)
  • Upload folders.
  • Download selected files.

♥️ Community

The Devault community can be found on:

Where you can ask questions, suggest new ideas, and get support.

💎 Acknowledgements

🍭 Softwares

👷 Engineers

📚 Tutorials

View

🐣 Contributors

Abdeltwabmf
Abd El-Twab M. Fakhry

⚠️ License

Licensed under the GPL-v3 License.