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.91k stars 974 forks source link

Should be able to run Substreams for other network than Ethereum #4302

Closed maoueh closed 1 year ago

maoueh commented 1 year ago

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

Feature

What is the current behavior?

AFAIK today, it's not possible to run a Substreams for something else than Ethereum network.

What is the expected behavior?

It should be possible to use a Substreams for any network. This raises interesting questions for network not supported at all today in graph-node. Even for existing networks, it raises interesting questions like the requirement for a block ingestor.

azf20 commented 1 year ago

@maoueh do you mean other than Ethereum mainnet (I think you can configure different networks currently @mangas?), or do you mean for other protocols e.g. Solana

mangas commented 1 year ago

IIRC the adapter could be added to any network but we may have code that's ethereum specific. In any case this wouldn't have been tested and so it's not really ready. So think this is ticket is relevant.

In terms of stuff like solana, I'm not sure how that would be handled, as far as I know we haven't looked into it at all.

maoueh commented 1 year ago

Yeah we have two cases here:

maoueh commented 1 year ago

The first bullet is probably an easy task. The second one, not quite clear what we should do exactly. There will be discussion to have around how we deal with that, around the block ingestor specifically.

For the block ingestor, we could force operators to also provide Firehose gRPC endpoint on the same URL as the Substreams endpoint. Other idea is to provide a "graph-node-block-ingestorSubstreams that would emit graph-node required block info, we simply run this Substreams.spkg` as the block ingestor "provider".

There is probably other area that would need to work for "unsupported" network, to be discovered.

matthewdarwin commented 1 year ago

Is there any decision on how to move forward on this? We are seeing requests to integrate more chains with graph-node.

maoueh commented 1 year ago

For head tracking, I created https://github.com/streamingfast/substreams-sink-noop/tree/develop/substreams-head-tracker, it's a Substreams that accepts a single params argument and I leverage Substreams RPC to retrieve the "head" block of the chain.

Something we could use to enable any Substreams network to be consumed by graph-node!

mangas commented 1 year ago

Support has been added to run substreams for the already supported networks, for new chains I guess that will require a bigger discussion.