FLIGHTINSURRANCE
An Ethereum distributed app that manages insurance for travelers
Install
This repository contains Smart Contract code in Solidity (using Truffle), tests (also using Truffle), dApp scaffolding (using HTML, CSS and JS) and server app scaffolding.
Notes: The project has been tested with Truffle v5.0.4, Solidity 0.5.6
__
To install, download or clone the repo, then:
npm install
truffle compile
truffle migrate --reset --network ganache --firstAirline=FIRST_AIRLINE_ADDRESS --numOracles=NUM_OF_ORACLES
npm run server
Warning: Start the server first because the data contract auhtorization call is made from the servernpm run dapp
The DApp is runing athttp://localhost:8000
Testing
To run truffle tests:
- Update the mnemonic in truffle.js with your key seed.
truffle dev
migrate --reset
test
Feature of the tests:
- Check the operational status of the contracts;
- Funding or ailine;
- Register airlines with the multiparty threshold;
- Flight registration by airline;
- Passenger purchase of insurance;
- Check Oracles registration;
- Watch for FlightStusInfo event;
Deploy
To build dapp for prod:
npm run dapp:prod
Deploy the contents of the ./dapp folder
Using the DApp
Using the DApp is straightforward. Start Metamask, clear the history and use the address of the first ailine.
You can then:
- send fund;
- register flights,
- update the flights lists
- purchase insurance for a spcific flight,
- update the flight status of a specific flight,
- check your balance
- claim your insurance payout
Resources
- How does Ethereum work anyway?
- BIP39 Mnemonic Generator
- Truffle Framework
- Ganache Local Blockchain
- Remix Solidity IDE
- Solidity Language Reference
- Ethereum Blockchain Explorer
- Web3Js Reference
⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐ ⭐
if (_.isAwesome(thisRepo)) {
thisRepo.star(); // thanks in advance :p
}