2

i can't understand where is events log data is storing?

I can access to my logs by myContract.allEvents({ fromBlock: 2139049, toBlock: 'latest' }, function(error, event){ console.log("event : ",event); });

But, can i access this logs after one year? Or they'll be removed? And where is this logs are storing?

marked as duplicate by eth Apr 20 '18 at 8:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

Event logs are stored within transaction receipts, which are stored in blocks. You will be able to access your event logs for as long as the network remains active.

  • Is there reason do not use event log for storing some data? I just need to store ipfs hash in each transaction, and later return those hashes in correct order. As i understand, reason is that contract can't access event log itself? – user25688 Apr 19 '18 at 19:40
  • It is fairly common practice for a dApp to read data from contract event logs (rather than from the contract), as it is often a cheaper form of storage. You are correct in that the contract cannot access the event log directly. As for returning the hashes/events in the correct order, I do not believe web3 does this by default. – Zack McGinnis Apr 19 '18 at 19:48
  • I will order it by frontend js scripts. I'm very surprised, since I read that the logs are stored on the nodes and they can retire. If it's not, so this is very cool, because of cheap – user25688 Apr 19 '18 at 22:07
  • Event logs will always be recoverable since transaction receipts are stored within blocks. – Zack McGinnis Apr 19 '18 at 22:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.