Skip to content

Latest commit

 

History

History
44 lines (33 loc) · 1.29 KB

04_explorer.md

File metadata and controls

44 lines (33 loc) · 1.29 KB

Explorer mode

The node can be configured to work as a explorer. This consumes more resources, but makes it possible to query data otherwise not available.

Configuration

There is two ways of enabling the explorer api. It can either be done by passing the --enable-explorer flag on the start arguemnts or by the config file:

explorer:
    enabled: true

CORS

For configuring CORS the explorer API, this needs to be done on the REST section of the config, as documented here.

API

A graphql interface can be used to query the explorer data, when enabled, two endpoints are available in the REST interface: /explorer/graphql and /explorer/graphiql .

The first is the one that queries are made against, for example:

curl \
    -X POST \
    -H "Content-Type: application/json" \
    --data '{'\
        '"query": "{'\
        '   status {'\
        '       latestBlock {'\
        '           chainLength'\
        '           id'\
        '           previousBlock {'\
        '               id'\
        '           }'\
        '       }'\
        '   }'\
        '}"'\
    '}' \
  http://127.0.0.1:8443/explorer/graphql

While the second serves an in-browser graphql IDE that can be used to try queries interactively.