DEV Community

loading...

Building Decentralized Applications with Data Ownership

hkedia profile image Harsh Kedia ・2 min read

My Final Project

The final project consists of two applications for decentralized file sharing. The main aim was to analyze the state-of-the-art in decentralized applications platform.

Demo Link

https://file-share-dapp.herokuapp.com/
https://dshare-blockstack.herokuapp.com/

Link to Code

GitHub logo hKedia / dShare

Secure File Sharing with time-stamping using IPFS, Ethereum and Bitcoin

DOI

Local Setup

Downloading dependencies

  1. Clone the repo using git clone and cd into the folder
  2. Run npm install to download all the dependencies

Compiling the smart contract

  1. cd into the ethereum folder and run node compile.js

Above command will compile the contract using solc and outputs the json files under ethereum/build

Deploying the smart contract to Rinkeby

Before deploying the contract, you need to set the WALLET SEED and the RINKEBY network url inside the file ethereum/deploy.js

The WALLET SEED is the 12 word mnemonic phase for your wallet The RINKEBY network url can be obtained by signing up at Infura.io

Once the values are set run node depoloy.js under ethereum folder.

When the contract is successfully deployed, above command console logs the contract address of the newly deployed contract.

Note this contract address as this needs to be set in the .env file

Process environment variables

Rename .env.default to…


GitHub logo hKedia / dShare-blockstack

A Decentralized file sharing application built using Blockstack

Local Setup

It's a next.js project, using a node server. Next.js uses React.

Installation

To use this project, you'll need to install few things first.

Installing MongoDB

You need to have MongoDB running locally on your machine. Community edition of MongoDB can be downloaded from here.

If you have MongoDB already installed, make sure it's version 3.6 or higher Here's MongoDB is used to run a radiks server, which helps in quering and indexing the data stored on user's gaia hub. Curious about how radiks work? GitHub

Installing Node.js

Node.js is required to run this project. LTS version should work fine for this project, download it from here This project was tested with node.js version 10.15.0

Intalling yarn

Yarn is a package manager similar to npm.

Downloading the project

Open the terminal and download the project using git. Once the project is downloaded, run yarn to download all…

How I built it (what's the stack? did I run into issues or discover something new along the way?)

  1. dShare - Next.js was used for frontend. Smart contracts on Ethereum. IPFS for storage. Metamask was used for interacting with the application. However, it does not expose the private key of the user. Hence, whenever a user wants to download a file, he must provide the private key manually.

  2. dShare-Blockstack - Blockstack as the base platform. Next.js for the frontend.

The application on Blockstack was 4 times faster than the application built on Ethereum. It also conveys that Smart Contracts are not always required for building a dApp.

Additional Thoughts / Feelings / Stories

The main insight from the project was the concept of a Self-Sovereign Identity. This makes possible to build a Web without usernames/passwords.

Discussion (0)

pic
Editor guide