27

I've seen this forum post about using Ethereum as an event store: Events in Solidity, using blockchain as eventstore.

However, it doesn't seem conclusive. For instance it says:

I confirmed with Vitalik and since confirmed by Chris that events are permanent. In future, some nodes may prune historic data.

If nodes prune historic data I'm not sure what the implications are for the availability of Event data.

1
  • I'm running geth 1.7 and my application depends of logs to show historical results. In order to have some type of optimization I'm storing data in the logs and use the topic indexes for fast retrieval. But recently I realized that the data stored in the log disappear after an average of 1 day. I'm using getPastLog to search in an specific block with this options: { fromBlock: '0x1ad462e', toBlock: '0x1ad462e', address: '0x1741136609df9F300c7fB4bD134730bBf8A00EBe', topics: [ null, '0x000000000000000000000000000000000000000000000000000000008' ] } but this returns the log only for latests blocks
    – byOnti
    Apr 10, 2018 at 14:50

1 Answer 1

32

Firstly, events are not accessible to contracts.

The simple answer is Yes, events are permanently stored.

The nuanced answer is Yes, events are as permanent as the blockchain.

It helps to realize that events are the result of LOG opcodes being executed in the EVM. For an analogy, "internal transactions" are derived by executing transaction data through the EVM.

So as long as you have the blockchain (by definition you have all blocks and transactions) then you have all the events (or can regenerate all of them if they've been deleted). If you're on a mobile phone where you don't have the blockchain, DApps will be limited with the events it will have.

Finally, pruning has no effect on the permanence of events because pruning is done to the state trie and no blocks are lost.

Exception: Events are permanent unless there is a fork reorganization and it is on the discarded fork. A fork discards blocks and transactions and this is why an event generated in them will also get discarded.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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