Inputs
substreams_evm_precompiles_popularity
Package ref
substreams-evm-precompiles-popularity@v0.3.1Run package
CLI
Run map_counts from the command line.
substreams run substreams-evm-precompiles-popularity@v0.3.1 map_counts -e mainnetsubstreams auth or directly on thegraph.market (see docs).README
Substreams EVM Precompiles Popularity
This project leverages Substreams to calculate the popularity of Ethereum precompiled contracts from call data.
Overview
- Processes Ethereum call events using Substreams.
- Counts and maps occurrences of precompiles.
- Outputs results using Protocol Buffers.
Getting Started
substreams gui substreams-evm-precompiles-popularity@v0.2.0
Results
Ethereum Mainnet
At block #21 996 000:
0x0000000000000000000000000000000000000001=> 247543455 (ecrecover)0x0000000000000000000000000000000000000002=> 128524392 (sha256Hash)0x0000000000000000000000000000000000000004=> 46295370 (dataCopy)0x0000000000000000000000000000000000000006=> 44480667 (bn256Add)0x0000000000000000000000000000000000000007=> 44330095 (bn256ScalarMul)0x0000000000000000000000000000000000000005=> 16939742 (bigModExp)0x0000000000000000000000000000000000000008=> 2504972 (bn256Pairing)0x0000000000000000000000000000000000000003=> 618211 (ripemd160Hash)0x000000000000000000000000000000000000000a=> 570252 (kzgPointEvaluation)0x0000000000000000000000000000000000000009=> 161695 (blake2F)
Compute Results
substreams run substreams-evm-precompiles-popularity@v0.2.0 map_counts -s 21996000 -t +1 -o jsonl | skip 1 | head -n1 | jq -rc '."@data".entries | sort_by(-(.count|tonumber)) | .[] | "0x\(.address) => \(.count) (\(.name))"'
License
Apache 2.0
Modules
Execution graph
Store value
int64
Update policy
add
Inputs
Show 3 dependencies
Output
sf.substreams.ethereum.v1.Calls
`filtered_calls` reads from `all_calls` and applies a filter on the called contract, the caller and the method 4-bytes signature Supported operators are: logical or `||`, logical and `&&` and parenthesis: `()` Addresses to match must be written as 0x-prefixed hexadecimal, lowercase, prefixed by `call_to:` or `call_from:`, methods by `call_method:`. Example: `(call_to:0x1234... || call_from:0x1234...) && call_method:0xdeadbeef...`
Output
sf.substreams.ethereum.v1.Calls
Inputs
`index_calls` sets the following keys on the block: * Call contract call_to:0x0123456789abcdef0123456789abcdef01234567 (contract address in hex, prefixed by 0x) * Caller call_from:0x0123456789abcdef0123456789abcdef01234567 (caller address in hex, prefixed by 0x) * Call method call_method:0x01234567 (4 bytes of method signature in hex, prefixed by 0x)
Output
sf.substreams.index.v1.Keys
Inputs