Skip to content

Movie Consensus : A decentralised movie review application on Ethereum blockchain hosted over Rinkeyby network

License

Notifications You must be signed in to change notification settings

aeccodingclub/MovieConsensus

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Movie Consensus

contributions welcome HitCount

It is a demo decentralised application for requesting movie reviews and commenting on the movie card as reviews. The application itself is hosted from a Google Clous Network compute engine. The application contacts with a Smart contract that is hosted in the Ethereum blockchain network. Currently it is hosted over the Rinkeby network. Since Rinkeby is a test network anyone can get eth for publishing reviews over the application. The smart contract are written using solidity and once deployed are immutable. That means now this application belongs to its users. Remember you will need eth to add new data to the smart contract. We will discuss all of these in a while.

This project is part of my internship project at TechVariable

Getting Started

First we need to get clear with the model of how blockchain works.
There is this nice video from 3blue1brown.How cryptocurrency work
Also just for understanding of 256bit SHA that sits at the heart of crypto currency.SHA 256
Since breaking it is computationally hard. Pssst ever heard Quantum computing.

Now if you are clear with crypto currency and what mining is all about we can start with understanding what Ethereum is. In theory Ethereum is also a blockchain implementation that has all the capabilities of the BitCoin i.e first generation of blockchains. Ya there are three generation of them. Ethereum stands in the second one. The second generation of cryptocurrency supports programmable agreement of blockchain state. This is also called the SMART CONTRACT.

This is Vitalik Buterin exmplaining Ethereum Ethereum

You can follow this if you intend to use your own node for setting up the Decentralised Application Setting up Rinkeyby

This is one video series you can look into for ethereum development Coursetro Ethereum beginner course

If you didn't get that then know this Ethereum blockchain nodes i.e the client application running on any computer connected to the internet have the ability to run scripts on its own Ethereum Virtual Machine. EVM is capable of running scripts written in the Solidity language. Now the smart contracts allow you to do conditional transactions. A transaction can be either between two parties i.e accounts over ethereum node for eth or any unit of eth that is token or it can be of the data stored by the smart contract.

ethereum node: Ethereum node is just a machine that have ethereum client installed and is capable of being part of the existing blockchain network.

There are a few prerequisites we need to get cleared with first

Prerequisites

  • Setting up the application as a standalone

    • Remember if you need your application to work without needing to setup a Geth node in your personel server or over the cloud then you will need your users of the application to have installed Metamask plugin in their chrome. Metamask

    • What is metamask?

      Metamask is a web3 injector that allows you to connect to any node of any ethereum network. (test or the homestad)
      Now what is web3. Web3.js. Remember in order to use metamask you must create metamask account and in order to do transaction you much have eth in your account.
      Well web3 is a javscript api for interacting with ethereum node or smart contract hosted over the blockchain that the node is currently part of. It can be used both at the backend i.e from a nodejs server or from the front end as a Javascript plugin ala Jquery. Imagin Web3 as an interface to your current node setup or to any random one if using metmask to inject web3 in your application.

  • Setting up the Ethereum node through GETH installation

    • You can follow the tutorial link given above for setting up the Geth node with rinkeby network. I am using rinkeby only because getting eth over it is pretty easy. Set up geth with rinkeby
  • Development prerequisite
    Install Node

    sudo apt-get install node
    #for arch
    pacman -S node
    #for brew
    brew install node
    
    

    Install bower

    # for brew
    brew install bower
    
    # for node 
    node install bower -g
    
    

    Install Testrpc

    node install testrpc -g
    

    Install http-server (if you do not intend to write node server for deployment purpose)

    node install http-server -g
    

    Remember having your front end application hosted from localhost is important since metamask only injects web3 when the application is hosted.

    Remix browser editor editor

Installing

I will be writing the process down for a terminal oriented approach so most commands since done in node setup should be
same for bothe windows and linux installation

  • have git installed otherwise git clone won't work but you can always download yourself and unzip the package

    git clone  https://github.com/rajatthepagal/MovieConsensus
    
    cd MovieConsensus
    
    http-server -a localhost -p 3000
    

If you now have metamask installed in your browser you can just navigate your browser to localhost:3000 and have metamask point to rinkeyby test network.

And the application should show the view.

For having deployed on your own testrpc

testrpc --seed 10

Then point metamask to locahost:8454

This covers up having this applications frontend deployed on any server or even on own personal network.

Deployment

But we also need to have the smart contract deployed. The smart contract that governs the transaction rule in the
blockchain is to be deployed as follows

  • Get the Remix editor and open the movie.sol file in it. You should have the movie.sol in its editor pane

  • Compile it. Its in autocompile most of the times , but just to be double sure of any errors. Because once deployed
    and mined your contract will remain the part of the blockchain forever and ever with its designated address.

  • In the Run panel to the top right corner you can find all the option regarding which web3 provider do you intend
    to use how much gas you want to give for the contract or which account to use. If using this through Metamask which is
    which again is highly recommended because otherwise you will need to set up your own clients.

  • Configure the above sections and then click on create. That will generate the contract as a block transaction in the
    the network and you must pay with eth for deploying it.

  • Wait for few minutes or hours !!! It will be mined and your contract will be deployed with a particular address. You can
    find this address to the right bottom corner of Run panel. This address is important. Because it will allow you
    to interact with your contract through web3.js.

That is all about Deploying the contract and the application.

Development

If you are familiar with the above procedures and have done them successfully I believe you can start developing your own
your own applications.

I would advice to look at few of these links they should augment your understanding of DAPs a lot

Have a look at the above image. It should a clear understanding from a standpoint of traditional developer of web services who have been working on centralised servers till date.

Bugs and Stuff

Yes they are annoying and get on your nerves. The ethereum VM language is not highly mature when it comes to sending data
From limitation of sending two dimensional data to having querry repeated times for array of data at times.You can send
fixed size arrays but when was the last time it happened in a dynamic system where users and data content is increasing.

Here are few links of common bugs

Built With

Contributing

A simple merge request will do. Will review the stuff and add it. :) Its a demo project none the less.

Authors

  • Rajat Kanti Bhattacharjee

License

This project is licensed under the Apache License - see the LICENSE.md file for details

About

Movie Consensus : A decentralised movie review application on Ethereum blockchain hosted over Rinkeyby network

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 56.7%
  • HTML 31.0%
  • CSS 12.3%