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.
See the introduction docs directory for details on how to use indexed data after you're fully set up.
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;
\dtNavigate 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.
Navigate to http://localhost:3000 or the port you specified in .env.development at SUBQUERY_GRAPHQL_ENGINE_PORT var.
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
# }
# }
}This is the bare minimum to be here.
Only the first time:
cp .env.sample .envyarn 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 downyarn installTypes will need to be regenerated any time the graphql.schema is changed.
yarn run codegenModify .env NETWORK value between: mainnet, beta, alpha or localnet
For this last one you can do this in two ways:
- Run this from
poktrollrepository usingmake localnet_upand modifyindexer.enabled=trueatlocalnet_config.yamlon that repository. - Copy a localnet genesis file here and uncomment
ENDPOINTwhich you should point to alocalnetfullnode RPC endpoint.


