AL #037: How Shadow Will Change Smart Contract Development Forever
And why smart contract developers cannot ignore L2 and appchain architecture any longer.
Thanks to Alvin Hsia for sharing some corrections.
Data availability in the context of blockchains minimally refers to being able to access transactions.
If you have access to transactions, you can recreate the state of the blockchain from an initial state or from any snapshot just by replaying them in sequence.
Transactions → Blockchain State
For the longest time, an equivalent principle for smart contracts has been to create events that support a complete reproduction of smart contract state.
E.g., if you're changing the owner of a smart contract, you should emit an event signifying it, etc.
Events → Smart Contract State
For example, this is an excerpt from Solidity Best Practices for Security:
The Graph protocol's documentation is heavily focused on building indexers using events (even though they do have a back-up option of directly parsing transaction data).
Enter Shadow
Recently funded by Paradigm, Shadow has emerged as a radical indexing solution that can inject events retroactively in smart contracts.
This is a game changer.
The immediate implications is that onchain analysts, economic simulation and risk platforms, traders and many other institutions processing smart contract data will be able to do so with more flexibility than ever.
Of course that flexibility comes at a cost of needing to learn Solidity.
Andrew Hong explained that displacing SQL may be harder than it seems.
But the more interesting second order question is what should smart contract developers do?
Is it time to remove all events?
Not so fast
While the long term picture is very clear…
The short term is less so.
The first critique is centralization:
A Machiavellian read of this announcement is that Shadow would end up centralizing indexing and levying a cost once they've established a monopoly position.
I'm more optimistic.
Discussion has already started on ERC-7571 (Shadow Events), a new standard around how events could be retroactively introduced in smart contracts for the purposes of indexing.
Hopefully this means that if shadow events prove superior in ergonomics, there should be enough competition with multiple providers supporting ERC-7571 and helping smart contract developers avoid paying monopoly profits.
Is it ready yet?
The real practical concern for smart contract developers is whether it's time to remove events from their contracts.
In the ERC-7571 discussion thread, Shadow co-founder and CTO Emily Hsia explained that not all events are going away:
In short, without a thorough event-by-event analysis of how your smart contract will be parsed by The Graph, Dune, Nansen and other consumers, it's hard to make a blanket recommendation in the short term.
The guidelines are not obvious and smaller teams will likely need to hold off if they cannot fully understand the impact on their customers and analysts looking at their code.
Nevertheless, the long term impacts of this are entirely positive and as a smart contract designer it will certainly remove some decision anxiety and improve the independence between the smart contract and indexing teams.
One of the most important considerations will be availability of deployment. While the Shadow RPC endpoint is currently on Ethereum, and the company says Base, Optimism, Arbitrum, and Polygon are coming soon, smaller L2s and app chains may be waiting longer to have Shadow show up on their networks
It's clear that smart contract developers will increasingly be affected by data availability choices of their block space.
So us smart contract designers & developers better get acquainted with modular architectures and infrastructure if we want to best serve our users.