Git Product home page Git Product logo

cryto-exchange's Introduction

Cryptocurrency Exchange

User Story

This application implements a prototype for a cryptocurrency exchange. The system has two roles: UserActor and MarketActor.

  • UserActor

  • The UserActor aims to assist users in making the best possible purchase choice. So, when buying BTC, the actor will try to buy at the lowest possible price. The UserActor also maintains user’s account balance in both BTC and USD.
  • MarketActor

  • The MarketActor’s job is to maintain the orderbook by making changes to it as offers are accepted. It will also disallow any invalid trades. The actor responds to Hold/Confirm requests.

This project is inspired by the paper Pardon & Pautasso, 2014, particially implementing a prototype two-phase commit protocol.
This project is built using sbt with Play framework, a lightweight web framework built with Java and Scala. The REST APIs listed below are used for communication with the actors from the outside world. Internal communication between the actors happen through Akka’s messaging system.

How to Run

Play Framework

  • Install latest version of sbt: SBT
  • Clone this repository: git clone https://github.com/ylu36/cryto-exchange.git
  • Go to cryto-exchange folder: cd cryto-exchange
  • Type sbt run to run the application.
  • For stopping the server, Press the Enter key on keyboard.
  • For opening the sbt console, type sbt from the command prompt.
  • There are following APIs present in the web application:
Type Endpoint Description Response
GET / The default Play home page
POST /addbalance/usd/:amount Add the given amount to the user’s USD balance { “status”: “success”}
GET /getbalance Return the user’s USD and BTC balance { “status”: “success”, “usd”: [amount], “btc”: [amount]}
GET /transactions Get a list of successful transactions. {“status”: “success”, “transactions”: [list of transaction IDs]}
GET /transactions/:transactionID Get details of a given transaction “rate”:[in USD per BTC] } or { “status”: “error”, “message”: [error message]}
GET /selloffers Get a list of sell Offer IDs {“status”: “success”,“offers”: [list of sell OfferIDs]}
GET /selloffers/:offerid Get sell offer details. { “status”: “success”,“rate”: [in USD per BTC],“amount”: [in BTC]} or {“status”: “error”,“message”: [error message}
POST /buy/:maxrate/:amount Request a buy transaction, for the given BTC amount at the given maximum rate { “status”: “success”, “transactionID”: [transactionID] } or { “status”: “error”, “message”: [error message] }
POST /debug/confirm_fail After this request is posted, the market actor will reply fail to subsequent Confirm requests without actual processing {status”:“success”}
POST /debug/confirm_no_response After this request is posted, the market actor will not reply to subsequent Confirm requests without actual processing {status”:“success”}
POST /debug/reset After this request is posted, the actor will reset to normal {status”:“success”}

**Note: This project is created in Linux environment; Endpoints tested with Postman.

cryto-exchange's People

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.