We’re introducing a way for anyone to visualize data related to the IoTeX Network. Query many useful IoTeX metrics with simple commands, available now on the IoTeX Analytics Playground .
There are two IoTeX tools we have built which utilize GraphQL, a query language to visualize data from APIs and enable developer tools:
- Analytics Playground (analytics.iotexscan.io) provides pre-analyzed data from an IoTeX-managed database; ideal for basic queries!
- API-gateway (GraphQL Playground) provides unanalyzed data directly from the IoTeX blockchain; ideal for custom tools / queries!
Now, IoTeX Analytics is fully open source to the public here:
In this blog, we explain how to use the Analytics Playground and metrics available now. Try it out for yourself using the instructions below!
See our “How To” Guide video for Analytics Playground!
What is GraphQL?
GraphQL provides an interface to read/analyze code and data from a particular data structure (e.g., database, IoTeX blockchain). A GraphQL service is created by defining ‘types’, ‘fields’ on those ‘types’, and ‘functions’ for each ‘field’ on each ‘type’. IoTeX has created pre-defined metrics for you to play with in Analytics Playground!
Metrics Available in Analytics Playground
There are several metrics already available in the Analytics Playground. Each metric below has a set of requests (i.e., inputs) that generate unique responses (i.e., outputs). See our Analytics Playground documentation for the full details!
- Delegate() — overview of delegate status (bookkeeping, reward, productivity, voting buckets data, staking information)
- Chain() — metadata of IoTeX blockchain (latest epoch number, block height, TPS, and number of actions within a range of epochs)
- Voting() — overview of voting results (number of candidates, number of consensus delegates, total weighted votes, total voted tokens)
- Account() — overview of accounts (addresses that participated in latest actions, mapping between Delegates’ aliases and operator addresses)
Delegate
Sample GraphQL Request: Delegate (Bookkeeping( ))
Bookkeeping
Usage: Bookkeeping gives Delegates an overview of the reward distributions to their voters within a range of epochs.
Request:
- startEpoch: starting epoch number
- epochCount: epoch count
- delegateName: delegate name
- percentage: percentage of reward distribution
- includeFoundationBonus: whether include foundation bonus as part of the reward distribution
- Pagination: skip (starting index of displaying reward distribution list), first (number of reward distributions to display)
Response:
- exist: whether the delegate has bookkeeping information within the specified epoch range
- rewardDistribution: voterEthAddress, voterIotexAddress, amount, count
Productivity
Usage: Productivity gives block productivity of producers within a range of epochs.
Request:
- startEpoch: starting epoch number
- epochCount: epoch count
- delegateName: producer name
Response:
- exist: whether the delegate has productivity information within the specified epoch range
- production: number of block productions
- expectedProduction: number of expected block productions
Reward
Usage: Rewards provides reward detail information for candidates within a range of epochs.
Request:
- startEpoch: starting epoch number
- epochCount: epoch count
- delegateName: candidate name
Response:
- exist: whether the delegate has reward information within the specified epoch range
- blockReward: amount of block rewards
- epochReward: amount of epoch rewards
- foundationBonus: amount of foundation bonus
BucketInfo
Usage: BucketInfo provides voting bucket detail information for candidates within a range of epochs.
Request:
- startEpoch: starting epoch number
- epochCount: epoch count
- delegateName: candidate name
Response:
- exist: whether the delegate has voting bucket information within the specified epoch range
- epochNumber: epoch number
- bucketInfoList:
- voterEthAddress: voter’s ERC20 address
- weightedVotes: voter’s weighted votes
- count: total number of buckets in the given epoch for the given delegate
Staking
Usage: Staking provides staking information for candidates within a range of epochs.
Request:
- startEpoch: starting epoch number
- epochCount: epoch count
- delegateName: candidate name
Response:
- exist: whether the delegate has staking information within the specified epoch range
- stakingInfo:
- epochNumber: epoch number
- selfStaking: candidate’s self-staking amount
- totalStaking: total staking amount
Chain
Sample Chain( ) request
MostRecentEpoch
Usage: MostRecentEpoch gives the latest epoch number.
Request:
- N/A
Response:
- mostRecentEpoch: latest epoch number
MostRecentBlockHeight
Usage: MostRecentBlockHeight gives the latest block height.
Request:
- N/A
Response:
- mostRecentBlockHeight: latest block height
MostRecentTPS
Usage: MostRecentTPS gives the latest transactions per second.
Request:
- blockWindow: number of last blocks that are backtracked to compute TPS
Response:
- mostRecentTPS: latest transactions per second
NumberOfActions
Usage: NumberOfActions gives the number of actions.
Request:
- pagination:
- startEpoch: the starting epoch number for querying number of actions
- epochCount: the epoch count for querying number of actions
Response:
- numberOfActions:
- exist: whether the starting epoch number is less than the most recent epoch number
- count: number of actions
Voting
Sample Voting( ) request
Voting
Usage: Voting provides metadata of voting results.
Request:
- startEpoch: starting epoch number
- epochCount: epoch count
Response:
- exist: whether the starting epoch number is less than the most recent epoch number
- candidateMeta:
- epochNumber: epoch number
- consensusDelegates: number of consensus delegates in the epoch
- totalCandidates: number of total delegates in the epoch
- totalWeightedVotes: candidate total weighted votes in the epoch
- votedTokens: total voted tokens in the epoch
Account
Sample Account( ) request
ActiveAccount
Usage: ActiveAccounts lists most recently active accounts.
Request:
- count: number of account addresses to be queried for active accounts
Response:
- activeAccount: list of account addresses
OperatorAddress
Usage: OperatorAddress finds the delegate’s operator address given the delegate’s alias name.
Request:
- aliasName: delegate’s alias name
Response:
- exist: whether the alias name exists
- operatorAddress: operator address associated with the given alias name
Alias
Usage: Alias finds the delegate’s alias name given the delegate’s operator address.
Request:
- operatorAddress: delegate’s operator address
Response:
- exist: whether the operator address exists
- aliasName: alias name associated with the given operator address
What’s Next?
We hope these data visualization tools will be helpful to everyone — voters, developers, Delegates -and help you understand the IoTeX Network more. Over time, we will continue to evolve the Analytics Playground by adding additional metrics.
We encourage you to build your own front end data visualizations and share them with the community! Reach out to an IoTeX team member with any questions or suggestions.