当前位置: 首页 > 软件库 > 大数据 > 数据查询 >

graph-node

授权协议 View license
开发语言 Java
所属分类 大数据、 数据查询
软件类型 开源软件
地区 不详
投 递 者 魏硕
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Graph Node

Build Status

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 the Getting Started Guide.

Quick Start

Prerequisites

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

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

Running a Local Graph Node

This is a quick example to show a working Graph Node. It is a subgraph for Gravatars.

  1. Install IPFS and run ipfs init followed by ipfs daemon.
  2. Install PostgreSQL and run initdb -D .postgres followed by pg_ctl -D .postgres -l logfile start and createdb graph-node.
  3. If using Ubuntu, you may need to install additional packages:
    • sudo apt-get install -y clang libpq-dev libssl-dev pkg-config
  4. In the terminal, clone https://github.com/graphprotocol/example-subgraph, and install dependencies and generate types for contract ABIs:
yarn
yarn codegen
  1. In the terminal, clone https://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 [URL] \
  --ipfs 127.0.0.1:5001

Try your OS username as USERNAME and PASSWORD. For details on settingthe connection string, check the Postgresdocumentation.graph-node uses a few Postgres extensions. If the Postgres user with whichyou run graph-node is a superuser, graph-node will enable theseextensions when it initalizes the database. If the Postgres user is not asuperuser, you will need to create the extensions manually since onlysuperusers are allowed to do that. To create them you need to connect as asuperuser, which in many installations is the postgres user:

psql -q -X -U <SUPERUSER> graph-node <<EOF
create extension pg_trgm;
create extension pg_stat_statements;
create extension btree_gist;
create extension postgres_fdw;
grant usage on foreign data wrapper postgres_fdw to <USERNAME>;
EOF

This will also spin up a GraphiQL interface at http://127.0.0.1:8000/.

  1. With this Gravatar example, to get the subgraph working locally run:
yarn create-local

Then you can deploy the subgraph:

yarn deploy-local

This will build and deploy the subgraph to the Graph Node. It should start indexing the subgraph immediately.

Command-Line Interface

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 information

OPTIONS:
        --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:[CAPABILITIES]:FILE>
            Ethereum network name (e.g. 'mainnet'), optional comma-seperated capabilities (eg full,archive), and an 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:[CAPABILITIES]:URL>
            Ethereum network name (e.g. 'mainnet'), optional comma-seperated capabilities (eg 'full,archive'), and an Ethereum RPC URL, separated by a ':'

        --ethereum-ws <NETWORK_NAME:[CAPABILITIES]:URL>
            Ethereum network name (e.g. 'mainnet'), optional comma-seperated capabilities (eg `full,archive), and an 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]

Advanced Configuration

The command line arguments generally are all that is needed to run agraph-node instance. For advanced uses, various aspects of graph-nodecan further be configured through environmentvariables. Verylarge graph-node instances can also split the work of querying andindexing across multiple databases.

Project Layout

  • 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.

Roadmap

�� = 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

Contributing

Please check CONTRIBUTING.md for development flow and conventions we use.Here's a list of good first issues.

License

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

The Graph is dual-licensed under the MIT license and the Apache 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.

  • graph托管服务目前支持的主网 Ethereum mainnet Kovan Rinkeby Ropsten Goerli PoA-Core PoA-Sokol xDAI Matic Mumbai Fantom Binance Smart Chain Clover Avalanche Fuji Celo Celo-Alfajores Fuse Moonbeam Arbitrum One Arbi

  • 前言 最近在学习区域卷积神经网络(RCNN)时,候选框产生使用了选择搜索(selective search),选择搜索中第一步图像分割又使用了基于图的图像分割(Effective graph-based image segmentation)。所以从底层开始研究基于图的图像分割(Effective graph-based image segmentation)。 简介 该图像分割算法的详细介绍可以

 相关资料
  • Clone Graph 描述 Clone an undirected graph. Each node in the graph contains a label and a list of its neighbours. OJ's undirected graph serialization: Nodes are labeled uniquely. We use # as a separator

  • Graph Valid Tree 描述 Given n nodes labeled from 0 to n-1 and a list of undirected edges (each edge is a pair of nodes), write a function to check whether these edges make up a valid tree. Example 1: In

  • graph是存储绘图数据的组件。graph组件 接收transfer组件推送上来的监控数据,同时处理api组件的查询请求、返回绘图数据。 服务部署 服务部署,包括配置修改、启动服务、检验服务、停止服务等。这之前,需要将安装包解压到服务的部署目录下。 # 修改配置, 配置项含义见下文 mv cfg.example.json cfg.json vim cfg.json # 启动服务 ./open-f

  • Graph# 是一个图形布局绘制框架,包含很多布局算法,适用于 WPF 程序。

  • 图的表示通常使用邻接矩阵和邻接表,前者易实现但是对于稀疏矩阵会浪费较多空间,后者使用链表的方式存储信息但是对于图搜索时间复杂度较高。 编程实现 邻接矩阵 设顶点个数为 V, 那么邻接矩阵可以使用 V × V 的二维数组来表示。 g[i][j]表示顶点i和顶点j的关系,对于无向图可以使用0/1表示是否有连接,对于带权图则需要使用INF来区分。有重边时保存边数或者权值最大/小的边即可。 Python

  • 本章主要总结图与搜索相关题目。