Hive Developer - LP Index, in testings VPS privex | Desarrolar en Hive Indice de Piscinas probando en Privex

in #archon7 days ago

freepik__a-stunning-HIVE-AI.jpeg

Saludos Hivers, espero esten todos muy bien y felices. Por aca con otra entrega del indice de piscinas de liquidez que estoy construyendo. Y ahora:

Probando gracias al equipo de #Privex, que trabajan duro para tener servidores dedicados y VPS a muy buenos precios que puedes pagar con HIVE/HBD. mas info aca

Live luego de ensayos y errores:

http://hivelpindex.sytes.net:3000/ Esta es la direccion final de la fase pruebas para el servidor. Decidi colocarlo en un VPS para tener mayor control. Actualmente la data empieza a partir de hoy 12/04/2025, es decir que todos los dias anteriores ya no sirven sino solo como una referencia.

A ciencia cierta que hace el indice?

Pues la idea es cada dia a las 0:00 horas tomar un snapshot o una "foto" de la data de cada piscina de liquidez disponible. Es decir se toma la data:

{
  "_id": 112,
  "tokenPair": "AFIT:AFITX",
  "baseQuantity": "2624729.44355282",
  "baseVolume": "41766373.08764687",
  "basePrice": "0.00051456",
  "quoteQuantity": "1350.60641333",
  "quoteVolume": "11676.06288590",
  "quotePrice": "1943.37107957",
  "totalShares": "58727.31265509210142249948",
  "precision": 8,
  "creator": "actifit",
  "isoDate": "2025-04-08T00:00:01.000Z"
}

y eso se almacena en una archivo .json y se crea una carpeta para cada par de tokens. De esa manera se hace un indice de data de 24h para tener los volumenes de trading de dicho par y asi, contar con un sistema que vive en la blockchain de HIVE. De esta manera tenemos datos disponibles en cuanto a las piscinas de liquidez.

Por ejemplo si visitas el dominio gratuito que cree:
http://hivelpindex.sytes.net:3000/data/ tendras acceso al indice. Esos datos son descargables y demas.

image.png

Solo el indice?

Nope. Tambien dispuse de algunas rutas, aun en progreso y pruebas, para:

  1. Obtener data de un par solamente. /public/data-pool?tokenPair=[tokenPair] i.e: SWAP.HIVE_SWAP.HBD or SWAP.HIVE:SWAP.HBD. Probar aca
  2. Obtener una lista de nombres de cada par disponibles en el indice. /public/available-data-pool-token-pair Prueba aca
  3. Test de velocidades para nodos RPC: capa 1 y capa 2 a peticion. /public/fastest-hive-rpc-node?mode=l1 Prueba aca

Esta ultima ruta es muy util para cuando quieras mirar segun la capa, que nodo RPC esta funcionando y respondiendo mas rapido. A diferencia de lo que hace @peakd pues yo lo hice mas simple aun y midiendo velocidades de respuesta.

Aprendido hasta ahora:

  • Aun cuando podemos utilizar servicios gratuitos como render.com, es mejor tener control total de lo que se hace aun cuando solo se quiera probar.
  • Es mas recomendable usar servicios garantizados como Privex, ya sean servidores dedicados o VPS.
  • Al correr un index es imperativo hacer pruebas localmente y remotamente para garantizar que no se perdera data.
  • Podemos usar cron-job.org como una manera de verificar el status del servidor sin generar gastos adicionales porque es GRATUITO.

ENG:

Greetings Hivers, I hope you are all doing very well and are happy. Here with another installment of the liquidity pool index that I am building. And now:

Testing thanks to the #Privex team, who work hard to have dedicated servers and VPS at very good prices that you can pay with HIVE/HBD. more info here

Live after trial and error:

http://hivelpindex.sytes.net:3000/ This is the final address for the testing phase of the server. I decided to put it on a VPS for greater control. Currently, the data starts from today, 04/12/2025, meaning that all previous days are no longer relevant except as a reference.

What exactly does the index do?

Well, the idea is to take a snapshot or a "photo" of the data from each available liquidity pool every day at 0:00 hours. That is, the following data is taken:

JSON

{
  "_id": 112,
  "tokenPair": "AFIT:AFITX",
  "baseQuantity": "2624729.44355282",
  "baseVolume": "41766373.08764687",
  "basePrice": "0.00051456",
  "quoteQuantity": "1350.60641333",
  "quoteVolume": "11676.06288590",
  "quotePrice": "1943.37107957",
  "totalShares": "58727.31265509210142249948",
  "precision": 8,
  "creator": "actifit",
  "isoDate": "2025-04-08T00:00:01.000Z"
}

and this is stored in a .json file, and a folder is created for each token pair. In this way, a 24-hour data index is created to have the trading volumes of that pair and thus have a system that lives on the HIVE blockchain. This way, we have data available regarding the liquidity pools.

For example, if you visit the free domain I created:
http://hivelpindex.sytes.net:3000/data/ you will have access to the index. This data is downloadable and more.

Only the index?

Nope. I also set up some routes, still in progress and testing, to:

  1. Obtain data for a single pair. /public/data-pool?tokenPair=[tokenPair] i.e: SWAP.HIVE_SWAP.HBD or SWAP.HIVE:SWAP.HBD. Test here
  2. Obtain a list of names for each pair available in the index. /public/available-data-pool-token-pair Test here
  3. Speed test for RPC nodes: layer 1 and layer 2 upon request. /public/fastest-hive-rpc-node?mode=l1 Test here L1 and Test here l2

This last route is very useful for when you want to see, according to the layer, which RPC node is working and responding fastest. Unlike what @peakd does, I made it even simpler by measuring response speeds.

Learned so far:

  • Even though we can use free services like render.com, it is better to have full control over what is done even when you only want to test.
  • It is more recommended to use guaranteed services like Privex, whether dedicated servers or VPS.
  • When running an index, it is imperative to test locally and remotely to ensure that no data will be lost.
  • We can use cron-job.org as a way to verify the server status without generating additional costs because it is FREE.
Sort:  

thanks for the update! I noticed the other site was gone yesterday.

Hi there @txracer Yes that one is down. As I am getting more experience in backend, I am trying to learn and put in practice, all the best methods as fast as I can. The new VPS will work much better and more stable.

If you have suggestions, do not hesitate and please let me know!

I am curious about the end to end encryption, is it left unencrypted for a reason or just not set up yet?

Hi there @txracer good question!

The server's encryption is not set up yet as I don't know if this will be the final place to locate it, I still need to keep working on that and discuss details with @ecoinstant .

I will try to do it asap.

Done the SSL even in the test/beta server. Try and let me know.

At least for the main address works fine https://hivelpindex.sytes.net/

I will be open to more checks! Thanks!