Skip to content

streamingfast/dgraphql

Repository files navigation

StreamingFast GraphQL API Services for Blockchains

reference License

This service is the API for querying blockchain data using GraphQL. It is part of StreamingFast.

Installation

See the different protocol-specific StreamingFast binaries at https://github.com/streamingfast/streamingfast#protocols

Current dgraphql implementations:

Usage

Connecting from command-line clients

  • Using https://github.com/Gavinpub/ws (which supports subprotocol negotiation)

    ws -s graphql-ws ws://127.0.0.1:8080/graphql

    {"id":"3","type":"connection_init","payload":{"Authorization":"Bearer ......"},"variables":null}}

    {"id":"3","type":"start","payload":{"query":"subscription{searchTransactionsForward(query: "status:executed", lowBlockNum:0, highBlockNum:0){ trace{ block { num } id }}}","variables":null}}

    {"id":"3","type":"start","payload":{"query":"subscription{searchTransactionsForward(query: "status:executed", lowBlockNum:0, highBlockNum:0){ trace{ block { num } id }}}","variables":null}}

  • Using curl:

    curl http://localhost:8080/graphql -XPOST -d '{"query": "{ searchTransactionsForward(limit: 10, query: "status:executed") { cursor } }"}' -H "Authorization: Bearer $SF_API_TOKEN" | jq .

    curl http://localhost:8080/graphql -XPOST -d '{"query": "{ blockIDByTime(time: "2019-01-01T00:00:00Z") { time num } }"}' -H "Authorization: Bearer $SF_API_TOKEN" | jq .

Contributing

Issues and PR in this repo related strictly to the core dgraphql API engine

Report any protocol-specific issues in their respective repositories

Please first refer to the general StreamingFast contribution guide, if you wish to contribute to this code base.

This codebase uses unit tests extensively, please write and run tests.

License

Apache 2.0