Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Graph Node indexes data from blockchains such as Ethereum and serves it over GraphQL

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

graphprotocol/graph-node

Build StatusGetting Started Docs

Overview

The Graph is a decentralized protocol that organizes and distributes blockchain data across the leading Web3 networks. A key component of The Graph's tech stack is Graph Node.

Before usinggraph-node, it is highly recommended that you read theofficial Graph documentation to understand Subgraphs, which are the central mechanism for extracting and organizing blockchain data.

This guide is for:

  1. Subgraph developers who want to rungraph-node locally to test their Subgraphs during development
  2. Contributors who want to add features or fix bugs tograph-node itself

Runninggraph-node from Docker images

For subgraph developers, it is highly recommended to use prebuilt Dockerimages to set up a localgraph-node environment. Please readtheseinstructions to learn how to do that.

Runninggraph-node from source

This is usually only needed for developers who want to contribute tograph-node.

Prerequisites

To build and run this project, you need to have the following installed on your system:

  • Rust (latest stable): FollowHow to installRust. Runrustup install stable inthis directory to make sure all required components areinstalled. Thegraph-node code assumes that the latest availablestable compiler is used.
  • PostgreSQL:PostgreSQL Downloads listsdownloads for almost all operating systems.
    • For OSX: We highly recommendPostgres.app.
    • For Linux: Use the Postgres version that comes with the distribution.
  • IPFS:Installing IPFS
  • Protobuf Compiler:Installing Protobuf

For Ethereum network data, you can either run your own Ethereum node or use an Ethereum node provider of your choice.

Create a database

Once Postgres is running, you need to issue the following commands to create a databaseand configure it for use withgraph-node.

The name of theSUPERUSER depends on your installation, but is usuallypostgres or your username.

psql -U<SUPERUSER><<EOFcreate user graph with password '<password>';create database "graph-node" with owner=graph template=template0 encoding='UTF8' locale='C';create extension pg_trgm;create extension btree_gist;create extension postgres_fdw;grant usage on foreign data wrapper postgres_fdw to graph;EOF

For convenience, set the connection string to the database in an environmentvariable, and save it, e.g., in~/.bashrc:

export POSTGRES_URL=postgresql://graph:<password>@localhost:5432/graph-node

Use thePOSTGRES_URL from above to havegraph-node connect to thedatabase. If you ever need to manually inspect the contents of yourdatabase, you can do that by runningpsql $POSTGRES_URL. Running thiscommand is also a convenient way to check that the database is up andrunning and that the connection string is correct.

Build and Rungraph-node

Clone this repository and run this command at the root of the repository:

export GRAPH_LOG=debugcargo run -p graph-node --release -- \  --postgres-url$POSTGRES_URL \  --ethereum-rpc NETWORK_NAME:[CAPABILITIES]:URL \  --ipfs 127.0.0.1:5001

The argument for--ethereum-rpc contains a network name (e.g.mainnet) anda list of provider capabilities (e.g.archive,traces). The URL is the addressof the Ethereum node you want to connect to, usually ahttps URL, so that theentire argument might bemainnet:archive,traces:https://provider.io/some/path.

Whengraph-node starts, it prints the various ports that it is listening on.The most important of these is the GraphQL HTTP server, which by defaultis athttp://localhost:8000. You can use routes like/subgraphs/name/<subgraph-name>and/subgraphs/id/<IPFS hash> to query subgraphs once you have deployed them.

Deploying a Subgraph

Follow theSubgraph deploymentguide.After setting upgraph-cli as described, you can deploy a Subgraph to yourlocal Graph Node instance.

Advanced Configuration

The command line arguments generally are all that is needed to run agraph-node instance. For advanced uses, various aspects ofgraph-nodecan further be configured throughenvironmentvariables.

Very largegraph-node instances can also be configured using aconfiguration file That is usually only necessary whenthegraph-node needs to connect to multiple chains or if the work ofindexing and querying needs to be split acrossmultiple databases.

Contributing

Please checkCONTRIBUTING.md for development flow and conventions we use.Here'sa list of good first issues.

License

Copyright © 2018-2019 Graph Protocol, Inc. and contributors.

The Graph is dual-licensed under theMIT license and theApache License, Version 2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expressed or implied. See the License for the specific language governing permissions and limitations under the License.

About

Graph Node indexes data from blockchains such as Ethereum and serves it over GraphQL

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors124


[8]ページ先頭

©2009-2025 Movatter.jp