Polkascan Development Update #6

Polkascan Account Module

Emiel Sebastiaan
Polkadot Network
10 min readMay 6, 2020

--

Our mission is to make multi-chain data accessible and understandable. With the Polkascan project we are working towards a multi-chain exploration and data analytic platform for the Polkadot-ecosystem. This development update is part of our work that extends Polkascan with a rich account-module. The new features offered by this grant work allow for data exploration and data discovery from the account’s perspective. This project was funded by Web3 Foundation. Through Polkascan Foundation we offer a hosted version of our multi-chain explorer: polkascan.io.

1. Getting started

This development update will help you get started by running the sixth milestone release of Polkascan OS yourself.

1.1. Polkascan on Github

Repositories: The source code of Polkascan OS can be found at our Github organization. This organization consists of a number of distinct repositories which collectively form Polkascan OS. We apply a number of conventions for branches and versioned releases across these Polkascan OS repositories.

Image 1.1a: Polkascan on Github: https://github.com/polkascan

Branches: Each repository has our most recent work in the master-branch.
Releases: This development update’s work is released and tagged as ‘v0.6.x’.

1.2. What makes Polkascan?

Polkascan consists of a number of distinct software artifacts which collectively orchestrate Polkascan. The Harvester transforms a Substrate node’s raw data into relational data, with the help of Substrate Interface Library and the SCALE Codec Library. The produced relational data is disseminated by the Explorer API and in turn made accessible to end users by the Explorer GUI. We provide full Docker support for all our artifacts, hence all our repositories have Dockerfiles in their root.

Although these five distinct components of Polkascan could be applied independently (even in other projects), we offer a sixth piece of software, called Polkascan OS that glues together all these components with Docker Compose.

1.3. Requirements

  1. Recommended hardware: Memory: >8GB (more is better), Storage: >100GB (SSD is better), Processor: more and faster cores is better (Intel i7 quad core), Bandwidth: more and faster is better (>20 Mbps). These requirements will go down as the project matures.
  2. Software requirements: Git, Docker & Docker Compose.
  3. Deployment of Polkascan has been tested on Mac, Linux and Windows.
  4. The Explorer GUI has been tested on Safari, Firefox, Chrome, Edge and Brave.

1.4. Quick deployment of Polkascan

This paragraph provides a step-by-step guide on running our milestone 6 release of Polkascan OS on your own machine. Please note that this section provides instructions for a quick deployment of Polkascan OS. This quick deployment instruction builds and runs Polkascan Explorer GUI and utilizes the API endpoints hosted by Polkascan Foundation. Instructions for a full deployment of Polkascan OS can be found in the next sections of this document.

  1. Clone the repository:
    git clone https://github.com/polkascan/polkascan-os.git
  2. Go to the new folder:
    cd polkascan-os
  3. Check available releases:
    git tag
  4. Checkout the latest release in the v0.6.x range (replace ‘x’ with highest number):
    git checkout v0.6.x
  5. Initialize and update submodules:
    git submodule update --init --recursive
  6. Build and initialize the other containers:
    docker-compose -p kusama -f docker-compose.kusama-quick.yml up --build
  7. The Explorer GUI should now be available in a browser: http://127.0.0.1:8080
Image 1.4a: Polkascan OS in a browser: http://127.0.0.1:8080

1.5. Full deployment of Polkascan

This paragraph provides a step-by-step guide on running our milestone 6 release of Polkascan OS on your own machine. This full deployment instruction builds and runs the full Polkascan OS stack. In addition to the Polkascan Explorer GUI, this instruction also runs a Substrate-node, a MySQL DBMS, the Polkascan Harvester, and the Polkascan Explorer API. Please note that fully syncing the Kusama network with a Substrate node and harvesting all required data into a relational database may take up to a full week of work on a heavy machine. Section 1.4 provides a convenience method to only run the user-interface and rely on the databases hosted by Polkascan Foundation.

  1. Clone the repository:
    git clone https://github.com/polkascan/polkascan-os.git
  2. Go to the new folder:
    cd polkascan-os
  3. Check available releases:
    git tag
  4. Checkout the latest release in the v0.6.x range (replace ‘x’ with highest number):
    git checkout v0.6.x
  5. Initialize and update submodules:
    git submodule update --init --recursive
  6. Build and initialize the MySQL container:
    docker-compose -p kusama -f docker-compose.kusama-full.yml up -d mysql
  7. Build and initialize the other containers:
    docker-compose -p kusama -f docker-compose.kusama-full.yml up --build
  8. The Explorer GUI should now be available in a browser: http://127.0.0.1:8080
  9. The Database should now be accessible via your favorite tool: docker-Host: 127.0.0.1
    Port: 33061
    Database: polkascan
    Username: root
    Password: root
Image 1.5a: Polkascan OS via a database explorer

1.6. Cleaning up

The following [docker] commands should help you clean up.

  • Stop all containers of the Docker Compose file.
    docker-compose -p kusama -f docker-compose.kusama-quick.yml down
    docker-compose -p kusama -f docker-compose.kusama-full.yml down
  • Remove all unused containers, volumes and images.
    docker system prune
    [confirm] Y
  • Remove all containers and images.
    docker system prune -a
    [confirm] Y
  • Remove all volumes.
    docker volume prune
    [confirm] Y

2. Accounts, identities & roles

This section dives into the enhancements we made to the Polkascan platform, related to accounts, their respective identities and their respective roles.

2.1. Account details

The account detail page lists a number of useful attributes, related to balances, identities and roles. Identities are attributes that are voluntarily set by accounts. In general these identities are useful for accounts that serve a public function, such as: validators, council members, technical committee members, etc.

Image 2.1a: Account detail — attributes

2.2. Account transactions

An account can submit many types of transactions to the chain. The transaction-tab on the account detail page lists all transactions that have been submitted by the respective account. The details button will navigate to the transaction detail page.

Image 2.2a: Account detail — Transactions tab

2.3. Account identities

If an account has an on-chain identity set, the user-interface displays this identity everywhere. We have implemented the Polkadot Human-Interface Guidelines to the best of our ability.

Image 2.3a: Account detail — Identities — Polkadot Human-Interface Guidelines

2.4. Account roles

Various special roles can be identified based on the account’s on-chain activity. The Polkascan platform classifies accounts as: validator, nominator, council member, technical committee member, registrar, treasury or sudo.

Image 2.4a: Account detail — Roles tab

Various shortcuts have been added to the Accounts-menu to filter accounts based on their current role.

Image 2.4b: Account detail — Accounts menu shortcuts

2.5. Account lifecycle

An account has a lifecycle. In general an account exists in the state of the chain if it has a balance above the so-called existential deposit. The account-lifecycle tab shows the events when an account is first created and when an account is removed. The details button will navigate to the event detail page.

Image 2.5a: Account detail — Account lifecycle tab

2.6. Identity activity

An account’s identity has a lifecycle. In general an identity is set, changed or removed and a Registrar can provide a judgement of the identity. The identity-activity tab shows the events when those identity-related activities occur. The details button will navigate to the event or transaction detail page.

Image 2.6a: Account detail — Identity activity tab

3. Staking, validators and nominators

This section dives into the enhancements we made to the Polkascan platform, related to accounts, specifically related to staking, validators and nominators.

3.1. Staking activity

An account’s staking activity is displayed on the staking activity tab. The tab shows various staking related events and extrinsics, such as: bonding activity, changing payout settings, and specifically for validators when validation activities commence. The details button will navigate to the event or transaction detail page.

Image 3.1a: Account detail — Staking activity tab

Additionally for nominators the staking activity tab displays when a nominator changes its nominees. The details button will navigate to the event or transaction detail page.

Image 3.1b: Account detail — Staking activity tab

3.2. Staking sessions

An account’s staking activity takes place in a session. The sessions in which staking activities have taken place are listed in descending order on the staking sessions tab. The details button will navigate to the event or transaction detail page.

Image 3.2a: Account detail — Staking sessions tab

3.3. Authored blocks

A validator produces blocks. The authored blocks tab lists all blocks that have been produced by the respective account in descending order. The details button will navigate to the event or transaction detail page.

Image 3.3a: Account detail — Authored block tab

3.4. Slash events

A validator or nominator could get slashed. The slash events tab lists all slash events for the respective account in descending order. The details button will navigate to the event or transaction detail page.

Figure 3.4a: Account detail — Slash events tab

3.5. ImOnline activity

A validator is required to be online for block production. The imonline activity tab lists all events when a validator is reported as offline. This tab does not show any heartbeat events. The details button will navigate to the event or transaction detail page.

Image 3.5a: Account detail — ImOnline tab

4. Democracy, council & technical committee

This section dives into the enhancements we made to the Polkascan platform, related to accounts, specifically related to democracy, council and technical committee.

4.1. Proposal activity

Any account can make a democracy proposal. The proposal activity tab lists all occurrences when an account creates or seconds a proposal.The details button will navigate to the event or transaction detail page.

Image 4.1a: Account detail — Proposal activity tab

4.2. Referendum activity

Any account can cast a vote on a democracy referendum. The referendum activity tab lists all the account’s votes on referenda. The details button will navigate to the event or transaction detail page.

Image 4.2a: Account detail — Referendum activity tab

4.3. Election activity

Council members are elected through an elections process. Any account can vote on candidate council members. The election activity tab lists all the account’s votes both from the active perspective as from the passive perspective. The details button will navigate to the event or transaction detail page.

Image 4.3a: Account detail — Election activity tab

4.4. Council terms

Elected council members serve a council term. The council terms tab lists all the council member’s council terms in descending order. The details button will navigate to the event or transaction detail page.

Image 4.4a: Account detail — Council terms tab

4.5. Council activity

Elected council members are authorized to propose and vote on council motions. The council activity tab lists all the council member’s council activity in descending order. The details button will navigate to the event or transaction detail page.

Figure 4.5a: Account detail — Council activity tab

4.6. Treasury activity

Any account can make a treasury spending proposal. The treasury activity tab lists all the account’s proposals for treasury spendings. The details button will navigate to the event or transaction detail page.

Image 4.6a: Account detail — Treasury activity tab

4.7. Technical committee activity

Technical committee members have a limited number of special authorizations in on-chain governance. The techcomm activity tab lists all the technical committee member’s activity in descending order. The details button will navigate to the event or transaction detail page.

Image 4.7a: Account detail — Transactions tab

5. Balances

This section dives into the enhancements we made to the Polkascan platform, related to account balances.

5.1. Balance transfers

The balance transfers tab lists a balance transfer activity. This includes regular account-to-account balance transfers but also block author deposits and claims. The details button will navigate to the event or transaction detail page.

Image 5.1a: Account detail - Balance transfers tab

5.2. Balance history

The balance history tab shows a graph that plots the balance history. This particular example shows the balance history for one of the exchanges that offers a KSM trading pair.

Image 5.2a: Account detail — Balance history tab

5.3. Balance ranking

The accounts menu offers an overview page of accounts ranked on balance in descending order, effectively serving as a rich-list.

Figure 5.3a: Account detail — Balance rankings

About Polkascan

Polkascan contributes to the Polkadot ecosystem by providing block exploration and data analytic technologies. We will continue providing updates to our multi-chain explorer platform polkascan.io through our not-for-profit organization Polkascan Foundation.

The following public resources enable tracking of progress of the project: Medium, Twitter & GitHub. We encourage you to reach out if you would like to collaborate especially if you intend to be a Substrate implementer or ecosystem service provider. You can find us on the Riot channels on a daily basis. Come say hello and talk to us on how to get involved.

--

--