Posts tagged "Smart-Contracts"
Decoding Ethereum Events
Observability is an often overlooked part of software development and subsequent deployment. I myself am guilty of chucking in a handful of unstructured log messages and calling it a day. As the complexity of the application increases, this usually ends up forcing our hands to implement either structured logging or perhaps a tracing system.
The standard way of observing smart contracts is through logs (also referred to as events). These are a bit more sophisticated than a standard print statement, and actually possess some additional properties. The most interesting of these properties is that we can prove certain events happened, as all the logs emitted during a block are Merkleized into the receipts root field of the block header. This actually allows us to prove that a certain event happened without needing to re-execute the block, and it is used quite heavily in bridging protocols, for example.
Bulk Storage Extraction
Most Dapp developers have heard of and probably use the excellent Multicall contract to bundle their eth_calls and reduce latency for bulk ETL in their applications (we do too, we even have a python library for it: Manifold).
Unfortunately, we cannot use this same trick when getting storage slots, as we discovered when developing our storage explorer, forcing developers to issue an eth_getStorageAt for each slot they want to query. Luckily, Geth has a trick up its sleeve, the “State Override Set”, which, with a little ingenuity, we can leverage to get bulk storage extraction.