Giter Site home page Giter Site logo

flightsurety's Introduction

FlightSurety

Contracts, Dapp and server App to allow an user buys insurance for a certain flight and gets 1.5X in case flight is delayed due to an airline complication

Frameworks and technologies used

  • Ethereum
  • Solidity 4
  • Ganache CLI
  • Truffle
  • Mocha JS
  • NodeJS

Installation

Install packages

npm install

Run ganache and create 50 accounts (this seed was used in testing)

ganache-cli -m "candy maple cake sugar pudding cream honey rich smooth crumble sweet treat" -a 50

Compile contracts

truffle compile

Test contracts

NOTE: All testing was made using DAPP UI to provide a more realistic approach as rubric and project walkthrough allow, specially to provide an environment to test Oracle funcationallity using server express app

Migrate contracts

truffle migrate

Run UI DAPP

npm run dapp

Run Server (oracles)

npm run dapp

How to test

Before begin Make sure MetaMask is running and connected to Ganache CLI localhost:8545

  1. Run ganache blockchain
  2. Compile and migrate contracts
  3. Run UI DAPP
  4. Run Server
  5. Since a airline is registered at deployment, fund airline with 10 ETH
  6. Register a new flight and refresh page to fill input fields with registered flights
  7. Change to another address using MetaMask (although there's extra code to detect the new address without page refreshing, i recommend to refresh)
  8. Buy insurance (for example 0.5)
  9. Submit oracle request
  10. Change to appropriate addresses and claim ETH

IMPORTANT NOTE

In server.js there's a change to allow faster checking for insurance payment, setting fixed oracle responses to code 20 (due to airline) const statusCode = 20; //(Math.floor(Math.random() * 5) + 1) * 10 This can be changed to adjust to a more realistic approach

Screenshoots

Screenshot

flightsurety's People

Contributors

irq20xdfr avatar

Watchers

James Cloos avatar

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.