The dead simple 69-line proxy


Introducing the dead simple hive JSON-RPC proxy that only consists of exactly 69 lines of NodeJS code, excluding empty lines and comments. It is as barebones as it can get such that it will work with most existing libraries and applications but lacks some features such as caching and batch requests which can be easily added later when needed.

Why does this even exist!?

Well this only exists because I'm having issues with Jussi ever since this happened. According to @fullnodeupdate, several Hive API nodes (including mine) have their uptime nosedived since the very beginning of October probably due to the same reason.

My logs were spammed with this even though the SSL certificates are actually valid (although not for all requests):

{"exception":"ClientConnectorSSLError(ConnectionKey(host='actual-api-host', port=443, is_ssl=True, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=4978515757102267426), SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'))","message":"Internal Error","error_id":"cced2e93-6b4f-4124-99bf-5485bd745f6e","jrpc_request_id":1,"jussi_request_id":"000065322797678071","event":"Internal Error","logger":"jussi.errors","level":"error"}

where actual-api-host is the domain that points to the node that is actually serving the data which is kept private, or the redirected API endpoint during downtime.

I attempted to recompile the docker image but still getting the same exceptions. My guess at this point would be outdated dependencies.

I also experimented with Ecency rpc-proxy but was getting a lot of these errors for several important API methods (again, not all API methods):

module 'aioredis' has no attribute 'create_pool'

Tried to look it up but could not find a working solution or a fix. That leaves me with creating my own custom solution so that each call continues to get routed to the appropriate service while keeping it simple and easy to maintain.

Where to find?

This is just a small NodeJS app that does not deserve its own Git repository, hence you can find it in the proxy folder under my hiverpc-resources repo where all relevant files and notes regarding RPC go to. Installation is relatively simple as well, the only dependency needed for it to run is NodeJS. The config file is the same as the one used in Ecency rpc-proxy.

Need multi-threading?

Due to its simplicity, it is easy to spin up a PM2 cluster that shares the same port that balances the server load across multiple threads with zero code modifications. As for RPC, a single process is only using less than 10% of a CPU core during relatively busy times so this setup is not really needed here.

Hive witness footer 2.png

3 columns
2 columns
1 column