Staking rewards API. This doc describes how you can get data about staking rewards by different parameters in several POS chains. (0.1)

Download OpenAPI specification:Download

URL: https://p2p.org License: Apache 2.0

Overview

This section provides an overview of the API design, methods, and supported use cases.

Most of the endpoints accept JSON as input and return JSON responses. This means that you must usually add the following headers to your request:

Content-type: application/json
Accept: application/json

Trying the API

You can use a third party client, such as curl, HTTPie, Postman or the Insomnia rest client to test the Staking rewards API.

Note that you will need to pass credentials data.

For e.g., here is how to get blockchains list with curl, when basic authorization is used:

curl -X GET 'https://staking-data-api-p2p.hasura.app/api/rest/blockchains' \
-H 'Content-Type: application/json' \
-H 'x-hasura-admin-secret: secret' \

Authorization

Using API key header to interact with API.

Please request us for access.

Errors

We follow the error response format proposed in RFC 7807 also known as Problem Details for HTTP APIs. As with our normal API responses, your client must be prepared to gracefully handle additional members of the response.

Unauthorized

This indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource. Please check that you have valid credentials.

NotFound

This client error response indicates that the server cannot find the requested resource.

Unknown (Internal Server Error)

This means that the server encountered an unexpected condition that prevented it from fulfilling the request.

Blockchain

List blockchains

Method returns the list of blockchains that are supported by API. You can use this info for API endpoints which consist of blockchain_name in parameters.

SecurityApiKeyAuth
Responses
200

Success.

401

Request not authenticated due to missing, invalid, authentication info.

404

A specified resource is not found.

500

Unknown server error.

get/blockchains
Request samples
Response samples
application/json
{
  • "blockchains": [
    ]
}

Blockchains periods

This method returns the acceptable periods of blockchain_period for staking data. You can use this info for API endpoints which consist of blockchain_period_name in parameters.

SecurityApiKeyAuth
Request
path Parameters
blockchain_name
required
string

The name of blockchain.

Responses
200

Success.

401

Request not authenticated due to missing, invalid, authentication info.

404

A specified resource is not found.

500

Unknown server error.

get/blockchains/{blockchain_name}/periods
Request samples
Response samples
application/json
{
  • "blockchainPeriods": [
    ]
}

Blockchains on-chain report

This method returns the blockchain staking data for every defined blockchain period (specified period of rewards payment and stat collection, can be block era epoch day depends on chain)

SecurityApiKeyAuth
Request
path Parameters
blockchain_name
required
string

The name of blockchain.

query Parameters
datetime_from
string <date-time>
Default: "2000-01-01 00:00:00"

The start date for query.

datetime_to
string <date-time>
Default: "2100-01-01 00:00:00"

The finish date for query.

period_count
string
Default: 100

The number of last periods for data mart.

Responses
200

Success.

401

Request not authenticated due to missing, invalid, authentication info.

404

A specified resource is not found.

500

Unknown server error.

get/blockchains/{blockchain_name}/report
Request samples
Response samples
application/json
{
  • "blockchainReports": [
    ]
}

Validators

List validators

Get the list of active validators per period.

SecurityApiKeyAuth
Request
path Parameters
blockchain_name
required
string

The name of blockchain.

query Parameters
datetime_from
string <date-time>
Default: "2000-01-01 00:00:00"

The start date for query.

datetime_to
string <date-time>
Default: "2100-01-01 00:00:00"

The finish date for query.

period_count
string
Default: 100

The number of last periods for data mart.

Responses
200

Success.

401

Request not authenticated due to missing, invalid, authentication info.

404

A specified resource is not found.

500

Unknown server error.

get/blockchains/{blockchain_name}/validators
Request samples
Response samples
application/json
{
  • "validators": [
    ]
}

Validators on-chain report

This method returns the blockchain staking data for every defined blockchain period per every validator that was active.

SecurityApiKeyAuth
Request
path Parameters
blockchain_name
required
string

The name of blockchain.

query Parameters
datetime_from
string <date-time>
Default: "2000-01-01 00:00:00"

The start date for query.

datetime_to
string <date-time>
Default: "2100-01-01 00:00:00"

The finish date for query.

period_count
string
Default: 100

The number of last periods for data mart.

validator_address
required
string

Validator public key.

Responses
200

Success.

401

Request not authenticated due to missing, invalid, authentication info.

404

A specified resource is not found.

500

Unknown server error.

get/blockchains/{blockchain_name}/validators/report
Request samples
Response samples
application/json
{
  • "validatorReports": [
    ]
}

Delegators

List delegators

Get the list of active delegators per period.

SecurityApiKeyAuth
Request
path Parameters
blockchain_name
required
string

The name of blockchain.

query Parameters
datetime_from
string <date-time>
Default: "2000-01-01 00:00:00"

The start date for query.

datetime_to
string <date-time>
Default: "2100-01-01 00:00:00"

The finish date for query.

period_count
string
Default: 100

The number of last periods for data mart.

Responses
200

Success.

401

Request not authenticated due to missing, invalid, authentication info.

404

A specified resource is not found.

500

Unknown server error.

get/blockchains/{blockchain_name}/delegators
Request samples
Response samples
application/json
{
  • "delegators": [
    ]
}

Delegators on-chain report

Get delegator on-chain report.

SecurityApiKeyAuth
Request
path Parameters
blockchain_name
required
string

The name of blockchain.

query Parameters
datetime_from
string <date-time>
Default: "2000-01-01 00:00:00"

The start date for query.

datetime_to
string <date-time>
Default: "2100-01-01 00:00:00"

The finish date for query.

period_count
string
Default: 100

The number of last periods for data mart.

blockchain_user_address
required
string

Delegator public key.

Responses
200

Success.

401

Request not authenticated due to missing, invalid, authentication info.

404

A specified resource is not found.

500

Unknown server error.

get/blockchains/{blockchain_name}/delegators/report
Request samples
Response samples
application/json
{
  • "delegatorReports": [
    ]
}

APR

Get APR for given deposit address.

SecurityApiKeyAuth
Request
path Parameters
deposit_address
required
string

The blockchain user address.

Responses
200

Success.

401

Request not authenticated due to missing, invalid, authentication info.

404

A specified resource is not found.

500

Unknown server error.

get/deposits/{deposit_address}/apr
Request samples
Response samples
application/json
{
  • "result": [
    ]
}

Rewards

Get total rewards for given deposit address.

SecurityApiKeyAuth
Request
path Parameters
deposit_address
required
string

The blockchain user address.

Responses
200

Success.

401

Request not authenticated due to missing, invalid, authentication info.

404

A specified resource is not found.

500

Unknown server error.

get/deposits/{deposit_address}/total_rewards
Request samples
Response samples
application/json
{
  • "result": [
    ]
}