Application backend for Casper-Bot-Optimized-Validator-API. Capser Bot Optimized API provides information about active validators working on Casper Network. Project is being developed with Python by using Flask framework,and under Apache 2.0 License.
Auto generated API documentation can be found and API endpoints can be tested here.
When API is deployed, API end point for the documentation will be ip-of-the-server:port/swagger-ui/#/.
Python3, pip and make packages should be installed on your system.
Download and run the mongo db server from official website.
Also, in the Install DB File it is explained how to install and configure DB on MacOS as an example.
Clone the repository.
git clone https://github.com/furkanahmetk/Casper-Bot-Optimized-API.git
Configure src/config.py file according to mongo db port. Make sure that the port you have set is open. Config file's default configuration is as below:
DEBUG = True
TESTING = False
MONGO_URI = 'mongodb://localhost:27017'
DB_NAME = 'bot_optimized'
To build and run the project
cd /path-to-your-clonned-repository
make run
To run tests
cd /path-to-your-clonned-repository
make test
If you can't reach your API, make sure that the port(5555 as default) you have set is open.
curl -X GET "http://<api-server-ip>:<port>/delegationRate?pubKey=<publickeytoquery>" -H "accept: application/json"
curl -X GET "http://<api-server-ip>:<port>/state?pubKey=<publickeytoquery>" -H "accept: application/json"
curl -X GET "http://<api-server-ip>:<port>/totalDelegators?pubKey=<publickeytoquery>" -H "accept: application/json"
curl -X GET "http://<api-server-ip>:<port>/totalStake?pubKey=<publickeytoquery>" -H "accept: application/json"
Using Auto Generated API endpoint :
Click on the method that you want to test.

Enter the public key that you want to query and click execute button.

