4

Are logs a reliable place to store data long-term?

From the documentation:

"These logs are associated with the address of the contract and will be incorporated into the blockchain and stay there as long as a block is accessible (forever as of Frontier and Homestead, but this might change with Serenity)"

Edit

Logs work now- I understand. But are they future-proof ways of storing app-critical information? What information beyond the "this might change with Serenity" is available? Will they still linger for a long time after that? Further insights appreciated.

3
+25

Logs are reliable and the best way to process transactions when someone interacts with your contract. Example, if you have an auction contract, you can emit an event when a bid is made, when someone wins the bid, etc, and thus process the transaction As the documentation says, logs remain in the blockchain as long as the block is accessible.

You can always revisit those blocks/transactions from past and use web3.getTransaction() & web3.getTransactionReceipt() along with the ABI and LogParser to decode all logs/event hashes into Human Readable Text.

Hope this helps

  • I'm looking more for information about upcoming changes in Serenity. Apparently blocks may not be accessible forever. – will_durant Dec 13 '17 at 20:42
  • Log does the job. You just have to be aware that if a hard forks happens, you won´t be able to get past logs anymore – Luiz Soares Dec 14 '17 at 9:42
  • Yeah, once hard forked the logs won’t be accessible – farhankhwaja Dec 15 '17 at 3:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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