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 UsageNormative 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- Document description: https://api.alayascan.com/file/docs/#/home
- BasePath: https://api.alayascan.com/alaya-api/
- Tests that can use postman as the interface
#
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.
- Basic data:
- 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.
- Address details:
- 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.
- List of blocks:
- 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.
- List of proposals:
- 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.
- Summary data:
- 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.
- List of transactions:
#
Request API Data via Shell Commands- Basic syntax:
- With parameters: curl {url} -H "Accept: application/json" -H "Content-Type: application/json" -d'{params}'
- With no parameters: curl -i -X POST -H "'Content-type': 'application/json'" {url}
- Examples of some important interfaces
- Block details: curl https://api.alayascan.com/alaya-api/block/blockDetails -H "Accept: application/json" -H "Content-Type: application/json" -d'{"number" :"0"}'
- Node list: curl -i -X POST -H "'Content-type':'application/json'" https://api.alayascan.com/alaya-api/home/stakingList
#
Examples of Interface UsageList 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
Detailed format of request:
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?
- A: It is caused by cross-domain requests. ProxyTable needs to be configured. If the request address starts with /api or /XXapi, target will be automatically added. You can refer to https://www.cnblogs.com/wayneliu007/p/10569429.html.
- 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.