EOSIO

Available on:

  • EOS Mainnet
  • Worbli
  • CryptoKylin Testnet
  • Jungle 2.0 Testnet
  • Your own network

Ethereum (Alpha)

Available on:

  • Ethereum Mainnet
  • Ropsten

dfuse Brings the Power of GraphQL to EOS

Apr 26, 2019 2:37:17 PM / by dfuse

Continuing our mission at dfuse to bring powerful developer tools to the blockchain, we are thrilled to introduce the strength of GraphQL to EOSIO. It helps to greatly reduce the returned payload when running a query, giving you the ability to pin-point *just* the data you need.

GraphQL was introduced as open source by Facebook in 2015, and has since seen an incredible uptake in adoption among software engineers. It has simplified the lives of many developers, in large part due to it enforcing a defined and shared schema: this provides clear contract boundaries between the developer and the API provider.

GraphQL Queries and Subscriptions

GraphQL Queries are request/response calls, but, unlike REST where you fetch one resource at a time, a GraphQL Query enables you to fetch multiple related pieces of data in a single query. You can read a plethora of comparisons of REST vs GraphQL on the web.

GraphQL Subscriptions enable streaming of messages, usually over a WebSocket, to enable an app to be informed in real-time of anything new. dfuse uses GraphQL Subscriptions to enable you to stream transactions as they occur in real-time, and enables you to navigate any chain reorganization.

Getting Started with GraphQL on dfuse

We’ve fully documented the process for getting started with dfuse, with examples in both Go and JavaScript for GraphQL. There’s also extensive documentation to help you get the most out of these new endpoints.

Screen Shot 2019-04-26 at 1.05.03 PM

dfuse offers GraphQL over gRPC for server-to-server connectivity, as well as over the Apollo WebSocket Transports Protocol for users in browsers.

You can use our GraphiQL playground to test it out. Be sure to take advantage of the built in auto-completion to help with discoverability, as well as the documentation for each field.

Screen Shot 2019-04-26 at 1.56.31 PM

Some benefits of using GraphQL:

  • Save bandwidth and processing: retrieve only the data you need, avoid clogging pipes and data plans with useless data.
  • Combined with the brand new search features in the API, you can use the power of dfuse Search in streaming mode: you can be even more specific as to what you retrieve.
  • Strictly defined schemas mean clean documentation, easy discovery, auto-completion, incredible developer tooling and improved development experience.
  • For EOS, this means configurable encoding of some fields (like representing a number as an account name, or an asset symbol, or as a hex string, etc.), doing more work in fewer queries.

dfuse-graphql

We have slowly rolled out the GraphQL endpoints to all supported networks. The dfuse GraphQL interface is currently in Beta, and as such we welcome your feedback and comments. We are excited to enable you to do more, with less.

topics dfuse API, Release, GraphQL, Endpoint