🔗Staking API
Preparation
Before you use API, you need to login the website to create API Key with proper permissions.
You can manage your API Keys here.
Please remember below information after creation:
Access Key
: It is used in API requestPrivate Key
: It is used to generate the signature (only visible once after creation)
Every user can create at most 10 API Keys,every API Key can bind maximum 10 IP address.
Interface URL
https://stakingapi.xhash.com:18000
Authentication
All interfaces are requested using the private key signature and public key verification
The request header contains the following signature information:
All interfaces use post requests with request parameters placed in requestBody
Response Format
Example
Interface details
Get user balance and unpaid amount
HTTP Request
POST /api/v1/xhash/getUserStatus
RequestBody
No param
Response
Parameter | Data Type | Description | remark |
clBalance | int | balance of consensus-layer | Gwei |
waitPayment | float | balance of execution-layer | Gwei |
Example
Get user detail status
HTTP request
POST /api/v1/xhash/getUserDetailStatus
RequestBody No param
Response
Parameter | Data Type | Description | remark |
validatorsOnline | int | validators num online | |
validatorsOffline | int | validators num offline | |
totalBalance | string | balance of consensus-layer | Gwei |
totalChange | string | total reward (Execution+consensus) | Gwei |
hoursIncome24 | string | 24 hour reward (Execution+consensus) | Gwei |
partailWithdrawalsAmount | number | consensus withdrawals amount | Gwei |
waitPayment | string | execution-layer wait payment | Gwei |
pendingPayment | string | execution-layer pending payment | Gwei |
paid | string | execution-layer paid | Gwei |
avgRealApr | float | average apr of all validators |
Example
Get user daily Income
HTTP Request
POST /api/v1/xhash/getUserDailyIncome
RequestBody
Parameter | Data Type | Required | Default | Description |
pageNum | int | true | - | Number of pages [1,...] |
pageSetNum | int | true | - | Number each page [10,100] |
Response
Parameter | Data Type | Description | remark |
userId | int | user ID | |
totalReward | float | total reward | Eth |
clReward | float | consensus-layer reward | Eth |
elReward | float | execution-layer reward | Eth |
mevReward | float | mev reward of execution-layer | Eth |
txReward | float | txfee reward of execution-layer | Eth |
rewardDay | int | timestamp of reward day | second |
validatorNum | int | number of validators generating revenue that day | |
total | int | number of all rewards |
Example
Get user payment history
HTTP Request
POST /api/v1/xhash/getUserPaymentHistory
RequestBody
Parameter | Data Type | Required | Default | Description |
pageNum | int | true | - | Number of pages [1,...] |
pageSetNum | int | true | - | Number each page [10,100] |
Response
Parameter | Data Type | Description | remark |
userId | int | user ID | |
realAmount | float | payment amount | Eth |
chainAmount | float | execution-layer amount on chain | Eth |
withHoldTxFee | float | tx fee withholding | Eth |
realTxFee | float | tx fee on chain | Eth |
retained | float | tx feen retained | Eth |
txHash | string | tx hash on chain | |
status | int | payment status | 0:paying, 1:finished |
chainTime | int | the time on chain | |
updateTime | int | payment update time | |
total | int | number of all rewards |
Example
Get user validator list
HTTP Request
POST /api/v1/xhash/getUserValidatorList
RequestBody
Parameter | Data Type | Required | Default | Description |
pageNum | int | true | - | Number of pages [1,...] |
pageSetNum | int | true | - | Number each page [10,100] |
Response
Parameter | Data Type | Description | remark |
id | int | sequence id | |
userId | int | user ID | |
validatorIndex | int | validator index | |
validatorPublicKey | string | validator publicKey | |
totalIncome | int | consensus-layer income | Gwei |
effectiveBalance | int | consensus-layer effective balance | Gwei |
finalizedBalance | int | consensus-layer finalized balance | Gwei |
currentBalance | int | consensus-layer balance | Gwei |
currentEffectiveness | string | effectiveness | |
apr | float | apr by 7 day | |
node_status | string | validator status in xhash | |
chain_status | string | consensus-layer status | |
created_time | timestamp in xhash | second | |
total | int | number of all rewards |
Example
Get consensus-layer withdrawals
HTTP Request
POST /api/v1/xhash/getUserPartailWithdrawals
RequestBody
Parameter | Data Type | Required | Default | Description |
pageNum | int | true | - | Number of pages [1,...] |
pageSetNum | int | true | - | Number each page [10,100] |
Response
Parameter | Data Type | Description | remark |
id | int | sequence id | |
userId | int | userId | |
validatorIndex | int | validator index | |
validatorPublicKey | string | validator publicKey | |
blockSlot | int | slot | |
withdrawalIndex | int | withdrawal Index | |
address | string | withdrawal address | |
amount | float | withdrawal amount | eth |
createdTime | long | timestamp,second |
Example
Error Code
code | message |
200 | success |
400 | Param error |
401 | Authentication failed |
403 | Ip not on whitelist |
404 | Path Not Found |
405 | Request timestamp expire |
429 | Requests has exceeded the per second limit |
500 | Server error |
4001 | Select user balance failed |
4002 | Page invalid |
4003 | Select user reward failed |
4004 | Select user payments history failed |
4005 | Select validator list failed |
Last updated