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
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.
- ...
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
After installing all the prerequisites, the following commands can be used to setup and start the project locally:
- 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
- Install dependencies using npm:
npm install
- 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
- Store the Metamask mnemonic in the root of the project in a file called
.secret
. - Start ganache-cli in a separate terminal to run a local blockchain using the same mnemonic as Metamask:
The
ganache-cli -m "$(cat .secret)" -a 50
-a
flag allows you to specify the number of accounts to generate at setup. - Run the test using truffle to verify the smart contracts are functioning as expected:
truffle test --network development
- If all tests are passing, the contract can be compiled and migrated using truffle:
The contracts are now deployed on the local blockchain and the required configuration files and artifacts have been created automatically.
truffle compile truffle migrate --network development
- The front-end application (Dapp) can be started using the following npm command in a separate terminal:
npm run dapp
- 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.
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 used for developing the project:
- ...
The project is heavily based upon FlightSurety, with the modified work by Roald Nefs as part of the Udacity Blockchain Developer Nanodegree Program.