Hive Developer "Sources of Node testing" hive-nectar? | Desarrollador Hive "Fuentes de Pruebas de Nodos"

in #archonlast month

freepik__a-detailed-node-rpc-server-rack-glowing-with-activ__48327.jpeg

Saludos Hivers, espero que todos esten muy bien. Que sus cuentas sigan engordando y que se multipliquen las monedas.

Por aca un saludos especial a todos los desarrolladores de #HIVE que dia a dia hacen de este ecosistema algo mas seguro, confiable y eficiente!

Fuente de prueba de nodos?

Pues si es ahora mismo cuando empiezas a desarrollar en hive, te daras cuenta de algo:

  • Hice mi aplicacion para buscar cuentas que regalen votos.
  • Pero cada tanto el nodo RPC se cae y resulta que estoy utilizando un solo nodo RPC.

Pues dentro del ecosistema HIVE utilizamos una estandarizacion llamada Nodos RPC.

Nodo RPC

Un nodo RPC actúa como un punto de acceso estandarizado que permite a diferentes aplicaciones y sistemas interactuar con un servidor (como un nodo de blockchain) de una manera remota y organizada.

En el contexto de las blockchains, los nodos RPC son cruciales porque permiten:

  • Consultar datos de la blockchain: Las aplicaciones pueden usar nodos RPC para obtener información sobre bloques, transacciones, saldos de cuentas, el estado de contratos inteligentes, etc.
  • Enviar transacciones: Las billeteras y otras aplicaciones utilizan nodos RPC para enviar nuevas transacciones a la red blockchain.
  • Interactuar con contratos inteligentes: Las dApps pueden usar nodos RPC para llamar a funciones dentro de los contratos inteligentes desplegados en la blockchain.
  • Obtener información sobre el estado de la red: Los nodos RPC pueden proporcionar información sobre la sincronización de la red, el número de pares conectados, etc.

Ya sea que quieras emitir un voto, firmar una transaccion, emitir una transferencia, tienes que hacer uso de dichos nodos.

freepik__a-cyberpunkstyle-illustration-of-a-hacker-typing-c__48325.jpeg

Un pedacito de codigo para pedir la informacion de los tokens

Codigo: nodejs, typescript, interaccion con nodo RPC en hive.

 const response = await axios.post<any>(
    `https://enginerpc.com/contracts`,
    {
      jsonrpc: "2.0",
      method: "find",
      params: {
        contract: "marketpools",
        table: "pools",
        query: {},
        limit: 1000,
      },
      id: 1,
    }
  );

Si dicho nodo esta activo y en funcionamiento, esta peticion nos dara una lista de maximo 1000 resultados para las piscinas de liquidez de HIVE.

Entonces donde se debe probar y para que?

En el fatidico caso en que este nodo "https://enginerpc.com" este caido, tu aplicacion no podra obtener resultados. Es por eso que existen al menos entre 10 y 20 nodos(minimo) corriendo.
La idea de saber que nodo esta funcionando correctamente es vital para garantizar el funcionamiento adecuado de una app que codificamos.

Usando hivenectar en hive?

El buen programador @thecrazygm en conjunto con el amigo @ecoinstats tienen grandes ideas para unificar y expandir el uso de librerias. Puedes y deberias leer mas de esto en su propuesta
La libreria hecha para Python, puede ser utilizada en JS gracias a los adelantos que ellos han hecho. Y esto nos permite probar los nodos a un nivel mas profundo. Con esto garantizamos que nuestro codigo sea menos propenso a fallas.

https://peakd.com/@nectarflower

nectarflower.jpg

Actualizando codigo de JS a TS

Es bien sabido que como desarrolladores que trabajamos con Javascript, necesitaremos utilizar Typescript para poder tener una definicion de tipos y variables en modo de desarrollo. Es por eso que luego de mirar este proyecto, decidi ponerme manos a la obra para colocar dicho projecto con Typescript.

Codigo original en JS
Codigo en progreso en TS

Luego de probar y garantizar que todo marcha como deberia, con gusto pasare los cambios al repositorio principal, por ahora es un fork.

En conclusion

Necesitamos mas fuentes de codigo que puedan enlazar protocolos, librerias y demas componentes.


ENG

Greetings Hivers, I hope everyone is doing very well. May your accounts continue to grow and your currencies multiply.

Over here, a special greeting to all the #HIVE developers who day by day make this ecosystem something more secure, reliable, and efficient!

Node Testing Source?

Well, if you are just starting to develop on Hive right now, you will realize something:

  • I made my application to search for accounts that give away votes.
  • But every so often the RPC node goes down, and it turns out I'm using only one RPC node.

Well, within the HIVE ecosystem, we use a standardization called RPC Nodes.

RPC Node

An RPC node acts as a standardized access point that allows different applications and systems to interact with a server (such as a blockchain node) in a remote and organized manner.

In the context of blockchains, RPC nodes are crucial because they allow:

  • Querying blockchain data: Applications can use RPC nodes to obtain information about blocks, transactions, account balances, the status of smart contracts, etc.
  • Sending transactions: Wallets and other applications use RPC nodes to send new transactions to the blockchain network.
  • Interacting with smart contracts: DApps can use RPC nodes to call functions within smart contracts deployed on the blockchain.
  • Obtaining information about the network status: RPC nodes can provide information about network synchronization, the number of connected peers, etc.

Whether you want to cast a vote, sign a transaction, or issue a transfer, you have to make use of these nodes.

A snippet of code to request token information

Code: nodejs, typescript, interaction with RPC node on hive.

const response = await axios.post<any>(
  `https://enginerpc.com/contracts`,
  {
    jsonrpc: "2.0",
    method: "find",
    params: {
      contract: "marketpools",
      table: "pools",
      query: {},
      limit: 1000,
    },
    id: 1,
  }
);

if this node is active and functioning, this request will give us a list of a maximum of 1000 results for HIVE liquidity pools.

So where should it be tested and why?

In the fateful event that this node "https://enginerpc.com" is down, your application will not be able to obtain results. That is why there are at least between 10 and 20 nodes (minimum) running.
The idea of knowing which node is working correctly is vital to guarantee the proper functioning of an app that we code.

Using hivenectar on hive?

The good programmer @thecrazygm, together with our friend @ecoinstats, have great ideas to unify and expand the use of libraries. You can and should read more about this in their proposal
The library made for Python can be used in JS thanks to the advancements they have made. And this allows us to test the nodes at a deeper level. With this, we guarantee that our code is less prone to failures.

Updating JS code to TS

It is well known that as developers who work with Javascript, we will need to use Typescript to be able to have a definition of types and variables in development mode. That is why, after looking at this project, I decided to get to work to put this project into Typescript.

Original code in JS
Code in progress in TS

After testing and ensuring that everything is working as it should, I will gladly pass the changes to the main repository; for now, it is a fork.

In conclusion
We need more code sources that can link protocols, libraries, and other components.


Credits - Images: