Giter VIP home page Giter VIP logo

battleship's Introduction

DApp Battleship

A distributed app made on Solidity using smart contracts

Cloning the repo

To clone this repo, use either of the given commands

$ git clone https://github.com/abhigyanghosh30/DApp_Battleship.git $ git clone [email protected]:abhigyanghosh30/DApp_Battleship.git

Installation

The app requires 3 things to be installed:

  1. React (for frontend)
  2. Ganache (to run a test blockchain)
  3. Flask and py-solc(backend to deploy contracts and assign opponents automatically)

The instructions here are valid for Linux systems only

1. React

To install the frontend and the required modules, go to the folder ./frontend/ and run: $ npm install

2. Ganache

To install Ganache, you can download the AppImage from this link Or if you have npm installed, you can install Ganache-CLI by running: $ npm install -g ganache-cli

3. Flask and py-solc

To install the backend and all the required packages, it is recommended to use a python environment wrapper. Inside the wrapper run $ pip install -r requirements.txt

We are not done yet. We need to install the py-solc compiler also before we can get started. The contract used by this app was built on solc v0.4.24 and is compatible with any solc compiler for v0.4.x. To install this, run: $ python -m solc.install v0.4.25 $ export SOLC_BINARY="$HOME/.py-solc/solc-v0.4.25/bin/solc"

Testing

The code is configured for localhost testing out of the box. To deploy it on public servers, you just need to change the server IP addresses.

1. Start Ganache

To run Ganache, simply go to the folder where you have the Ganache AppImage downloaded and run: $ ./ganache-<version>-linux-x86_64.AppImage or run $ ganache-cli --port=8545

2. Start Flask Server

To start the python server run

$ cd webapp
$ python main.py

3. Start React Server

To start the React server run

$ cd frontend
$ npm run start

By default, the app will start at port 3000. Your default browser should open a new tab on http://localhost:3000 after React finishes compiling.

Deployment

1. Deploying Flask

To deploy Flask on a public server, you can follow these tutorials Before deploying, configure the IP addresses to the IP of the corresponding Ethereum networks.

2. Deploy React

To deploy React on a public server, you can follow this tutorial Before deploying, configure the IP addresses to the IP of the corresponding Ethereum networks. Also change the IP address of the Flask App aptly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.