GraphQL

TIP

You can find the source code of this package at packages/core-graphql.

Installation

yarn add @arkecosystem/core-graphql

Configuration

module.exports = {
  enabled: false,
  host: process.env.ARK_GRAPHQL_HOST || '0.0.0.0',
  port: process.env.ARK_GRAPHQL_PORT || 4005,
  path: '/graphql',
}

Usage

You can play with the data using the GraphQL Playground, or programmatically posting querys directly to the endpoint. By default the endpoint is http://0.0.0.0:4005/graphql, but can be changed in your configuration.

Query Examples

Get first blocks

{
  blocks(orderBy: { field: "height", direction: ASC }) {
    id
    payloadHash
    height
    numberOfTransactions
  }
}

Get the list of transactions from a specific block

{
  block(id: "13114381566690093367") {
    timestamp
    generatorPublicKey
    transactions {
      id
      type
      amount
    }
  }
}

Get the recipient info of each transaction

{
  block(id: "13114381566690093367") {
    generatorPublicKey
    transactions {
      id
      recipient {
        address
        balance
      }
    }
  }
}
Last Updated: 11/22/2018, 3:32:23 AM