ratnim / SelfawareMonopoly

Im Rahmen des Seminars Games of Life des HPI SS 2018, soll das Projekt mit Hilfe eines übergriffigen Systems ethische Fragen bezüglich intelligenter Systeme beantworten
MIT License
2 stars 0 forks source link

Implement a Rest-Client #67

Open Highlife1911 opened 6 years ago

Highlife1911 commented 6 years ago

We need a Rest-Client to implement our Watson component. The Client should run inside the server and should simplify Rest Communication. It should take a request url to a http or https resource. This resource should be queried and the result should be made available in some way. The subtasks are:

Tobias1595 commented 6 years ago

Basic implementation is done, tested manually. Coinhive balance method is done and should work. Unit tests come next. A few questions remain:

Highlife1911 commented 6 years ago

Please upload your state and create a pull request.

Highlife1911 commented 6 years ago

Parsing should be done to the point that we don't test their api: So if we expect that the service returns a number it is sufficient to just cast to int. But in no cases should our implementation crash/hang because of a malformed input or when the service in unavailable.

To store the key it is probably the easiest to use a private.json that contains all private keys we need.

Revised To Do List:

The class should query the balance of user using top at a fixed rate (like once every minute). Then it should withdraw the maximum amount possible, but keep it to a multiple of a fixed constant like 1024 (If a user has a balance of 2304, only withdraw 2048). Then the class should emit a signal like addCoin that contains the username and the amount of blocks mined (2 in the above example).

The class should work asynchronous (probably with a QTimer), so it can be instantiated somewhere and notify mining activity to Watson. The implementation of Watson is not your task. In case of error just do something reasonable: When coinhive servers are down or the private key is missing, just print something using qDebug() and not quit the application.