Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

238
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda