Polkascan Explorer provides a generalized block explorer for Substrate-based blockchains.
Run init.sh to initialize repository; this will basically run:
git submodule update --init --recursivecp explorer-ui-config.json explorer-ui/src/assets/config.json
The explorer-ui-config.json file contains the URLs of theexposed Substrate and Explorer API endpoints
if not inited you'll get COPY failed: file not found in build context or excluded by .dockerignore: stat polkadapt/package.json: file does not exist
docker-compose up --build
- Polkascan UI: http://127.0.0.1:8080/
- Polkascan API playground: http://127.0.0.1:8000/graphql/
- Polkascan API websocket: ws://127.0.0.1:8000/graphql-ws
The explorer application consist of several components:
The harvester retrieves data from the connected Substrate node and stores it into a MySQL (by default) database.
The explorer API transforms the data via an ETL process into an explorer-specific format. It exposes a GraphQL endpoint and enables subscription-based communication to the UI.
Explorer UI is a client-sided Angular based application that utilizes PolkADAPT and its Adapters to obtain data from multiple data sources, like the Explorer API and the Substrate node. Its design is based on flat Material component design, styled in Polkascan branding.
By default, a build of Substrate Node Template is
used. If a local Substrate node is already running on the host machine, you can change
environment variable in the docker-compose.yml:
SUBSTRATE_RPC_URL=ws://host.docker.internal:9944
Or to any public or private websocket endpoint
To use PolkadotJS Apps with the local Substrate node, go to https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer
The UI is utilizing PolkAdapt to combine on-chain data retrieved directly from the Substrate node, with the GraphQL endpoint with indexed data served by the Explorer API. In this way data like events and extrinsics can be retrieved fast, with the verification of on-chain data.
By default, the UI are using the local endpoints, new networks can be added by extending the dict:
{
"local": {
"substrateRpcUrlArray": ["ws://127.0.0.1:9944"],
"explorerWsUrlArray": ["ws://127.0.0.1:8000/graphql-ws"]
},
"polkadot": {
"substrateRpcUrlArray": ["wss://<PUBLIC_ENDPOINT>"],
"explorerWsUrlArray": ["wss://<HOSTED_EXPLORER_API_ENDPOINT>/graphql-ws"]
}
}