# Debate on Ethereum `event`

By [ORA](https://paragraph.com/@orablog) · 2023-12-13

---

TL;DR
-----

*   The recent release of shadow event and ERC-7571 triggers controversy.
    
*   Some people think shadow event is nice because its advantages in saving costs, and offering better developer experience by dropping onchain events on mainnet.
    
*   Some people consider shadow event as “a dangerous experiment”, mainly due to its verifiability and decentralization issues compared to its alternatives and the existing way developers deal with onchain event.
    

0\. Solidity event
------------------

> [**Solidity events give an abstraction on top of the EVM’s logging functionality**](https://docs.soliditylang.org/en/v0.8.20/contracts.html#events).

`event` [facilitates communication between smart contracts and their user interfaces](https://consensys.io/blog/guide-to-events-and-logs-in-ethereum-smart-contracts) (eg. website of a decentralized application).

It is commonly used in smart contract development as:

1.  A way to return values for the user interface from smart contracts
    
2.  A way to asynchronous trigger with data
    
3.  A cheaper form of storage (on Ethereum)
    

They are indexer-friendly (including indexing protocols, dashboards, and aggregators) and useful for applications for these reasons.

![All ERC-20s have events.](https://storage.googleapis.com/papyrus_images/499357b8eef21c5593791a3ab4ccc031226dcb1da179d9034ea520534b494b0f.png)

All ERC-20s have events.

Read more about Ethereum `event` and `log` here: [1](https://consensys.net/blog/developers/guide-to-events-and-logs-in-ethereum-smart-contracts/), [2](https://medium.com/mycrypto/understanding-event-logs-on-the-ethereum-blockchain-f4ae7ba50378), [3](https://thegraph.com/blog/event-driven-development-unlocking-optimized-dapps-and-subgraphs/), [4](https://mirror.xyz/spacesailor.eth/LEe2yoLoqy97BWHyO6J65XhnG8t33Nmvz_Vsa3ve7rY).

1\. Recent Debate on event
--------------------------

### a) Shadow Event

> A gasless event, logged on an offchain execution environment that mirrors mainnet state in real time.

Back in Dec 26, 2022, Dan Robinson [tweeted](https://twitter.com/danrobinson/status/1607467097940197377) about the phantom events concept and pleaded “Somebody please build an indexer that lets a user insert “phantom events” into any contract on-chain, written in Solidity”. [Shadow.xyz](http://Shadow.xyz) (previously called [trymetro.xyz/shadow](https://trymetro.xyz/shadow)) commented in the chat, then further built Shadow.xyz as [Paradigm EIR](https://twitter.com/gakonst/status/1732085764622778410).

Shadow event works like this: [you have a mirror of mainnet, but custom event logic that only triggers the events and data pipelines on the mirrored chain (shadow network) instead of having to pay for calldata and execution on the mainnet EVM](https://twitter.com/DCbuild3r/status/1732135108209963084). Simply put, you save money by not having `event` on mainnet production for indexing and gas, but have them with a mirrored mainnet.

### b) ERC-7571

Besides releasing shadow event, Shadow [proposed ERC-7571](https://twitter.com/_shadowxyz/status/1733224907658453222), a specification for shadow events – extra event logs in contract code that should only be generated in an offchain execution environment.

![](https://storage.googleapis.com/papyrus_images/ab8c6bf59754f559caa8a9e2c1435679934bbb7651c2e8b84ec1873da89da7e6.png)

ERC-7571 further spreads the concept and use case of shadow event.

### c) Controversy

On the surface, shadow events help developers and users save money on mainnet event data, and also help events exist in a more flexible form. However, there are opposite views.

For ERC-7571, some people believes it is more like [a compiler change](https://twitter.com/jtriley_eth/status/1733288374704697836), “[there's no reason to create an ERC for a language feature, that discussion belongs in whatever venue the language has for discussing changes](https://twitter.com/fubuloubu/status/1733232919244570692)”, and prefer “[propose something more general purpose like config flags](https://twitter.com/real_philogy/status/1734024007337267205)”. As a record, high\_byte also [proposed something similar (](https://twitter.com/high_byte/status/1734006953871855621)`offchain` keyword) to Solidity 2 years ago.

We'll cover the arguments for and against shadow events in more detail later in this article.

2\. "Stop Using Onchain event"
------------------------------

> Stop using onchain event, use shadow event.

![https://twitter.com/sui414/status/1732303293450510673](https://storage.googleapis.com/papyrus_images/ca81c8f6793446cbea1fe503bc69bdc71bb9484265daab700f606beb25942d53.png)

https://twitter.com/sui414/status/1732303293450510673

### a) `event` on Ethereum Mainnet is expensive.

Austin Adams from Uniswap Labs expresses that “[computation done on the logs, which makes them somewhat costly](https://twitter.com/austinadams10/status/1732155613130412086)” and “[Uniswap v3 users have spent over $20m on events](https://twitter.com/AustinAdams10/status/1732095029177381138)” which is “[5-6% of total gas fees](https://twitter.com/AustinAdams10/status/1732126315879522325)”. These additional costs of `event` are [essentially left to the user](https://twitter.com/0x94305/status/1732486218418712583). Hasu from Flashbots described this approach as a “[10x savings on cost](https://twitter.com/hasufl/status/1732748281246060624)”. And Joseph from Astaria said [this will be definitely used for the product for saving user gas](https://twitter.com/josephdelong/status/1733655568735191254).

Doug Colkitt from Ambient Finance shares the same opinion “[Event logging has cumulatively cost Ethereum users tens of millions in unnecessary gas costs](https://twitter.com/0xdoug/status/1732071485123039543)”.

David Mihal [takes “on-chain Twitter from PeepEth” as an example](https://twitter.com/dmihal/status/1732370160504217815), showed that “it (event) 'll eventually get pushed off-chain”.

### b) `event` may not be “truth” for applications.

According to [a clear definition](https://twitter.com/bkiepuszewski/status/1732750160982081953) given by bartek from L2Beat, `event` is not really a truth as the data source for onchain applications, but rather a dev-defined interpretation of smart contract behavior. The “real truth data” is tx traces and storage diffs.

![](https://storage.googleapis.com/papyrus_images/9f8ff70b144dc0feab41eee5b498ed0925d8e92646d5d7e803db2972a9f74728.png)

Other claims support that event data is not truth data:

*   [Exactly it is data that isn’t even available at runtime](https://twitter.com/josephdelong/status/1733667986760679809).
    
*   [Consensus over events/logs seems ridiculous](https://twitter.com/josephdelong/status/1733851600966299843).
    
*   [Data emitted from events are not the source of truth](https://twitter.com/libevm/status/1732141696203534572).
    

To summarize, `event` is developer-friendly, but not 100% trustless data, so we should reduce our reliance on it onchain.

### c) Shadow event enables better developer experience.

Shadow event related platform, [shadow.xyz](http://Shadow.xyz), serves as a developer infrastructure that enables a better development experience for not only smart contract developers, but also data analysts:

*   Smart Contract Developers: Save gas as mentioned before, and attract more usage based on this.
    
*   Data Analysts: [Allow for third-party edit-mode](https://twitter.com/0xGhostLogs/status/1732792772430569501) that is flexible and can be [changed after deploy as new data requirements emerge](https://twitter.com/alvinhsia/status/1733510107072245902).
    
*   Funds: [Quickly write logs to measure traction on chain across sectors](https://twitter.com/0xren_cf/status/1732059679142887556).
    

Overall, the shadow event design pattern fulfills [a long-standing need](https://twitter.com/afdudley0/status/1732618811897983276) to make development and data analysis easier.

3\. "Keep Using Onchain event"
------------------------------

> Keep the existing way of using event, use shadow event but not shadow’s way.

In response to these arguments, I have also observed a great deal of opposition to shadow events, arguing that the cost savings are not enough to cover the sacrifices in verifiability and decentralization. Some alternatives to shadow events have been proposed by developers, who have also expressed their support for event-driven development.

### a) Cost is not an real issue.

Although "not including onchain events in production saves gas", this is only valuable enough in L1. [For each Uniswap v3 transaction in L1](https://twitter.com/josephdelong/status/1733714495321538857) ([based on my napkin math](https://www.cryptoneur.xyz/zh/gas-fees-calculator)), not using an event saves about a dollar. In L2, these costs are almost negligible (~0.002 USD). Not nearly as much as the [potential benefits of including them](https://twitter.com/Ozhar/status/1732213752034968021) (cross-chain, data analytics).

![Example saving of cost of not using “event” in Uniswap v3 Swap](https://storage.googleapis.com/papyrus_images/7f1c4ab3bce080fb2c9e58f8b27bd8c6f61bf3bceb5d62a0efefa6a681fdbb7e.png)

Example saving of cost of not using “event” in Uniswap v3 Swap

Beyond that, a 5% cost savings is not really that big of a savings for each transaction. Only for protocols with a huge number of interactions, such as Uniswap, will the overhead be measured in the millions or tens of millions.

In addition, LefterisJP believes that these savings (in the form of hosting costs) will always [be pushed to the user](https://twitter.com/LefterisJP/status/1733795214181982350).

### b) Verifiability and decentralization are sacrificed.

One of the strongest reactions from the community has been the potential impact on verifiability and decentralization of using shadow events instead of onchain events, as well as the trend of sacrificing these characteristics of blockchain.

**Infrastructure needs to be decentralized and** [**open-sourced**](https://twitter.com/hudsonjameson/status/1734546223762182337)**.**

*   [![User Avatar](https://storage.googleapis.com/papyrus_images/30df49e04158a8ac9b79914398e88d58f93466b7d0df5fb31dc5ebd666ae9025.jpg)](https://twitter.com/gakonst)
    
    [Georgios Konstantopoulos](https://twitter.com/gakonst)
    
    [@gakonst](https://twitter.com/gakonst)
    
    [![Twitter Logo](https://paragraph.com/editor/twitter/logo.png)](https://twitter.com/gakonst/status/1733558795794850268)
    
    it's a virtuous stance to be anti saas in crypto, which I respect and I wish was doable with self hosted infra for everything myself...
    
     [![Like Icon](https://paragraph.com/editor/twitter/heart.png) 97](https://twitter.com/gakonst/status/1733558795794850268)[
    
    12:46 PM • Dec 9, 2023
    
    ](https://twitter.com/gakonst/status/1733558795794850268)
    
*   Opinion says infrastructure such as [Shadow.xyz](http://Shadow.xyz) [costs too much](https://twitter.com/high_byte/status/1734324542212858084) and is [hosted by Shadow themselves only](https://twitter.com/odysseas_eth/status/1732714324429353221), and there’s [no open-source code to self-host](https://twitter.com/moo9000/status/1733510755176112623) and is [not fully ready to be standardized as ERC](https://ethereum-magicians.org/t/erc-7571-shadow-events/17134).
    
*   The introduction of shadow event [adds up even more required infrastructure](https://twitter.com/0xfoobar/status/1733852394805502287).
    
*   [A closed source provider making the underdeveloped indexing landscape even more of an atrocity](https://twitter.com/jtriley_eth/status/1732259129647898711).
    

**Moving event offchain makes verifying harder.**

*   [![User Avatar](https://storage.googleapis.com/papyrus_images/19351b28f40fccac35d2b2d2301f563592bcd215c72cad97bdf5485d76612c63.jpg)](https://twitter.com/0xngmi)
    
    [0xngmi is hiring](https://twitter.com/0xngmi)
    
    [@0xngmi](https://twitter.com/0xngmi)
    
    [![Twitter Logo](https://paragraph.com/editor/twitter/logo.png)](https://twitter.com/0xngmi/status/1732102540286656787)
    
    what i dont like is that if we add shadow events into defillama adapters that means that it'll be impossible for others to run our adapters and verify the numbers  
      
    imo being able to verify numbers is very important
    
     [![Like Icon](https://paragraph.com/editor/twitter/heart.png) 19](https://twitter.com/0xngmi/status/1732102540286656787)[
    
    12:20 PM • Dec 5, 2023
    
    ](https://twitter.com/0xngmi/status/1732102540286656787)
    
*   [The users pay gas in a decentralized manner so that they can later see their data in any dapp they want to use](https://twitter.com/LefterisJP/status/1732344334719099126) and [“move everything off chain” which only makes user’s life harder](https://twitter.com/wmitsuda/status/1732411945435926835).
    

**The trend of moving everything offchain may be** [**a huge step backwards**](https://twitter.com/smyyguy/status/1732102187373789321)**.**

*   Shadow event’s [aim is to push the ecosystem towards completely moving all log data offchain](https://twitter.com/LefterisJP/status/1732317836050075672).
    
*   Shadow event [sets a bad precedent for optimising on-chain code](https://twitter.com/pcaversaccio/status/1732688249372762467) with compromising immutability and censorship resistance for the optimisation of computing and analytics.
    

### c) We have existing ways to enable similar effect to shadow event.

Using [shadow.xyz](http://shadow.xyz) based shadow event may have the above problems. Developers actually have alternatives to achieve the same effect without having to worry about centralization and verifiability issues, but can achieve the key features of saving gas and facilitating debugging.

**Achieve Shadow Event with Indexer**

The use of `event` and better `event` related toolings is all about the indexer.

[GhostLogs](https://ghostlogs.xyz/) is an alternative to [Shadow.xyz](http://Shadow.xyz). MakerDAO implemented [a similar indexing solution](https://twitter.com/AFDudley0/status/1733715841475031184) to [achieve shadow event effect](https://twitter.com/AFDudley0/status/1732250397610262810) in 2017. Mudit Gupta from Polygon [proposed a better indexing approach in 2022](https://twitter.com/Mudit__Gupta/status/1448964921794781184). brock from nascent also [built something similar called soldexer](https://twitter.com/brockjelmore/status/1607470395002871809).

**Debug with Shadow Event with Language Level Tricks**

Shadow event / block can be implemented at the language level by adding a few statements when testing the contract.

*   [![User Avatar](https://storage.googleapis.com/papyrus_images/cb9300cbafe29d83897160799345e13e4e76519201b48e93efa685ee2ad2b92a.jpg)](https://twitter.com/big_tech_sux)
    
    [sudo init vyper](https://twitter.com/big_tech_sux)
    
    [@big\_tech\_sux](https://twitter.com/big_tech_sux)
    
    [![Twitter Logo](https://paragraph.com/editor/twitter/logo.png)](https://twitter.com/big_tech_sux/status/1733295501313810541)
    
    an alternative to shadow blocks at the language level: shadow-type events which don't get emitted in production code but do get emitted in "shadow mode".  
      
    [github.com/vyperlang/vype…](https://t.co/36VK3oRIqa)
    
    ![](https://storage.googleapis.com/papyrus_images/3bffec74ca33287a0da892966bf9623bea80b720719c08d821760b129ede864d.jpg)
    
    [![User Avatar](https://storage.googleapis.com/papyrus_images/3dbf8250a2f0d17bf5e231c11013dc5b7a8d053b6572b4db2a04016815de7157.jpg)](https://twitter.com/shadowxyz)
    
    [Shadow](https://twitter.com/shadowxyz)
    
    [@shadowxyz](https://twitter.com/shadowxyz)
    
    [![Twitter Logo](https://paragraph.com/editor/twitter/logo.png)](https://twitter.com/shadowxyz/status/1733224907658453222)
    
    We’re proposing ERC-7571 ![🌗](https://abs-0.twimg.com/emoji/v2/72x72/1f317.png)  
      
    A standardized syntax for shadow events within Ethereum smart contracts to make it easier for them to be specified, discovered, and fetched by any offchain developer tools or infrastructure.
    
    ![](https://storage.googleapis.com/papyrus_images/6d82d887466c49850d3f78123d36b608973e2f5279df8ea9d436986b70f281ba.jpg)
    
     [![Like Icon](https://paragraph.com/editor/twitter/heart.png) 47](https://twitter.com/big_tech_sux/status/1733295501313810541)[
    
    7:20 PM • Dec 8, 2023
    
    ](https://twitter.com/big_tech_sux/status/1733295501313810541)
    
*   [![User Avatar](https://storage.googleapis.com/papyrus_images/91d0aee9b1975dee8b0bb46d60d1627655a705e9b89e2fb9e2249737604eb432.jpg)](https://twitter.com/high_byte)
    
    [high\_byte](https://twitter.com/high_byte)
    
    [@high\_byte](https://twitter.com/high_byte)
    
    [![Twitter Logo](https://paragraph.com/editor/twitter/logo.png)](https://twitter.com/high_byte/status/1734006868324888772)
    
    [github.com/ethereum/solid…](https://t.co/Eei8sHXCVS)
    
     [![Like Icon](https://paragraph.com/editor/twitter/heart.png) 19](https://twitter.com/high_byte/status/1734006868324888772)[
    
    6:27 PM • Dec 10, 2023
    
    ](https://twitter.com/high_byte/status/1734006868324888772)
    

These features are requested for Solidity and Vyper compiler ([1](https://github.com/ethereum/solidity/issues/12610), [2](https://github.com/vyperlang/vyper/pull/3686)), and [can be extended to other languages](https://twitter.com/high_byte/status/1733976476087636472).

**Debug with Shadow Event with Features in Toolkit**

[Shadow events can be implemented in the Forge with some extra code](https://twitter.com/high_byte/status/1734197956251615583). Only 4 lines of code (if contract is not a proxy use vm.etch() instead of vm.store()).

![](https://storage.googleapis.com/papyrus_images/f475432d51ea8753a7f82c6c0c9fe8292010ffdec2a31489536364a239858ef3.png)

### d) We love using onchain [event](https://twitter.com/fubuloubu/status/1732123974287622363).

Last but not least, developers [love using onchain event](https://twitter.com/fubuloubu/status/1732123974287622363).

“[not onchain, not consensus, not truth](https://twitter.com/sui414/status/1732125428603814218)”.

4\. What may happen next?
-------------------------

At HyperOracle, we decided early on to focus on making event data trustless. Our initial version of zkOracle implemented trustless historical access and compute for event data. The main reason for this decision was that we knew that event is a data that developers rely heavily on, and that there was a lack of a source of truth to verifiably put event back into the onchain smart contract.

The Shadow event discussion not only covers dev experience and verifiability, but also user experience (gas cost). It is even highly relevant to the design of Ethereum and EVM itself. This is a discussion on whether to [optimize](https://twitter.com/tarunchitra/status/1668990813823533063) first or decentralize first.

Overall, innovation has been good, and shadow events are a new feature that developers have been waiting for. We hope to see more open source efforts in this. It will be interesting to see if ERC-7571 and shadow event get adopted widely on language-level, and client-level.

* * *

### About HyperOracle

HyperOracle is a programmable zkOracle protocol that powers smart contracts with arbitrary compute and richer data sources. HyperOracle offers full security and decentralization for trustless automation and onchain AI/ML so builders can easily create next-gen dApps.

[hyperoracle.io](https://hyperoracle.io) | [x.com/hyperoracle](https://x.com/hyperoracle) | [github.com/hyperoracle](https://github.com/hyperoracle)

---

*Originally published on [ORA](https://paragraph.com/@orablog/debate-on-ethereum-event)*
