graphprotocol / graph-node

Graph Node indexes data from blockchains such as Ethereum and serves it over GraphQL
https://thegraph.com
Apache License 2.0
2.9k stars 967 forks source link

`blockHandler` feature request #3714

Open melotik opened 2 years ago

melotik commented 2 years ago

Do you want to request a feature or report a bug?: Feature request

What is the current behavior?

Currently blockHandlers are somewhat limited, and the fields available differ quite a bit network to network. It would be ideal if the following fields were included for each chain type:

EVM:

transactionCount or list of transaction hashes gasPrice (if possible) contracts/block contract calls/block list of addresses that accessed a block (used to calculate addresses/block)

Ideally a blockHandler would return a list of Transaction types and then we could dive into a transaction to see to/from addresses, gasUsed, gasPrice, etc.

Arweave:

transaction count

Again, it would be ideal to dive into transactions to see the size of each transaction

Cosmos:

gas used/ gas wanted

if we can dive into transactions to see gas used/wanted even better

Near:

transaction list (for transaction count / gas used) transactionFees

azf20 commented 2 years ago

Hi @dmelotik ! Thanks for this, I am keen to understand your use case a little more, are you building subgraphs across networks? In general the schema / fields available is informed by the protocol, rather than generalising across them

melotik commented 2 years ago

Hey @azf20, we are making a network level subgraph across all chains supported by thegraph. So we are trying to capture as many useful network-level metrics as possible to drive data analysis and research.

If we were to get some of these features added to the blockHandlers the most pressing would be transaction count and gas price for EVM chains. That will drive metrics like transactions/block/day and then we are able to calculate rewards/block.

You can view a WIP solution here (see the schema for what we are grabbing, but certain metrics are not avail across other chains): https://github.com/messari/subgraphs/pull/298

lmk if I can clear anything up or provide more context

melotik commented 1 year ago

bumping this @azf20, not sure how much of a lift this is (ie, going to have to weigh the cost/benefit). But ideally we would be able to expose all of the data on each block. We want to have the most complete data set we can.

It has been something we have had to do to our best ability with what we have and then defer the rest to substreams.