- Notifications
You must be signed in to change notification settings - Fork1
Graph Node indexes data from blockchains such as Ethereum and serves it over GraphQL
License
Apache-2.0, MIT licenses found
Licenses found
PortalNetwork/graph-node
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
The Graph is a protocol for building decentralized applications (dApps) quickly on Ethereum and IPFS using GraphQL.
Graph Node is an open source Rust implementation that event sources the Ethereum blockchain to deterministically update a data store that can be queried via the GraphQL endpoint.
For detailed instructions and more context, check out theGetting Started Guide.
To build and run this project you need to have the following installed on your system:
- Rust (latest stable) –How to install Rust
- PostgreSQL –PostgreSQL Downloads
- IPFS –Installing IPFS
For Ethereum network data, you can either run a local node or use Infura.io:
- Local node –Installing and running Ethereum node
- Infura infra –Infura.io
This is a quick example to show a working Graph Node. It is asubgraph for the Ethereum Name Service (ENS) that The Graph team built.
- Install IPFS and run
ipfs initfollowed byipfs daemon. - Install PostgreSQL and run
initdb -D .postgresfollowed bypg_ctl -D .postgres -l logfile startandcreatedb graph-node. - If using Ubuntu, you may need to install additional packages:
sudo apt-get install -y clang libpq-dev libssl-dev pkg-config
- In the terminal, clonehttps://github.com/graphprotocol/ens-subgraph, and install dependencies and generate types for contract ABIs:
yarnyarn codegen- In the terminal, clonehttps://github.com/graphprotocol/graph-node, and run
cargo build.
Once you have all the dependencies set up, you can run the following:
cargo run -p graph-node --release -- \ --postgres-url postgresql://USERNAME[:PASSWORD]@localhost:5432/graph-node \ --ethereum-rpc mainnet:https://mainnet.infura.io/v3/[PROJECT_ID] \ --ipfs 127.0.0.1:5001Try your OS username asUSERNAME andPASSWORD. The password might be optional. It depends on your setup.
If you're using Infura you shouldsign up to get a PROJECT_ID, it's free.
This will also spin up a GraphiQL interface athttp://127.0.0.1:8000/.
- With this ENS example, to get the subgraph working locally run:
yarn create-localThen you can deploy the subgraph:
yarn deploy-localThis will build and deploy the subgraph to the Graph Node. It should start indexing the subgraph immediately.
USAGE: graph-node [FLAGS] [OPTIONS] --ethereum-ipc <NETWORK_NAME:FILE> --ethereum-rpc <NETWORK_NAME:URL> --ethereum-ws <NETWORK_NAME:URL> --ipfs <HOST:PORT> --postgres-url <URL>FLAGS: --debug Enable debug logging -h, --help Prints help information -V, --version Prints version informationOPTIONS: --admin-port <PORT> Port for the JSON-RPC admin server [default: 8020] --elasticsearch-password <PASSWORD> Password to use for Elasticsearch logging [env: ELASTICSEARCH_PASSWORD] --elasticsearch-url <URL> Elasticsearch service to write subgraph logs to [env: ELASTICSEARCH_URL=] --elasticsearch-user <USER> User to use for Elasticsearch logging [env: ELASTICSEARCH_USER=] --ethereum-ipc <NETWORK_NAME:FILE> Ethereum network name (e.g. 'mainnet') and Ethereum IPC pipe, separated by a ':' --ethereum-polling-interval <MILLISECONDS> How often to poll the Ethereum node for new blocks [env: ETHEREUM_POLLING_INTERVAL=] [default: 500] --ethereum-rpc <NETWORK_NAME:URL> Ethereum network name (e.g. 'mainnet') and Ethereum RPC URL, separated by a ':' --ethereum-ws <NETWORK_NAME:URL> Ethereum network name (e.g. 'mainnet') and Ethereum WebSocket URL, separated by a ':' --http-port <PORT> Port for the GraphQL HTTP server [default: 8000] --ipfs <HOST:PORT> HTTP address of an IPFS node --node-id <NODE_ID> a unique identifier for this node [default: default] --postgres-url <URL> Location of the Postgres database used for storing entities --subgraph <[NAME:]IPFS_HASH> name and IPFS hash of the subgraph manifest --ws-port <PORT> Port for the GraphQL WebSocket server [default: 8001]Seehere for a list ofthe environment variables that can be configured.
node— A local Graph Node.graph— A library providing traits for system components and types forcommon data.core— A library providing implementations for core components, used by allnodes.chain/ethereum— A library with components for obtaining data fromEthereum.graphql— A GraphQL implementation with API schema generation,introspection, and more.mock— A library providing mock implementations for all system components.runtime/wasm— A library for running WASM data-extraction scripts.server/http— A library providing a GraphQL server over HTTP.store/postgres— A Postgres store with a GraphQL-friendly interfaceand audit logs.
🔨 = In Progress
🛠 = Feature complete. Additional testing required.
✅ = Feature complete
| Feature | Status |
|---|---|
| Ethereum | |
| Indexing smart contract events | ✅ |
| Handle chain reorganizations | ✅ |
| Mappings | |
| WASM-based mappings | ✅ |
| TypeScript-to-WASM toolchain | ✅ |
| Autogenerated TypeScript types | ✅ |
| GraphQL | |
| Query entities by ID | ✅ |
| Query entity collections | ✅ |
| Pagination | ✅ |
| Filtering | ✅ |
| Entity relationships | ✅ |
| Subscriptions | ✅ |
Please checkCONTRIBUTING.md for development flow and conventions we use.Here'sa list of good first issues.
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
Resources
License
Apache-2.0, MIT licenses found
Licenses found
Code of conduct
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.