1

I noticed one thing while learning Events/Logs from some sources. If I understand these sources correctly nodes can remove logs for effective memory usage.

If my client tries to read logs that do not exist on any node what will happen? Will these be recalculated? And is it possible that the log is not found?

Pls also check this question: Why can't smart contracts access events

The verified answer says: Because logs may or may not be there, they cannot be accessed from the state that needs to be deterministic

Is it wrong to read or trust historical information from logs in client side?

Murad Sofi
  • 11
  • 2
  • What do you mean by "trust"? Logs are discardable by design, if you want something more permanent the contract could save it to its storage. Some public web3 providers like Infura do not provide logs for old blocks, but you can always use your own archive node to access old logs. For logs may be discardable but if you replay the whole blockchain you will get generate every log every emitted. – Ismael Mar 20 '22 at 23:05
  • @Ismael So then is it possible in some cases I want to read logs and logs do not exist in any node right? What I will get as a response? – Murad Sofi Mar 22 '22 at 16:56
  • Logs will always exist unless you delete every copy of the Ethereum blockchain. It is possible that a web3 provider will not keep them around for old blocks, in that case they could return an error. – Ismael Mar 23 '22 at 01:09

0 Answers0