Skip to content
pokt-networkPublic

About

Pocketdex is an indexer for the Shannon implementation of the pocket network protocol.

Resources

Stars

4 stars

Watchers

4 watching

Forks

Latest commit

 

History

153 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

poketdex.png
pocketdex-mono.png
gotta-cache-em-all2.png

Pocketdex

Pocketdex is an indexer for the Shannon implementation of the pocket network protocol.

It is built using the SubQuery SDK, which wraps postgraphile to provide a robust GraphQL API to the indexed data.

To learn more about SubQuery, see their docs.

Usage & Query Docs

See the introduction docs directory for details on how to use indexed data after you're fully set up.

Explore via postgres

Connect to the postgres container, update the schema, and explore! NOTE: this assumes you have psql cli.

psql -- psql -U postgres -d postgres
SET SCHEMA "testnet";
# OR, if indexing localnet:
# SET SCHEMA "localnet";
SET search_path TO app;
\dt

Explore via PgAdmin4

Navigate to: http://localhost:5050 or into Tilt UI under pocketdex-db section and look for the pgadmin resource, which will have the admin email and password at top-left of it.

Explore via GraphQL

Navigate to http://localhost:3000 or the port you specified in .env.development at SUBQUERY_GRAPHQL_ENGINE_PORT var.

The public schema is being closed to plain entity lists and documented functions: see docs/graphql-migration.md for what replaces relations, aggregates and the hidden tables.

Click to expand sample query
  query  {
      distinct_poktroll_event_types: events (distinct: TYPE, filter: {type: {includes: "poktroll"}}){
      totalCount
      nodes {
        type
      }
    }

    distinct_poktroll_message_types: messages (distinct: TYPE_URL, filter:{typeUrl: {includes: "poktroll"}}) {
      totalCount
      nodes {
        typeUrl
        # transactionId
      }
    }

    unprocessedEntities (distinct: ERROR) {
      totalCount
      nodes {
        eventId
        messageId
        transactionId
        error
      }
    }

    indexer_metadata: _metadata {
      targetHeight
      lastProcessedHeight
    }


    # tx_events: events(filter: {type: {equalTo: "tx"}}) {
    #   nodes {
    #     attributes {
    #       nodes {
    #         key
    #         value
    #       }
    #     }
    #   }
    # }

    # begin_block_events: events (filter: {attributes: {some: {key: {equalTo: "mode"}, value: {equalTo: "BeginBlock"}}}}) {
    #   nodes {
    #     attributes {
    #       nodes {
    #         key
    #         value
    #       }
    #     }
    #   }
    # }

    # events (distinct: TYPE) {
    #   nodes {
    #     type
    #   }
    # }

    # claims: messages(filter: {typeUrl: {equalTo: "/poktroll.proof.MsgCreateClaim"}}) {
    #   nodes {
    #     typeUrl
    #     json
    #   }
    # }

    # eventAttributes(distinct: KEY) {
    #   nodes {
    #     key
    #   }
    # }
}

Getting Started

This is the bare minimum to be here.

Only the first time:

cp .env.sample .env
yarn install
yarn run codegen
yarn run local-registry
# use --port if you already running other tilt like the poktroll one.
tilt up [--port 10351]

ctrl+c Interrupt to stop the Tilt UI

Cleanup

tilt down

1. Install dependencies

yarn install

2. Generate types

Types will need to be regenerated any time the graphql.schema is changed.

yarn run codegen

3. Switch between networks:

Modify .env NETWORK value between: mainnet, beta or localnet

localnet brings up its own single Pocket Shannon validator in the local cluster (tilt/localnet, test keys only) and indexes it from genesis. To index another localnet instead, uncomment ENDPOINT and point it at that fullnode's RPC, and point GENESIS_PATH at its genesis file with a path relative to the repo root; an absolute path does not work.

About

Pocketdex is an indexer for the Shannon implementation of the pocket network protocol.

Resources

Stars

4 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages