Author Topic: Bitshares HUG REST API  (Read 1082 times)

0 Members and 1 Guest are viewing this topic.

Offline Customminer

  • Hero Member
  • *****
  • Posts: 595
  • Bitshares FTW!
    • View Profile
  • GitHub: grctest
Bitshares HUG REST API
« on: December 27, 2017, 03:24:07 am »
Hey,



I've created a REST API using HUG for Bitshares over the last few days. You can't control the wallet, but you can access all data on the blockchain through get requests now.

It's fully open sourced & documented in a manner to improve ease of implementation.

Would you use this tech?

https://github.com/BTS-CM/Bitshares-HUG-REST-API

https://steemit.com/bitshares/@cm-steem/initial-release-bitshares-hug-rest-api

Offline fav

  • Administrator
  • Hero Member
  • *****
  • Posts: 4251
  • No Pain, No Gain
    • View Profile
  • BitShares: fav
Re: Bitshares HUG REST API
« Reply #1 on: December 27, 2017, 09:54:30 am »
 +5%
► How-to Buy BitShares: https://goo.gl/i9j2YZ

Offline Customminer

  • Hero Member
  • *****
  • Posts: 595
  • Bitshares FTW!
    • View Profile
  • GitHub: grctest
Re: Bitshares HUG REST API
« Reply #2 on: January 15, 2018, 07:05:23 pm »
Many updates to the HUG REST API since the original post. Most recently, a Bitshares testnet HUG REST API server was created! https://steemit.com/bitshares/@cm-steem/bitshares-testnet-hug-rest-api-server-now-online

Offline Customminer

  • Hero Member
  • *****
  • Posts: 595
  • Bitshares FTW!
    • View Profile
  • GitHub: grctest
Re: Bitshares HUG REST API
« Reply #3 on: February 25, 2019, 04:35:28 pm »
The intention of the Bitshares HUG REST API is to provide users an open-source high performance interface to the Bitshares network through simple GET requests. It's implemented using python-bitshares, HUG, nGinx and Gunicorn to offer 'unparalleled performance'. It's fairly easy to set up for a private API and doesn't require running a full server (though do respect usage limits).

I'm interested in potentially continuing development of the Bitshares HUG REST API through a Bitshares worker proposal, I've been maintaining it for the last 2 years as a fully open source project.

Would you support such a worker proposal in the future? If so, what would you like to see included? Is anyone running their own private HUG REST API?

Potential scope of worker proposal development:
  • Functions which query account details are slow - this needs debugged/investigated
  • Some functions are only for 1 asset, like getting price feeds for smartcoins, making more generic than specific functions
  • Increase server size to increase gunicorn worker count
  • Implement anti-abuse functions - currently there's nothing preventing anyone from consuming more than their fair share of resources, though caching does counter some of this concern
  • Improve analytics dashboard - currently limited to what functions are hit and frequency over time
  • Static HTML front end pages for some of the functions, the hertz page is fully generated rather than simply populated so it's pretty slow.
  • Bitshares github org fork of my repo is behind in commits: https://github.com/bitshares/Bitshares-HUG-REST-API
  • Create tests for the functions
  • Create user requested functions
  • Create a more sophisticated API key mechanism
  • Host Bitshares full node server locally to the REST API so as to further reduce latencies
  • Host a testnet REST API - currently only production available to save on billing costs.
  • Implement basic 'write' functions for private API usage - currently all functions are read-only.
  • Fine tune Gunicorn & server configuration
  • Stream account history from full node via ZeroMQ into a Google BigQuery table. Implement HUG functions which interact with BigQuery.
  • Split the python script down into separate python files for easier maintenance.
  • Maintaining inter-worker data stores. Currently a few functions save to disk to get around this limitation, this could be optimized.
  • Create example scripts to query the API using different languages

Current Github stats
* 8 stars
* 7 forks
* Forked into the bitshares github org

Last month's public HUG REST API analytics:


Related links:
https://github.com/BTS-CM/Bitshares-HUG-REST-API
https://github.com/bitshares/python-bitshares
« Last Edit: February 26, 2019, 11:52:34 am by Customminer »

Offline pc

  • Hero Member
  • *****
  • Posts: 1429
    • View Profile
    • Bitcoin - Perspektive oder Risiko?
  • BitShares: cyrano
Re: Bitshares HUG REST API
« Reply #4 on: February 26, 2019, 01:07:04 pm »
Please explain what you consider a "User" in your statistics.
Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 http://bitcoin.quisquis.de

Offline Customminer

  • Hero Member
  • *****
  • Posts: 595
  • Bitshares FTW!
    • View Profile
  • GitHub: grctest
Re: Bitshares HUG REST API
« Reply #5 on: February 26, 2019, 01:56:13 pm »
Please explain what you consider a "User" in your statistics.
The Google Analytics is very limited, it's implemented using the measurement protocol as you can see here:
https://github.com/BTS-CM/Bitshares-HUG-REST-API/blob/master/hug_script.py#L74
https://developers.google.com/analytics/devguides/collection/protocol/v1/reference

The following shows device breakdown, with a 'mozilla compatible agent' being the highest, there seems to be continuous fetching of some cryptobridge market orders which Google Analytics is interpreting as between 70-100 continuous users. I'd imagine that if someone was implementing a production grade solution that they would run their own private HUG REST API with increased security though.



« Last Edit: February 26, 2019, 07:40:39 pm by Customminer »