D-Stream - Blockchain based decentralize video streaming platform

Overview:

There are a lot of buzz going around in the Blockchain space. No doubt it is a very robust technology that resembles the internet in the early ‘90: It packs the potential to change the way we live, work, consume and interact. As a lot of Dapps - Decentralize applications, Blockchain based applications, are being developed these days, it is very important to think of what are the use cases that should go for Blockchain and what should not or not needed. I won’t talk about it much on this blog but I will try to give you a basic idea. So there can be basically, two types of Blockchains, one is Enterprise Blockchain and the other is Regular Blockchain.

Enterprise Blockchain, like Hyperledger, is focusing predominantly on private or permission blockchains. These have a chain of blocks (that each contains a number of transactions) but access (ability to transact and verify transactions) is restricted to a finite number of participants. In Enterprise blockchain apps, you can categorize a user based on his/her roles.

Bitcoin and Ethereum are public blockchains or regular blockchain. There are no restrictions in terms of those who can transact on it, view it or verify it. In such blockchains, there is no concept of roles or user groups. All users have same or equal rights in the network. There is no concept of admin either.

Now it depends on use cases, to what category they fall in. Like the one which we had chosen,‘video streaming app on blockchain’ is clearly falling under Regular blockchain. We are using Ethereum as a blockchain platform for this application. Since we wanted to understand how Ethereum ecosystem works and how dapps behave, we created an Ethereum private network with 5-10 mining nodes running all the time and we called it ‘Pramethi Network’. Isn’t it a cool name? :)

Our objective was not to search solutions to non-existent problems rather solving the actual ones. As we know online video streaming industry worldwide is worth hundreds of billions of dollars but there are many problems that are lying in current centralized system. Let’s talk about these problems first, then we will see how blockchain is helping us to solve these issues.

Problems in the current model

  • The video platforms existing today take the lion’s share of the money received from advertisers, and video creators only receive about 40%-50% of it. At the moment largely centralized video streaming platforms take 50-60% of total advertiser spend. Which means that content creators are not getting properly paid as they should be.
  • Many people would like to earn by creating high-quality video content but they don’t, as centralized platforms take up to 60% of the profits, and it is simply not profitable to create high-quality video content.
  • As these systems are being controlled by a centralize authorities, they can do whatever they want to those valuable contents. Like, any video creator’s channels can be closed at any time without proper explanations.
  • People should be allowed to express their opinions freely, without fear that their opinions can be removed anytime.
  • In centralized systems, there is always a risk of single point of failure. Their server can go down or can be hacked.
  • From user’s (content curator) perspective also if we try to think, user attention is the most valuable resource, for which any and every advertiser competes. Many of them watch dozens of videos on different video platforms every day, whose owners earn on advertising hundreds of billions of dollars a year. Being a valuable resource, user attention is exploited without proper compensation.

Overview of D-Stream

Before I talk about solutions to the above problems, allow me to explain what D-Stream is? D-Stream is a video sharing web application powered by Blockchain. It allows users to upload, view and contribute to the creator.

The application is divided into three simple modules :

  1. User onboarding module.
  2. Content creation module.
  3. Content contribution module.

User onboarding

One of the major problem that we think in the blockchain based apps or rather dapps, is to develop onboarding module. It seems that applications have to be strongly coupled with some wallet. So that coders can only focus on the app development without worrying about maintaining public-private key set and other cryptography stuff. We used Metamask to for this task to accomplished. Please learn how Metamask works before proceeding further from here.

Steps required to onboard a user: - A user should have Metamask installed on his system and logged into. - A user should connect to the Pramethi Network and should have some ether into his account or else we can send some pre-mined ether to them to play around in the application. - On clicking ‘Login’ button, Metamask popup comes up where the user has to sign the transaction. Signing transaction does not mean that storing any kind of info on blockchain via smart contracts. It is needed just to ensure that this user is valid. Once the transaction is signed, the app will let the user enter.

Note : - Metamask is a plugin that is available for Chrome and Firefox as of now. - Metamask maintains public-private key in the local computer only, so it’s secure to use Metamask.

Content creation

Steps to create a content: - The user has to press the ‘Upload’ icon, present in the top right corner of the app, to go to the upload page. - Select/Drag-drop a video and fill all the necessary details in the form and press ‘Upload’ button. - ‘Upload’ button will only be enabled if the user has filled all the details correctly. - On pressing the upload button, first the content gets uploaded to IPFS then, Metamask popup will come for asking the user to submit the transaction. - Uploading a content is not free, the user has to pay some ether(for example $4 or 0.01Eth) to submit this transaction, which he can see in that Metamask transaction popup. - On submission, blockchain specific task like mining will happen in the background (one can see it in the geth console) and after successful verification of the transaction, the user will be able to see the content in the home page under related tag section.

Content contribution

One can also contribute/donate/tip (here we call it Clap) to the content he liked by sending some ether(for simplicity we fixed it to $1 or 0.0025Eth) to the creator. The contributor can clap one or multiple time if he wants to.

  • Click on the content on the homepage, to go to video player page.
  • Clicking on ‘Clap’ icon, Metamask popup will come to submit the transaction. For every clap, user has to pay 0.0025Eth.
  • Press submit once the transaction gets verified, you can see the clap count increased and your money gets transferred to the creator.

Screen Shots

See screenshots below to get the feel of how this application looks like.

Welcome Page

WelcomePage

Metamask popup to sign the transaction

On pressing ‘Login’ button, a user can see the popup for the first time.

signtran

Home Page

Once the user into the system will get to see the home screen

HomePage

Upload Page

uplaod

Video player page

Here a user can watch a video and can clap/donate to the creator.

vidplayer

Tech Stack

  1. Backend: Ethereum Private Blockchain
  2. Middleware: Firebase
  3. Communication protocol: Whisper
  4. Blockchain Development framework: Truffle
  5. Frontend: React
  6. File System: IPFS

System Architecture

systemarch

How D-Stream can solve or is solving these problems

First of all, I want to put a disclaimer over here that, since D-Stream’s development is in a very early stage, it’s not solving all the above problems. It is catering few of them for now. But yes, with D-Stream, we have the vision to solve most problems which exist in the current centralized model.

  • Transparency: In centralized systems, as the user has no transparency on the number of likes, dislikes or subscribers etc which they are showing on the website for a content. One can never know, these counts that they are showing is correct or not. D-Stream, being built on the blockchain, one can go and verify these at any point in time.
  • Incentive: If one likes a content and if he wants to contribute to that content by paying some money, he would never know that the amount which he is sending to for that content is actually going to the creator as there is an involvement of middlemen. D-Stream provides you a peer-to-peer platform, where you can directly talk to the creator and tip for the content you like. There are no middlemen involved here.
  • Trust: In D-Stream, being built on the blockchain, there is the guarantee that your content is safe as we know blockchain is an immutable system.

How can I use D-Stream?

D-Stream is live and can be accessed using this link within Pramati offices across the globe. The application is not for the public because we are still testing it.

Steps to use the app: - Open D-Stream - Install Metamask and create an account. - Add Pramethi Network, url: http://172.17.10.108:8545/ ‘ in Metamask and select that network in Metamask. - Initially, you won’t be having any ether, you can check this in your wallet page or in Metamask itself. - Send your address to us via mail, we will send you some ether from miner accounts. - Now use the platform.

How can I become a miner and participate in the Pramethi Network?

  • Install Geth
  • Create a folder and copy the genesis.json file from here and put it into that folder.
  • Initiate a geth instance geth init genesis.json --datadir chaindata
  • Run Geth. Make sure to change the IP and port of your own machine. geth --rpc --rpcaddr 172.17.2.50 --rpcport 8545 --rpccorsdomain "*" --datadir chaindata/ --networkid 9876 --port 3030 console
  • Create a new account. personal.newAccount("password")
  • Set miner etherbase. Change the account address. miner.setEtherbase("0xac63712ce626e76a88f941fca4674d37ca8fe3c1")
  • Start mining miner.start(1)
  • Check the balance after sometime. eth.getBalance("0xac63712ce626e76a88f941fca4674d37ca8fe3c1")
  • Adding main node as peers. admin.addPeer("enode://fa4f8127a41d30ab255626981ba02238e615bbace053c372cce80af618210ef19b32a7dec381e8567773a0f8ccff84aea2437ef76372519f48ee8e9f57f02f76@172.17.10.108:3030")
  • Check the peers. admin.peers
  • Now import account in Metamask, connect to ‘Pramethi Network’ and start using the application.

Economic Model

We implemented a very simple economic model in D-Stream for the sake of simplicity. Like for uploading, a user has to pay $4 or 0.01Eth and for clapping $1 or 0025Eth.

Future Scope

This dapp will evolve in future for sure. In the near future, we have plans to add few more modules like advertisement, lottery, content sharing, creating and subscribing playlists and many more. We are also planning to implement a DTOKEN - an ERC20/ERC721 Ethereum based tokens, instead of ether for incentivization as they will have value outside the ‘Pramethi Network’.

Team

  • Akhil Pillai (lead)
  • Manikandan P.
  • Muralikrishna Govindarajulu
  • Balaji Rajendran
  • Ibrahim Sulaiman
  • Abhijit Sinha (Solidity)
  • Manoj Kumar Mirzapure
Vishwas Bhushan avatar
About Vishwas Bhushan, "Vishwas"
Member of blockchain team at Imaginea