Closed fschoell closed 1 year ago
When building this proposal consider that other blockchains don't have all the same data elements. (eg cpu/net is Antelope specific). On Ethererum chains you might want to count gas fees.
added a first draft implementation in here: https://github.com/EOS-Nation/substreams-monorepo/tree/develop/substreams/blocktivity
Goal
Blocktivity is a tool that calculates the actions / transactions on chain and buckets them into hourly intervals. The current implementation can be found here. It would make sense to re-implement this tool as a Substream.
Models
Maps
map_blocktivity
- Transforms a full block into aBlocktivity
objectStores
Each store will get the
Blocktivity
objects, calculate the key (the timestamp of the hour of this block) and then accumulates the data in multipleStoreAddInt64
stores.store_trx_count
- Adds up the number of transactions per key (hour)store_act_count
- Adds up the number of actions per key (hour)store_cpu_usage_us
- Adds up the cpu_usage_us values per key (hour)store_net_usage_words
- Adds up the net_usage_words per key (hour)Consumers
This would probably be consumed by a custom consumer (Golang/NodeJS) that reads in the buckets and pushes the data as transactions to chain whenever a bucket is full (the current hour has passed).