Polymesh Data

In order to query and explore Polymesh data, follow the steps below:

Step 1 : Install and run Polymesh subquery : https://github.com/PolymeshAssociation/polymesh-subquery .

Alternatively, a public GraphQL endpoint is available for use with the client of your choice, such as the Altair Chrome extension.

Endpoint: https://mainnet-graphql.polymesh.network/

Please be aware that this public endpoint has a rate limit and a maximum of 100 results per query. If your query returns a large result set, you may need to implement pagination to retrieve all the data effectively.

Step 2: Use the Polymesh graphql playground http://localhost:3001/graphql or pgAdmin to get a quick overview and understanding of the data.

This documentation covers both GraphQL (via the playground) and SQL (via pgAdmin) queries.

Step 3 :

GraphQL: In the playground, run the query below or click on "Schema" on the right side of the panel.

query {
  __schema {
    types {
      name
      description
      fields {
        name
      }
    }
  }
}

SQL: In pgAdmin, run the query below to return the list of tables and their descriptions.

SELECT 
    cls.relname AS table_name,
    obj_description(cls.oid) AS table_description
FROM 
    pg_class cls
JOIN 
    pg_namespace ns ON ns.oid = cls.relnamespace
WHERE 
    ns.nspname = 'public' AND 
    cls.relkind = 'r';

table_name
table_description

debugs

-

found_types

-

blocks

A set of transactions that were executed together. Includes a reference to its parent, which reference its parent, this forms a chain to the genesis block

permissions

Represents an Account's permissions. The primary key for an Identity always has full permission

_metadata

NULL

identities

Represents a person or business on chain. All Polymesh assets belong to an Identity. A single Identity can have many accounts (i.e. 'keys') An Identity needs a valid CDD claim from at least one KYC/KYB provider to perform most actions on chain

accounts

Represents a public/private key pair. Most actions must be signed by an appropriately permissioned Account. Before an Account can sign most Extrinsics it must first be attached to an Identity

account_histories

Represents historical data of identities assigned to an account

bridge_events

Represents POLY, the Ethereum based ERC-20 token, being converted to POLYX, the native Polymesh token

staking_events

Represents a change in staking status

assets

Represents a tokenized Asset on the Polymesh chain. The central data structure for the ecosystem

ticker_external_agent_actions

Represents an administrative action on an Asset, e.g. tokens issued, compliance rules updated, document added, etc.

venues

Represents a place to trade assets. This allows for additional mediation and control over the exchange of Assets e.g. An asset may specify it can only be exchanged at a particular Venue, allowing the Venue owner to explicitly approve transactions

portfolios

Represents a grouping of Assets held by an Identity. Particular accounts maybe authorized only over certain portfolios Note: identities will always have a default Portfolio (id = 0)

stos

Securities Token Offering. Represents a fund raising effort from a company. e.g. sale of company equity in exchange for a stable coin

authorizations

Represents a request to grant an Account some permission to perform actions for an Identity. e.g. become a Portfolio custodian

investments

Represents participation in an STO

ticker_external_agents

Represents an Identity authorized to perform actions on behalf of a company

ticker_external_agent_histories

Represents a change in the status of an external agent.

agent_groups

Represents a set of agents authorized to perform actions for a given Asset

agent_group_memberships

Represent membership in a group. Tracks which members belong to which groups

portfolio_movements

Represents a transfer of fungible assets between a single identities portfolios. Note: transfers between identities are known as Settlements

instructions

Represents a request to exchange Assets between parties. Before an Instruction is executed all involved parties must sign and submit an affirmation. Once an Instruction is affirmed it will then be attempted to be executed. If any party fails to satisfy any compliance or transfer restriction the Instruction will fail, and no movement of assets will occur.

settlements

Represents a trade of assets between parties

legs

Represents the movement of a single Asset in a trade, e.g. Alice will give Bob 1 USDS

distributions

Represents a distribution to the owners of an Asset. e.g. dividend payment

distribution_payments

Represents an owner of an asset collecting a distribution e.g. accepting a dividend

proposals

Represents a potential change to how the chain will operate. It will need gain sufficient 'Aye' votes before having effect

proposal_votes

Represents a vote on a governance proposal

claim_scopes

The scope of a claim. e.g. target is Blocked from owning

custom_claim_types

Represents the registered CustomClaimType

claims

A claim made about an Identity. All active identities must have a valid CDD claim, but additional claims can be made. e.g. The Identity belongs to an accredited, US citizen

trusted_claim_issuers

An claim issuer that is trusted for an Asset. Assets relying on on chain compliance should be explicit on which issuers they trust

asset_pending_ownership_transfers

Represents a request to take ownership of a particular Asset

transfer_managers

deprecated in favor of TransferCompliance

stat_types

Represents an on chain statistic about the Asset owners. e.g. How many investors hold the Asset. These are required to be enabled in order for the chain to enforce transfer restrictions e.g. A restriction requiring ownership to be at least 50% Canadian would require a StatType of type Balance scoped to Jurisdiction before being created

transfer_compliances

Represents restriction that will ensure the composition of ownership remains a certain way e.g. No more than 2000 individual investors to avoid additional reporting requirements

transfer_compliance_exemptions

Represents an exemption for an individual for TransferCompliance rules

nft_holders

Represents what NFTs of a collection an Identity owns

compliances

Represents a restriction all investor must comply with for a given Asset e.g. All investors must be German citizens

asset_holders

Represents how much of a given Asset an Identity owns

asset_documents

Represents off chain documentation for an Asset. A hash should be included on chain so readers can be sure their copy has not been tampered with e.g. A companies 10-K report

migrations

Represents the list of migrations executed

asset_transactions

Represents all the transactions related to an Asset

fundings

Represents an investment into an Asset

asset_mandatory_mediators

NULL

subquery_versions

Represents the deployed version of the node indexing the data

polyx_transactions

Represents transactions involving POLYX

child_identities

Represents the parent child mapping for an Identity

multi_sigs

Represents a MultiSig

multi_sig_signers

Represents a MultiSig signer

multi_sig_proposals

Represents a MultiSig proposal

multi_sig_proposal_votes

Represents a MultiSig proposal vote

meditator_affirmations

Represents a mediator's approval for an instruction

events

Information of a chain state transition on. For most use cases a more specific entity should be queried

extrinsics

Represents external data included into the chain. Virtually all user actions, as well as runtime operations are extrinsics. Usually extrinsics are signed. When the block author includes data, e.g. timestamp.set then the signature is implied. This is indicated with signed = 0

Step 4 : Select tables of interest.

table_name
table_description

assets

Represents a tokenized Asset on the Polymesh chain. The central data structure for the ecosystem

asset_transactions

Represents all the transactions related to an Asset

asset_holders

Represents how much of a given Asset an Identity owns

identities

Represents a person or business on chain.

legs

Represents the movement of a single Asset in a trade, e.g. Alice will give Bob 1 USDS

settlements

Represents a trade of assets between parties

fundings

Represents an investment into an Asset

stat_types

Represents an on chain statistic about the Asset owners. e.g. How many investors hold the Asset.

investments

Represents participation in an STO

ticker_external_agent_actions

Represents an administrative action on an Asset, e.g. tokens issued, compliance rules updated, document added, etc.

venues

Represents a place to trade assets. This allows for additional mediation and control over the exchange of Assets e.g. An asset may specify it can only be exchanged at a particular Venue, allowing the Venue owner to explicitly approve transactions

Step 4 : Familiarize ourselves with the data schema for tables of interests.


SELECT 
    column_name, 
    data_type, 
    character_maximum_length, 
    column_default, 
    is_nullable 
FROM 
    information_schema.columns 
WHERE 
    table_schema = 'public' 
    AND table_name = '{{table_name}}';

For instance, for {{table_name}} = assets, the query returns

Last updated