Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

222
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!