Explorer API
PlatEye (plateye.com) is a versatile and widely used blockchain explorer on the PlatON network. Due to the limited API functions provided by the PlatON 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 (plateye.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- Document description: https://api.plateye.com/origin/docs/#/home
- BasePath: https://api.plateye.com/platon-api/
- Tests that can use postman as the interface
#
Specification of Explorer Public API- Home page interface
- Basic data:
/platon-api/home/chainStatistic
. To push LAT basic data, such as current block height, block proposer ID, etc. - Block generation trend:
/platon-api/home/blockStatistic
. To push the latest 50 pieces of data concerning block generation. - List of validators:
/platon-api/home/stakingList
. To push the latest 8 pieces of validator information.
- Basic data:
- Address interface
- Address details:
/platon-api/address/details
. To return the detailed information of the specified address. - Lock-up of the address:
/platon-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:
/platon-api/block/blockList
. To push the list of all blocks. - List of node blocks:
/platon-api/block/blockListByNodeId
. To push the list of all blocks generated by the specified node. - Export the list of node blocks:
/platon-api/block/blockListByNodeIdDownload
. To export the list of blocks generated by the specified node according to the filter conditions. - Block details:
/platon-api/block/blockDetails
. To return the detailed information of the specified block.
- List of blocks:
- Proposal interface
- List of proposals:
/platon-api/proposal/proposalList
. To return the list of proposals. - Proposal details:
/platon-api/proposal/proposalDetails
. To return the detailed information of the specified proposal. - Voting list:
/platon-api/proposal/voteList
. To return the voting information for the specified proposal.
- List of proposals:
- Node interface
- Summary data:
/platon-api/staking/statistic
. To push the summary data of all LAT nodes, once every 5 seconds. - List of live nodes:
/platon-api/staking/aliveStakingList
. To push all live validators. - List of history nodes:
/platon-api/staking/historyStakingList
. To push the list of nodes that have exit. - List of locked nodes:
/platon-api/staking/lockedStakingList
. To push the list of nodes with zero block generated. - Node details:
/platon-api/staking/stakingDetails
. To view the details of validators. - Node operation record:
/platon-api/staking/stakingOptRecordList
. To query the record of node operations, such as creating proposals and voting. - List of delegations by node:
/platon-api/staking/delegationListByStaking
. To query the list delegations by node. - List of delegations by address:
/platon-api/staking/delegationListByAddress
. To query the list of delegations by address.
- Summary data:
- Transaction interface
- List of transactions:
/platon-api/transaction/transactionList
. To push the list of all transactions. - List of transactions by block:
/platon-api/transaction/transactionListByBlock
. To push the list of transactions by block. - List of transactions by address:
/platon-api/transaction/transactionListByAddress
. To push the list of transactions by address. - List of transactions of the specified address:
/platon-api/transaction/addressTransactionDownload
. To export the transaction list of the specified address according to the filter conditions. - Transaction details:
/platon-api/transaction/transactionDetails
. To return the details of the specified transaction. - List of reward claiming by address:
/platon-api/transaction/queryClaimByAddress
. To return the reward claiming status of all nodes under the current address. - List of reward claiming by node:
/platon-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 https://api.plateye.com/{api} -H "Accept: application/json" -H "Content-Type: application/json" -d '{params}'
- With no parameters: curl -i -X POST -H "'Content-type': 'application/json'" https://api.plateye.com/{api}
- Examples of some important interfaces
- Block details: curl https://api.plateye.com/platon-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.plateye.com/platon-api/home/stakingList
#
Examples of Interface UsageList of nodes
Use API: /platon-api/staking/aliveStakingList
Request detailed format:
POST https://api.plateye.com/platon-api/home/stakingList
Content-Type: application/json
body={'pageNo': 0, 'pageSize': 0, 'queryStatus': 'all'}
Address details
Use API: //platon-api/address/details
Detailed format of request:
POST https://api.plateye.com/platon-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.
- Q: Will there be plans for the gas station and DApp related interfaces in the future?
- A: Our PlatEye 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.