Code Monkey home page Code Monkey logo

flightsurety's Introduction

FlightSurety

FlightSurety is a sample application based on Smart Contracts running on the Ethereum blockchain, that simulates an insurance for flights. A graphical UI running in a web browser allows users to use the application.

This application was developped as part of Udacity's Blockchain Developer Nanodegree Program. It is based on scaffolding code initially provided by Udacity, see https://github.com/udacity/FlightSurety.

Install

This repository contains Smart Contract code in Solidity (using Truffle), tests (also using Truffle), dApp (using HTML, CSS and JS) and server app.

  • To install, download or clone the repo, then:

npm install

  • Make sure you already have truffle installed:

npm install -g truffle

  • Launch Ganache with at least 40 accounts.

  • Deploy contracts to Ganache.

truffle migrate --reset

Test the smart contracts

To run truffle tests:

truffle test ./test/flightSurety.js truffle test ./test/oracles.js

Start the server

npm run server

Wait for the message

FlightSuretyServer now listening at http://localhost:3000

before starting the dApp

Start the dApp

npm run dapp

Using the dApp

Go to

http://localhost:8000

Key elements for using the dApp:

  • The dApp requires Metamask to be installed
  • Before starting the dApp, the account selected in Metamask needs to match the first account in Ganache. This account will be assigned to an airline that will be registered (but not funded)
  • Flights and airlines' names are fetched from the server. Airlines addresses Ethereum need to be matched by users to airlines names, using the drop down menu. This information is then stored on the server
  • Flights to be insured can only be selected for funded airlines, for which the airline address has been matched to an airline name
  • Users can request checking the status of any flight they are insured for. Unless the status is UNKNOWN, all passengers that had purchased an insurance for that flight are either credited (if the flight is delayed due to the airline), or their insurance premium is transferred to the insurance. After that, the insurance becomes inactive.

dApp screenshots

alt text

alt text

Resources

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.