Skip to main content

Explorer API

PlatEye (Alayascan.com) is a versatile and widely used blockchain explorer on the Alaya network. Due to the limited API functions provided by the Alaya node, PlatEye also provides API services that support various wallets, tools, Dapp and other applications with stable and real-time on-chain data.

This document briefly summarizes the functions and usage of API interface provided by the PlatEye blockchain explorer (Alayascan.com), for the convenience of developers.

Specification of Interface Usage#

  • Normative principles

    • Data is displayed once being returned by the interface: the front end only renders logic processing
    • The front end focuses on interaction and rendering logic, and should avoid processing business logic as much as possible
    • Request/response data format: JSON. JSON data should be as simple and lightweight as possible
  • Request format

    • GET request and POST request must include the input parameter whose key is body, and all the requested data is packaged in JSON format and stored in the input parameter body
    • Example: body: {"nodeID": "1423", "pageNo": 0, "pageSize": 0}
  • Basic response format

    • {code: 200, data: {message: "success", data: {}}}
    • code: To request processing status (200 means success)
    • data.message: To request information processing (code=200&data.message="success", processed successfully)

Public API Configuration#

Specification of Explorer Public API#

  • Home page interface
    • Basic data: /alaya-api/home/chainStatistic. To push ATP basic data, such as current block height, block proposer ID, etc.
    • Block generation trend: /alaya-api/home/blockStatistic. To push the latest 50 pieces of data concerning block generation.
    • List of validators: /alaya-api/home/stakingList. To push the latest 8 pieces of validator information.
  • Address interface
    • Address details: /alaya-api/address/details. To return the detailed information of the specified address.
    • Lock-up of the address: /alaya-api/address/rpplanDetail. To query the lock-up balance and lock-up plan on the chain in real time.
  • Block interface
    • List of blocks: /alaya-api/block/blockList. To push the list of all blocks.
    • List of node blocks: /alaya-api/block/blockListByNodeId. To push the list of all blocks generated by the specified node.
    • Export the list of node blocks: /alaya-api/block/blockListByNodeIdDownload. To export the list of blocks generated by the specified node according to the filter conditions.
    • Block details: /alaya-api/block/blockDetails. To return the detailed information of the specified block.
  • Proposal interface
    • List of proposals: /alaya-api/proposal/proposalList. To return the list of proposals.
    • Proposal details: /alaya-api/proposal/proposalDetails. To return the detailed information of the specified proposal.
    • Voting list: /alaya-api/proposal/voteList. To return the voting information for the specified proposal.
  • Node interface
    • Summary data: /alaya-api/staking/statistic. To push the summary data of all ATP nodes, once every 5 seconds.
    • List of live nodes: /alaya-api/staking/aliveStakingList. To push all live validators.
    • List of history nodes: /alaya-api/staking/historyStakingList. To push the list of nodes that have exit.
    • List of locked nodes: /alaya-api/staking/lockedStakingList. To push the list of nodes with zero block generated.
    • Node details: /alaya-api/staking/stakingDetails. To view the details of validators.
    • Node operation record: /alaya-api/staking/stakingOptRecordList. To query the record of node operations, such as creating proposals and voting.
    • List of delegations by node: /alaya-api/staking/delegationListByStaking. To query the list delegations by node.
    • List of delegations by address: /alaya-api/staking/delegationListByAddress. To query the list of delegations by address.
  • Transaction interface
    • List of transactions: /alaya-api/transaction/transactionList. To push the list of all transactions.
    • List of transactions by block: /alaya-api/transaction/transactionListByBlock. To push the list of transactions by block.
    • List of transactions by address: /alaya-api/transaction/transactionListByAddress. To push the list of transactions by address.
    • List of transactions of the specified address: /alaya-api/transaction/addressTransactionDownload. To export the transaction list of the specified address according to the filter conditions.
    • Transaction details: /alaya-api/transaction/transactionDetails. To return the details of the specified transaction.
    • List of reward claiming by address: /alaya-api/transaction/queryClaimByAddress. To return the reward claiming status of all nodes under the current address.
    • List of reward claiming by node: /alaya-api/transaction/queryClaimByStaking. To query the list of reward claiming by node.

Request API Data via Shell Commands#

Examples of Interface Usage#

  • List of nodes

    • Use API: /alaya-api/staking/aliveStakingList

    • Request detailed format:

      POST https://api.alayascan.com/alaya-api/home/stakingList

      Content-Type: application/json

      body={'pageNo': 0,'pageSize': 0,'queryStatus':'all'}

  • Address details

    • Use API: /alaya-api/address/details

    • Request detailed format:

      POST https://api.alayascan.com/alaya-api/address/details

      Content-Type: application/json

      body={'address':'atp14zljtap2lvntcurr4v3rzysyt30t3ww3fnpdvw'}

FAQ#

  • Q: Why does it prompt that "Access-Control-Allow-Origin" is missing in the CORS header when the VUE project requests the interface?
  • Q: Will there be plans for the gas station and DApp related interfaces in the future?
    • A: Our alyascan project is in progress, and the gas station and DApp related interfaces will be launched successively.
  • Q: How to solve the slow website response due to too much data requested at one time?
    • A: Our back-end database applies a paging method. You can also set pageSize to query data in pages when using API, but remember to collaborate with the front-end display page.
  • Q: What project scenario is the API mainly used for?
    • A: It can be used to display the information of third-party wallets, such as the balance and transaction information of an address as well as on-chain data for analysis.