FlightInsure is a basic Flight Insurance Platform for the passengers:
Buy insurance for your next flight right now with crypto. And claim compensation for any delay by the airline without any hassle. All transactions verified on the Blockchain!
Libraries used:
I used Truffle smart contract development environment to build this project.
To build the frontend I used:
You can clone this repository using Git:
git clone https://github.com/sangeetkar/FlightInsure
# Install dependencies for server
npm install
# Install dependencies for client
npm run client-install
# Install truffle suite
npm i -g truffle
# Use truffle to compile the contracts
truffle compile
# Run Ganache with 50 accounts
ganache -a 50
# Run test cases
truffle test
# Deploy the contracts on Ganache
truffle migrate --reset
# Important: Run the server before the Client
# It will also generate sample flight data to be used by the dApp
npm run server
# Run the dApp
npm run dapp
# Server runs on http://localhost:3000 and client on http://localhost:8000
# Import one of the accounts from Ganache into Metamask to interact with the dApp.
I used the reliable Openzeppelin contracts to pull the following functionalities:
The Data & App contracts are separately deployed so that contracts can be upgraded reliably in the future.
FlightInsureData: The Data contract has all the smart contract data with access control. Most of the functionalities can only be accessed by the App contract.
FlightInsureApp: The App contract has all the application logic. And it calls the Data contract to change state.
The App contract can be upgraded in the future (application logic is what gets upgraded usually). And the new contract can be hooked to the Data contract by calling setApp method on the Data contract.
code in src directory
The Server code creates 20 oracles that
Additionally it also creates sample flight db to be used by the dApp
It was exciting to try svelte for frontend coding. The corresponding code can be found in client/src directory.
The frontend is modular with separate pages to:
Screenshots: