A library allowing to do arbitrary onchain execution in read calls
Ethereum uses an RPC model in its APIs. This usually means that you execute one command and receive one response, for example executing a smart contract function call.
This works well in most cases, but what if you want to read a lot of data from the chain? Resolve a list of ENS names, their records, pull in third party data as well? Lots of requests that add up and can cause bad performance, especially when executed in frontend.
This hack demonstrates an alternative way of querying onchain data by abusing the eth_call RPC, executing a "fake contract deployment" and making the constructor return the computed data with some assembly magic ✨
This allows to execute "scripts" that can do a serious amount of computation without any deployments in a single RPC request.
This project is based on earlier research by drgorilla.eth & libevm.eth and adds strong typing and helper functions for ✨ maximum developer experience ✨
The typing is achieved through type inference with abitype which can turn a JSON ABI into complete typescript types.
It is compatible with any regular viem/wagmi setup and can be used in both frontends and backends

