Coder Social home page Coder Social logo

john-alonso-debug / skywalker-graphql Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 9.98 MB

License: Apache License 2.0

Rust 89.07% Dockerfile 0.09% Shell 0.33% Makefile 0.01% TypeScript 1.36% CSS 2.94% HTML 0.47% PLpgSQL 4.51% JavaScript 1.11% Solidity 0.12%

skywalker-graphql's Introduction

Graph Node

Build Status Getting Started Docs

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 the Ethereum Name Service (ENS) that The Graph team built.

  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/ens-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. The password might be optional. It depends on your setup.

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

  1. With this ENS 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 a graph-node instance. For advanced uses, various aspects of graph-node can further be configured through environment variables. Very large graph-node instances can also split the work of querying and indexing across multiple databases.

Project Layout

  • node — A local Graph Node.
  • graph — A library providing traits for system components and types for common data.
  • core — A library providing implementations for core components, used by all nodes.
  • chain/ethereum — A library with components for obtaining data from Ethereum.
  • 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 interface and 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.

skywalker-graphql's People

Contributors

adklempner avatar adzialocha avatar akeem avatar amxx avatar ana0 avatar cag avatar cyrilledec avatar davekaj avatar dependabot-preview[bot] avatar dorgjelli avatar evaporei avatar fordn avatar fubhy avatar html5cat avatar jannis avatar john-alonso-debug avatar leoyvens avatar llogiq avatar lutter avatar nachomazzara avatar nenadjaja avatar pulkitsethi avatar riccardobiosas avatar rodventures avatar that3percent avatar tilacog avatar timmclean avatar yanivtal avatar zerim avatar zmanian avatar

Watchers

 avatar

skywalker-graphql's Issues

RUSTSEC-2020-0036: failure is officially deprecated/unmaintained

failure is officially deprecated/unmaintained

Details
Status unmaintained
Package failure
Version 0.1.8
URL rust-lang-deprecated/failure#347
Date 2020-05-02

The failure crate is officially end-of-life: it has been marked as deprecated
by the former maintainer, who has announced that there will be no updates or
maintenance work on it going forward.

The following are some suggested actively developed alternatives to switch to:

See advisory page for additional details.

RUSTSEC-2021-0020: Multiple Transfer-Encoding headers misinterprets request payload

Multiple Transfer-Encoding headers misinterprets request payload

Details
Package hyper
Version 0.12.36
URL GHSA-6hfq-h8hq-87mf
Date 2021-02-05
Patched versions >=0.14.3,>=0.13.10, <0.14.0
Unaffected versions <0.12.0

hyper's HTTP server code had a flaw that incorrectly understands some requests
with multiple transfer-encoding headers to have a chunked payload, when it
should have been rejected as illegal. This combined with an upstream HTTP proxy
that understands the request payload boundary differently can result in
"request smuggling" or "desync attacks".

See advisory page for additional details.

RUSTSEC-2021-0013: Soundness issues in `raw-cpuid`

Soundness issues in raw-cpuid

Details
Package raw-cpuid
Version 7.0.4
URL rustsec/advisory-db#614
Date 2021-01-20
Patched versions >=9.0.0

Undefined behavior in as_string() methods

VendorInfo::as_string(), SoCVendorBrand::as_string(),
and ExtendedFunctionInfo::processor_brand_string() construct byte slices
using std::slice::from_raw_parts(), with data coming from
#[repr(Rust)] structs. This is always undefined behavior.

See gz/rust-cpuid#40.

This flaw has been fixed in v9.0.0, by making the relevant structs
#[repr(C)].

native_cpuid::cpuid_count() is unsound

native_cpuid::cpuid_count() exposes the unsafe __cpuid_count() intrinsic
from core::arch::x86 or core::arch::x86_64 as a safe function, and uses
it internally, without checking the
safety requirement:

> The CPU the program is currently running on supports the function being
> called.

CPUID is available in most, but not all, x86/x86_64 environments. The crate
compiles only on these architectures, so others are unaffected.

This issue is mitigated by the fact that affected programs are expected
to crash deterministically every time.

See gz/rust-cpuid#41.

The flaw has been fixed in v9.0.0, by intentionally breaking compilation
when targetting SGX or 32-bit x86 without SSE. This covers all affected CPUs.

See advisory page for additional details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.