GithubHelp home page GithubHelp logo

jackjdleslie / scanthesky Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 150 KB

Ðapp to facilitate confirmation of bookings redirected from Skyscanner to airline websites

License: MIT License

JavaScript 66.05% CSS 17.12% Solidity 16.83%
dapp ethereum truffle skyscanner webpack hackathon

scanthesky's Introduction

scanthesky (STACSHack 2018)

Ðapp to facilitate confirmation of bookings redirected from Skyscanner to airline websites

Getting Started

You'll need all the files from the repo to run both a webpack dev server and a separate node app

Requirements

  • Truffle
  • Node / NPM

Migrate contracts

This project assumes truffle develop is used, so to migrate accordingly:

truffle develop

then

migrate

Starting the front-end

To run and serve the front-end on http://localhost:8080:

npm run dev

(note: if you want to simulate being logged in, add a query parameter user_id with the id you want to use - for example http://localhost:8080?user_id=testuser)

Watching for smart contract events

To obtain the data from the emitted smart contract events:

node watch.js

What is it?

The front-end is a simulation of the Skyscanner website redirecting to an external airline provider's website (in this case Ryanair). As the user, you have just chosen a flight deal on Skyscanner's website, and are ready to be redirected to the Ryanair website to book the deal.

From Skyscanner's perspective, after you redirect they don't know whether or not the flight ever gets booked - just that the user was redirected.

How does this fix the problem?

This simulation shows this described situation, except when the user is redirected the booking number and the user id are send to a smart contract to create an unconfirmed booking.

When the user then confirms the booking on Ryanair's end, the booking number, the user id and the airline id (which have been passed via query parameters) are sent to the same smart contract to check if there is an unconfirmed booking with this number, and if there is to mark it as confirmed.

This solves two problems:

  1. Skyscanner can now look at the emitted events from the contract, and see when a booking has been confirmed
  2. Ryanair can look at the emitted events as well, and see if a certain user has booked with them through Skyscanner before, and if so then how many times

Does this need Ethereum?

It's not the only solution to the problem, however using a smart contract means that:

  1. Neither party has to worry about creating an endpoint to query about this data, or worry about storing this data - this is processed and then emitted by the smart contract, which doesn't need to be stored by either party
  2. It provides a way to benefit both parties - while at first it would only initially benefit Skyscanner (with seeing confirmed bookings), it also benefits the external airline as they also get access to the smart contract data (as described previously)

In addition to this, the project was created at a hackathon by people who wanted to learn more about smart contract development, as well as tackle a real problem that Skyscanner have.

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.