roaldnefs / flight-surety

Flight delay insurance Dapp with multiple smart contracts which are autonomously triggered by external sources, and which handle payments based on flight delay scenarios.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GitHub license GitHub contributors
Flight Surety is a flight delay insurance Dapp with multiple smart contracts which are autonomously triggered by external sources, and which handle payments based on flight delay scenarios.
Quick Start »
Report Bug · Request Feature

Introduction

Flight Surety is a flight delay insurance Dapp with multiple smart contracts which are autonomously triggered by external sources, and which handle payments based on flight delay scenarios. This repository includes:

  • Multiple smart contracts written in Solidity.
  • Automated contract testing using Mocha and Chai.
  • ...
⚠️ Notice: For development purposes only!

Prerequisites

Before running the Flight Surety project make sure the following dependencies are installed:

  • Node v16.1.0
  • Ganache v2.5.4
  • Solidity
  • Truffle v5.3.4
  • Web3.js

Getting Started

After installing all the prerequisites, the following commands can be used to setup and start the project locally:

  1. Start by cloning the project using git (or download and extract the ZIP file from GitHub):
    git clone git@github.com:roaldnefs/flight-surety.git
    cd flight-surety
  2. Install dependencies using npm:
    npm install
  3. Setup Metamask and configure a local network using the following settings:
    Network Name: Localhost 8545
    RPC URL: http://localhost:8545
    Chain ID: 1337
    Currency Symbol: ETH
    
  4. Store the Metamask mnemonic in the root of the project in a file called .secret.
  5. Start ganache-cli in a separate terminal to run a local blockchain using the same mnemonic as Metamask:
    ganache-cli -m "$(cat .secret)" -a 50
    The -a flag allows you to specify the number of accounts to generate at setup.
  6. Run the test using truffle to verify the smart contracts are functioning as expected:
    truffle test --network development
  7. If all tests are passing, the contract can be compiled and migrated using truffle:
    truffle compile
    truffle migrate --network development
    The contracts are now deployed on the local blockchain and the required configuration files and artifacts have been created automatically.
  8. The front-end application (Dapp) can be started using the following npm command in a separate terminal:
    npm run dapp
  9. The back-end server (oracles and API) can be started using the following npm command in a separate terminal:
    npm run server

To interact with the smart contract and Dapp open http://localhost:8000/ in a browser with the Metamask extension installed and configured for the local blockchain.

API

The back-end server (oracles and API) runs on port 3000 by default. The API contains the following endpoints:

  • /flights: list all the registered flights.

Resources

Resources used for developing the project:

  • ...

Acknowledgement

The project is heavily based upon FlightSurety, with the modified work by Roald Nefs as part of the Udacity Blockchain Developer Nanodegree Program.

About

Flight delay insurance Dapp with multiple smart contracts which are autonomously triggered by external sources, and which handle payments based on flight delay scenarios.

License:MIT License


Languages

Language:JavaScript 38.7%Language:HTML 36.8%Language:Solidity 24.5%