Calindra / graph-node

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

[The Graph] Run the node #1

Open fabiooshiro opened 2 weeks ago

fabiooshiro commented 2 weeks ago

Run the graph node and point it to a local anvil instance to test a basic integration.

fabiooshiro commented 2 weeks ago

I got an error:

error: failed to run custom build command for `graph v0.35.0 (/workspace/graph-node/graph)`

Caused by:
  process didn't exit successfully: `/workspace/graph-node/target/debug/build/graph-002e2dacbf9ca36a/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-changed=proto
  cargo:rerun-if-changed=proto/firehose.proto
  cargo:rerun-if-changed=proto/ethereum/transforms.proto
  cargo:rerun-if-changed=proto/near/transforms.proto
  cargo:rerun-if-changed=proto/cosmos/transforms.proto
  cargo:rerun-if-changed=proto

  --- stderr
  thread 'main' panicked at graph/build.rs:14:10:
  Failed to compile Firehose proto(s): Custom { kind: NotFound, error: "Could not find `protoc`. If `protoc` is installed, try setting the `PROTOC` environment variable to the path of the `protoc` binary. To install it on Debian, run `apt-get install protobuf-compiler`. It is also available at https://github.com/protocolbuffers/protobuf/releases  For more information: https://docs.rs/prost-build/#sourcing-protoc" }
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

Installing:

sudo apt-get install protobuf-compiler
fabiooshiro commented 2 weeks ago

After installing the protobuf compiler, the cargo build command worked

sandhilt commented 2 weeks ago

Protobuf is one of the requirements. See here.

fabiooshiro commented 2 weeks ago

I'm following this doc -> https://firehose.streamingfast.io/integrate-new-chains/firehose-starter#implement-the-reader, however the console_reader.go file is missing.

fabiooshiro commented 2 weeks ago

Those instructions are now a bit outdated sadly, sorry. There is no need for a specific console reader per integration.

https://github.com/streamingfast/firehose-core?tab=readme-ov-file#firehose-multi-chain-executor

The firehose-core project and its firecore binary can be used directly nowadays, as long as the reader-node invoked program respects the expected output format. No need for a specific firehose-.

Invocation is something like firecore start --reader-node-path= --reader-node-arguments=...

You can find the generic console reader here https://github.com/streamingfast/firehose-core/blob/develop/consolereader.go.

Expected format out of stdout should be:

FIRE INIT 3.0 <Protobuf Message Fully Qualified ID>
FIRE BLOCK <block_num:integer> <block_hash:string> <parent_num:integer> <parent_hash:string <last_irreversible_block_num:integer> <timestamp:unix_nano_integer> <block:base64 encoded google.protobuf.Any of Block model>
...

See https://github.com/streamingfast/firehose-core/blob/develop/consolereader_test.go#L74-L75 for an test example (it uses 1.0 as the version, but you should really specify 3.0).

Original msg: https://discord.com/channels/666749063386890256/1278460328933589046/1278523243099197482