Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

235
Vistas
JS - Solidity: Events vs View Functions to retrieve data

I have a JavaScript/React FrontEnd where I want to retrieve and show variables that have been stored in my Solidity Smart Contract. I know that I can emit an event each time I need to retrieve those variables and read from my JS app, however emit and store events will cost gas. Why cannot simply continuous polling a GetData view function (using setInterval), where for example I recall data from my js app every 2 seconds? As view functions cost no gas, why it is preferred to use events to store and retrieve data?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Events are like notifications about the state changes in smart contract and are usually used in corresponding state changing functions. Events also cost less gas than a function call. Take a look at this question. Furthermore, Events are cheaper as compared to storing data in the contract. You can read more about it here.

Also, view functions do cost gas if they are called from a transaction that results in state change of the contract

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda