{"id":13734092,"url":"https://github.com/bitshares/bitshares-explorer-api","last_synced_at":"2025-10-16T09:37:34.184Z","repository":{"id":46379254,"uuid":"92542877","full_name":"bitshares/bitshares-explorer-api","owner":"bitshares","description":"REST API for BitShares","archived":false,"fork":false,"pushed_at":"2021-10-18T23:50:47.000Z","size":330,"stargazers_count":32,"open_issues_count":17,"forks_count":45,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-08T10:45:53.275Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://explorer.bitshares-kibana.info/apidocs/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitshares.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-26T19:37:21.000Z","updated_at":"2024-07-02T12:17:28.000Z","dependencies_parsed_at":"2022-08-29T05:20:17.616Z","dependency_job_id":null,"html_url":"https://github.com/bitshares/bitshares-explorer-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bitshares/bitshares-explorer-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitshares%2Fbitshares-explorer-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitshares%2Fbitshares-explorer-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitshares%2Fbitshares-explorer-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitshares%2Fbitshares-explorer-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitshares","download_url":"https://codeload.github.com/bitshares/bitshares-explorer-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitshares%2Fbitshares-explorer-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261123875,"owners_count":23113014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T03:00:52.500Z","updated_at":"2025-10-16T09:37:29.137Z","avatar_url":"https://github.com/bitshares.png","language":"Python","funding_links":[],"categories":["Libraries"],"sub_categories":["Python Libraries"],"readme":"# BitShares Explorer REST API\r\n\r\nBitShares Explorer REST API allows your programs to query the blockchain. \r\n\r\n[https://explorer.bitshares-kibana.info/apidocs/](https://explorer.bitshares-kibana.info/apidocs/)\r\n\r\n- [Installation](#installation)\r\n  - [Elasticsearch node](#Elasticsearch-node)\r\n  - [BitShares node](#BitShares-node)\r\n  - [Install BitShares Explorer API and dependencies](#Install-BitShares-Explorer-API-and-dependencies)\r\n- [Usage](#Usage)\r\n  - [Simple running](#Simple-running)\r\n  - [Nginx and uwsgi](#Nginx-and-uwsgi)\r\n  - [Profiler](#Profiler)\r\n  - [Development](#Development)\r\n\r\n## Installation\r\n\r\nThe following procedure will work in Debian based Linux, more specifically the commands to make the guide were executed in `Ubuntu 18.04` with `Python 3.7`.\r\n\r\n### Elasticsearch node\r\n\r\nSome API calls make use of elasticsearch plugins for Bitshares. This plugins are `elasticsearch` and `es-objects`.\r\n\r\nFor elasticsearch installation and usage tutorial please go to: [https://github.com/bitshares/bitshares-core/wiki/ElasticSearch-Plugin](https://github.com/bitshares/bitshares-core/wiki/ElasticSearch-Plugin).\r\n\r\nTo avoid installation the API comes with public elasticsearch node that can be updated from config.\r\n\r\n### BitShares node\r\n\r\nThis API backend connects to a BitShares `witness_node` to get data. Additionally from elasticsearch API makes use of the following bitshares plugins:\r\n\r\n- `market_history`\r\n- `grouped_orders`\r\n\r\nThe node must have `asset_api` and `orders_api` enabled.\r\n\r\n`api-access.json`:\r\n\r\n    {\r\n       \"permission_map\" :\r\n       [\r\n          [\r\n             \"*\",\r\n             {\r\n                \"password_hash_b64\" : \"*\",\r\n                \"password_salt_b64\" : \"*\",\r\n                \"allowed_apis\" : [\"database_api\", \"network_broadcast_api\", \"history_api\", \"asset_api\", \"orders_api\"]\r\n             }\r\n          ]\r\n       ]\r\n    }\r\n\r\nTo install a bitshares node please refer to: https://github.com/bitshares/bitshares-core/blob/master/README.md\r\n\r\nYou can use/change public bitshares API nodes for this by updating the config.\r\n\r\n### Install BitShares Explorer API and dependencies\r\n\r\nInstall python and pip if you dont have them:\r\n\r\n`apt-get install -y python python-pip`\r\n\r\nClone the app:\r\n\r\n    git clone https://github.com/bitshares/bitshares-explorer-api\r\n    cd bitshares-explorer-api/\r\n\r\nInstall virtual environment and setup:\r\n\r\n    pip install virtualenv \r\n    virtualenv -p python3 wrappers_env/ \r\n    source wrappers_env/bin/activate\r\n\r\nDeactivate with:\r\n\r\n`deactivate`\r\n\r\nInstall dependencies in virtual env activated:\r\n\r\n    pip install -r requirements/production.pip\r\n\r\nNote: If you have errors in the output about websocket you may need to also do:\r\n\r\n    apt-get install python-websocket\r\n\r\nNote: If you see a problem similar to:\r\n\r\n     WARNING:connexion.options:The swagger_ui directory could not be found.\r\n        Please install connexion with extra install: pip install connexion[swagger-ui]\r\n        or provide the path to your local installation by passing swagger_path=\u003cyour path\u003e\r\n\r\nYou need to execute:\r\n    \r\n    pip install connexion[swagger-ui]\r\n\r\n## Usage\r\n\r\n### Simple running\r\n\r\nIn order to simply test and run the backend api you can do:\r\n\r\n    export FLASK_APP=app.py\r\n    flask run --host=0.0.0.0\r\n\r\nThen go to apidocs with your IP:\r\n\r\n[http://127.0.0.1:5000/apidocs/](http://127.0.0.1:5000/apidocs/)\r\n\r\n### Nginx and uwsgi\r\n\r\nIn a production environment, when multiple requests start to happen at the same time, flask alone is not enough to handle the load. Nginx and uwsgi are alternatives to host a production backend.\r\n\r\nInstall nginx:\r\n\r\n    apt-get install nginx\r\n\r\nInstall uwgsi:\r\n\r\n    pip install uwsgi\r\n\r\nCreate config file in /etc/nginx/sites-available:\r\n\r\n    server {\r\n        listen 5000;\r\n        server_name 185.208.208.184;\r\n        location / {\r\n            include uwsgi_params;\r\n            uwsgi_pass unix:/tmp/app.sock;\r\n        }\r\n    }\r\n\r\nCreate symbolic link to sites-enabled and restart nginx:\r\n\r\n    ln -s /etc/nginx/sites-available/api /etc/nginx/sites-enabled/api\r\n    /etc/init.d/nginx restart\r\n\r\nNow api can be started with:\r\n\r\n    (wrappers) root@oxarbitrage ~/bitshares/bitshares-explorer-api # uwsgi --ini app.ini\r\n\r\n### Profiler\r\n\r\nTo activate profiler use:\r\n\r\n    PROFILER_ENABLED=true flask run\r\n\r\nThen you will be able to access profiling data at `http://localhost:5000/profiler`.\r\n\r\nBy default the profiler is not protected, to add basic authentification add username and password in `config.py` or using environment variables `PROFILER_USERNAME` and `PROFILER_PASSWORD`.\r\n\r\n### Development\r\n\r\nTo run the server in development mode to have an auto reload on code change:\r\n\r\n    FLASK_ENV=development flask run\r\n\r\nRun all tests:\r\n\r\n    PYTHONPATH=. pytest\r\n\r\nThis will also run API tests (using [Tavern](https://taverntesting.github.io/)), that needs an local server to run, so make sure your development server is started.\r\n\r\nTo run one specific test:\r\n\r\n    PYTHONPATH=. pytest -k test_ws_request\r\n\r\nOr for API tests:\r\n\r\n    PYTHONPATH=. py.test tests/test_api_explorer.tavern.yaml -k get_asset_holders_count\r\n\r\nYou can run API tests on a non localhost server using the command:\r\n\r\n    PYTHONPATH=. py.test tavern-global-cfg=your_customized_environment.yaml tests/test_api_explorer.tavern.yaml\r\n\r\nSee `tests/local_urls.yaml` to see how to define a new environment.\r\n\r\nAnd for non regression see `non_reg/README.md`\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitshares%2Fbitshares-explorer-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitshares%2Fbitshares-explorer-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitshares%2Fbitshares-explorer-api/lists"}