Request for feedback: Parr, a query tool for Ethereum
Smart contract development on Ethereum has progressed tremendously. But while it’s easy to pull specific data from a transaction or contract, it’s still very hard to search, sort or filter Ethereum data — even at a small scale. How would you get a list of users who have interacted with your smart contract, for instance, let alone sort or filter that list based on arbitrary criteria?
Recently we (Mert, Graham and me — with help from Chris) have put together a tool called Parr that we hope will help solve this challenge. Parr is a tool for querying the Ethereum blockchain. We host Ethereum nodes and index their data in Elasticsearch for large-scale querying of blocks, transactions, addresses (both wallets and contracts), and more.
Before jumping into the specifics, I want to make it clear that Parr is still in beta and is in many ways an incomplete product (don’t try using Parr on mobile just yet 😬). Rather than continue to work on it privately, we’ve decided to open source the codebase and ask the community for feedback. We’re sharing Parr earlier than may be comfortable for us. But we hope that this post encourages others to get involved and push the product in directions that increase the likelihood of it being used. With that, let’s jump into some use cases…
Filtering
We’ve only indexed the last ~140,000 blocks as a proof of concept. But the first and most obvious use case for Parr is filtering blocks, transactions or addresses by some criteria. For instance, here are all the blocks mined by Nanopool: https://parr.io/editor/5c8eb02f9dec4e14311f954adbfc486dcab8b636.
You’ll see that the Parr UI is still very raw and requires a lot of domain-specific knowledge to use. Unless you’re familiar with Elasticsearch and do some digging into Parr’s schema, it will be hard to write your own queries. Over time, we’d like to have more user-friendly websites or dashboards built on top of the Parr API. For now we’re optimizing for flexibility in the hopes that behavior we never imagined will emerge.
Let’s try another query. Here’s the link to all addresses that have sent a 100+ ETH transaction to the EOS crowdsale contract (in the last ~140,000 blocks): https://parr.io/editor/45f26496b65f3949d4e978153c0c350e79bdbf83.
And here is a list of those high-value transactions: https://parr.io/editor/cff8fb7e144f820dd14898128c86c39b2a8197ff.
I’ve added an aggregation to the query, so you can click in and see which addresses have the most 100+ ETH transactions. Unsurprisingly, the top ones all look like Binance-affiliated wallets.
Sorting
Many of Parr’s earliest and most interested users have been investors or fund managers who have wanted to rank contracts by transaction volume or some usage metric. Here’s an example where we rank all non-fungible token contracts by their transaction volume over the last 24 hours (note: look at the _score field for the number of transactions): https://parr.io/editor/fe52950070bae656241329307501ecbabcadf429.
No surprise that Cryptokitties is first with ~3,500 incoming transactions in the last 24 hours. But who is next? HyperDragons, something called StaryFox, Fishbank and CryptoBots follow with hundreds of transactions each 🤔.
You can click into the results and view metadata about each address, like what contract standards they implement and the contract name and symbol.
Using aggregations we can also rank types of contracts by transaction volume. Here’s an example that compares volume over the last 24 hours between the updated ERC 721 standard and contracts that still implement the original version: https://parr.io/editor/b4830d753dfb9298621cc866367b54dcf1c99a65.
Or how about overall volume between ERC20 tokens, crowdsales, and non-fungible tokens: https://parr.io/editor/085b30307e338601fcd5d13db53a00378dcd62f4? The majority of volume is sent to ERC20 tokens—nice to see utility tokens getting used, right?
Discovery
I think one of the most exciting features of the Ethereum ecosystem is that activity and (some) data are public. We hope to see Parr used to identify promising protocols or token models based on their public usage data before they are broadly marketed. And we could even deploy Parr on test networks to spot products before they are live on mainnet!
Smart contract code is another source for discovery. But smart contract code and Application Binary Interfaces (ABIs) aren’t by default shared with the community. Products like Etherscan that encourage the sharing of code are helpful, but they still require extra work from development teams.
With Parr, we’ve found a way to analyze smart contract code by comparing the bytecode at Ethereum addresses with a collection of generic ABIs. Because so many developers use previously audited and standardized code, often from OpenZeppelin, we’re able to identify standard tokens, non-fungible tokens, or crowdsales just from their bytecode.
Not only do we analyze bytecode at index time, we also make the bytecode itself searchable. So users can search for addresses that implement their own ABIs — or just specific methods. For instance, the assetsOf method was a feature of the ERC821 standard. Here are all addresses that implement that method: https://parr.io/editor/7cbb0cf20900fb338f96e87a2761a466ca30573b.
Just supply the implements_abi endpoint with a custom ABI, and Parr searches the bytecode at every Ethereum address for instances of that ABI!
Future work
As mentioned above, Parr is still incomplete in many ways. We’re hoping that by sharing our progress others are encouraged to get involved and give feedback.
We have a bunch of ideas for future versions of Parr — like dashboards for specific endpoints or a notifications system that emails you when certain criteria is met. But we’re most excited about hearing new ideas and applications we haven’t imagined.
Don’t hesitate to comment on this post or reach out to any of us on twitter: @trembleice, @grahamkaemmer, or @pfletcherhill.
If you’re interested in digging into the code, we’ve open-sourced it all on Github: