Polkawatch provides decentralization analytics about Polkadot. Allows all stake-holders to gain insights about where network activity is taking place (regional, network provider, validator group, nominator segment, etc).
With Decentralization insights the community can act to improve decentralization regardless of their role: Adjust Nomination, Start Validation in new Networks / Geographies, etc.
Polkawatch is built on top of Substrate Block Explorer (currently SubQuery) adding an extra analytic layer.
Polkawatch crosses chain data with external datasources and traces weak on-chain relations in a second-pass indexing. External data-sources may be "live" datasets that require regular updates. This is the case with location data, where data changes everyday and license requires for it to be updated.
Initially for Polkadot, Polkawatch could be used for any substrate blockchain.
Polkawatch is setup as a yarn workspace project with multiple packages (components) that can be managed from the project root and also from its project directory, the components are:
- Archive: Subquery Project that extracts and archives canonical chain data, in an unique first pass event archiving.
- Indexer: Crosses archived data with external datasources and resolvers weak relationships between on-chain events, builds and inverted index with the resulting dataset. The indexing process runs on start and on daily schedule.
- Live Query Server: Provides access to the inverted index to the DDPP and the DAPP.
- Distributed Data Pack Publisher (Coming Soon): Publishes the dataset on IPFS ready for consumption by the DAPP.
- DAPP (Coming Soon): Presents the data to users, mainly from IPFS may also access directly the LQS for advanced queries.
Polkawatch is a workspace project with multiple packages, however, testing can be triggered from the root of the project. Yarn commands are delegated to the child packages.
In order to run the unit tests clone the project and do:
yarn install
to install all node packagesyarn test
to run all unit testsyarn test:e2e
tp run end-to-end tests in packages that provide them
All modules deliver docker containers, and a docker-compopose, with multiple profiles, allow to run all or certain components depending on the desired activity
From the root of the project do:
- Build the containers for all components with
yarn docker:build
- Download some chain data with
yarn docker:getdata
or run the archive for 12-24hours to get a decent data sample withyarn docker:archive
. You can also do both. Getting data will simply download a postgres backup from IPFS with about 1M blocks of chain data already archived (first pass only). - You can run all the components with
yarn docker:testdeploy
After triggering testdeploy
, you will notice that the indexer starts processing rewards
, use the
LQS API UI/playground and run queries as the 2nd pass indexing takes place.
You can access the following playgrouds / UIs to monitor de indexing process and/or test your development.
- Archive GraphQL Provided by Subquery, during the 1st pass archive.
- Elasticsearch Kibana Used to compose complex queries that can be used to create LQS templates.
- LQS API UI Used to test the Live Query Server API methods and test query templates.
In order to develop locally you can use:
- Build all components from root with
yarn build
- You can run packages locally, i.e in your IDE, and run all other dependencies with
yarn docker:dev
. The Indexer and LQS servers will not be started. If you want to release more resources for development you can optionally stop the Archive and Kibana too. - Additionally
yarn docker:clean
will clean up all containers and data volumes.
For deployment instructions check the deployment tutorial.
Polkawatch is Open Source, Apache License Version 2.0.
©2022 Valletech AB, Authors and Contributors.