Script en Python - Calcular y transferir las recompensas de curaci贸n a los delegadores 馃嚜馃嚫 馃嚭馃嚫

Words
1141
Reading
6 min
Listen
Play
3y

alt


Espa帽ol


Desde que iniciamos el proyecto visualblock@visualblock hemos tenido como prioridad la transparencia con nuestros delegadores. Al principio, tanto la creaci贸n de los post de curaci贸n como las transferencias semanales a nuestros delegadores han sido hechas de manera manual. A medida que hemos avanzado con el proyecto hemos estado incluyendo tecnolog铆a 煤til en la mejora de procesos, para lograr mayor eficacia y eficiencia. Por tal motivo quiero compartir con los usuarios que nos apoyan con sus delegaciones y con toda la comunidad de Hive el c贸digo base utilizado para calcular y transferir las recompensas de curaci贸n a los delegadores del proyecto visualblock@visualblock.

Tambi茅n quiero dar el primer paso en el compromiso que tengo con todos ustedes y con el testigo hispapro@hispapro, para impulsar la innovaci贸n y el desarrollo tecnol贸gico en Hive.

Este script ha estado en pruebas durante varias semanas, la intenci贸n es implementarlo en la web que est谩 en desarrollo para administrar todos los procesos relacionados con las actividades que realizamos en Visualblock, lo cual nos permitir谩 reducir los tiempos de ejecuci贸n y poder aprovecharlo a favor del desarrollo de la comunidad.

Como anunciamos en los post de reporte de pago de las recompensas de curaci贸n semanales, devolvemos el 100% de las recompensas de curaci贸n seg煤n el HP aportado por cada usuario. Explico c贸mo realizamos este c谩lculo con el script:

  1. Se obtiene la lista de delegadores con antig眉edad mayor a 4 d铆as.

  2. Se remueve de la lista los delegadores donde su 煤ltima delegaci贸n sea igual a 0.

  3. Se obtiene la 煤ltima delegaci贸n de cada delegador.

  4. Se obtiene la cantidad total de las delegaciones recibidas.

  5. Se obtiene la suma total de las recompensas de curaci贸n de la 煤ltima semana.

  6. Se obtiene el HP de la cuenta VisualBlock.

  7. Se obtiene el HP de la cuenta VisualBlock m谩s delegaciones.

  8. Se obtiene la cantidad de recompensas de curaci贸n efectiva, restando la cantidad aportada por el propio HP de VisualBlock.

  9. Se calcula la cantidad de HIVE a transferir a cada delegador a partir de la cantidad de recompensas de curaci贸n efectiva.

  10. Se transfiere el monto en HIVE a cada delegador.

  11. Se crea una tabla en markdown con toda la informaci贸n detallada.

El script est谩 desarrollo en Python usando como bibliotecas principales a beem y pypyodbc, adem谩s de una lista de dependencias que encontrar谩n en el archivo requirements.txt en el repositorio del c贸digo. Para el desarrollo de este script se us贸 la documentaci贸n del Portal de desarrolladores de Hive, HiveSQL, beem y de referencia el bot de discord creado por enrique89@enrique89

El c贸digo est谩 alojado en los repositorios de GitLab de forma p煤blica para que pueda ser utilizado, modificado y distribuido. Ver c贸digo fuente aqu铆.

En el repositorio del c贸digo se encuentra la documentaci贸n para clonar el c贸digo, creaci贸n del entorno virtual, instalaci贸n de bibliotecas de Python, configuraci贸n de variables de entorno, instalaci贸n del controlador ODBC Driver 17 for SQL Server, y la puesta en marcha del script.

Espero les sea de utilidad y que pueda ser difundido para que llegue a todos los nuevos usuarios que se adentran en el desarrollo de aplicaciones para Hive. No se olviden dejar su comentario. Un abrazo.


English


Since we started the visualblock@visualblock project, we have made transparency with our delegators a priority. In the beginning, both the creation of the curation posts and the weekly transfers to our delegators have been done manually. As we have progressed with the project we have been including useful technology in the improvement of processes, to achieve greater effectiveness and efficiency. For that reason I want to share with the users who support us with their delegations and with the whole Hive community the code base used to calculate and transfer the healing rewards to the delegators of the visualblock@visualblock project.

I also want to take the first step in the commitment I have with all of you and with the hispapro@hispapro witness, to drive innovation and technological development in Hive.

This script has been in testing for several weeks, the intention is to implement it on the web that is under development to manage all processes related to the activities we perform in Visualblock, which will allow us to reduce execution times and be able to take advantage of it in favor of the development of the community.

As we announced in the weekly curation rewards payment report posts, we return 100% of the curation rewards according to the HP contributed by each user. I explain how we perform this calculation with the script:

  1. The list of delegators with seniority greater than 4 days is obtained.

  2. Remove from the list the delegators where their last delegation is equal to 0.

  3. The last delegation of each delegator is obtained.

  4. The total number of delegations received is obtained.

  5. The total sum of the healing rewards for the last week is obtained.

  6. The HP of the VisualBlock account is obtained.

  7. The HP of the VisualBlock account plus delegations is obtained.

  8. The amount of effective healing rewards is obtained, subtracting the amount contributed by the VisualBlock's own HP.

  9. The amount of HIVE to be transferred to each delegator is calculated from the amount of effective healing rewards.

  10. The amount in HIVE is transferred to each delegator.

  11. A markdown table is created with all the detailed information.

The script is developed in Python using as main libraries beem and pypyodbc, plus a list of dependencies that you will find in the requirements.txt file in the code repository. For the development of this script we used the documentation of Hive Developer Portal, HiveSQL, beem and for reference the discord bot created by enrique89@enrique89

The code is publicly hosted in the GitLab repositories so that it can be used, modified and distributed. See source code here.

In the code repository you can find the documentation for cloning the code, creating the virtual environment, installing Python libraries, setting environment variables, installing the ODBC Driver 17 for SQL Server, and getting the script up and running.

I hope you find it useful and that it can be disseminated to reach all new users who are getting into the development of applications for Hive. Do not forget to leave your comments. Best regards.

Translated with www.DeepL.com/Translator (free version)


Mi intenci贸n con esta publicaci贸n es dar mi aporte al software libre y al c贸digo abierto, difundiendo al p煤blico en general todos los beneficios, ventajas y facilidades de obtener versiones seguras, optimas y de vanguardia.

DigitalOcean Referral Badge


Si necesitas una VPS donde alojar tus servicios en la nube, entra con mi enlace de referido a DigitalOcean y consigue cr茅ditos para tus pruebas



alt

Vota por nuestro Testigo aliado - @hispapro


Las im谩genes son m铆as o capturas de pantalla tomadas por m铆, a menos que se indiquen fuentes externas. La portada fue creada con canva e im谩genes libres de derechos de autor.


Discord: alberto0607
S铆gueme en Twitter: alberto_0607

Script en Python - Calcular y transferir las recompensas de curaci贸... | Ecency