kmd_rewards_info
kmd_rewards_info
The kmd_rewards_info method returns information about the active user rewards that can be claimed by an address’s unspent outputs.
Arguments
| Structure | Type | Description |
|---|---|---|
| (none) |
Response
| Structure | Type | Description |
|---|---|---|
| result | array of objects | the rewards info; each element corresponds to an unspent output and contains detailed information about the active user rewards corresponding to it |
| tx_hash | string | the hash of the transaction |
| height | number (integer, optional) | the height of the block in which the transaction was included (empty if the tx is not mined yet) |
| output_index | number (integer) | the zero-based index of the output in the transaction’s list of outputs |
| amount | string (numeric) | the transaction output’s value |
| locktime | number (integer) | the transaction output’s locktime |
| accrued_rewards | object | either a NotAccruedReason or AccruedRewards object, showing the amount of accrued rewards, or the reason why rewards are not accrued. |
| accrue_start_at | number (integer, optional) | the rewards start to accrue at this time for the given transaction (empty if the rewards will never accrue to it) |
| accrue_stop_at | number (integer, optional) | the rewards stop to accrue at this time for the given transaction (empty if the tx is not mined yet or if rewards will never accrue to it) |
Where the accrued_rewards has either
| Structure | Type | Description |
|---|---|---|
| Accrued | string (numeric) | the amount of accrued rewards |
or
| Structure | Type | Description |
|---|---|---|
| NotAccruedReason | string | the reason why rewards are not accrued |
📌 Examples
Command
POST kmd_rewards_info
{
"userpass": "RPC_UserP@SSW0RD",
"method": "kmd_rewards_info"
} curl --url "http://127.0.0.1:7783" --data '{
"userpass": "RPC_UserP@SSW0RD",
"method": "kmd_rewards_info"
}' import requests
import json
url = "http://127.0.0.1:7783"
payload = {
"userpass": "RPC_UserP@SSW0RD",
"method": "kmd_rewards_info"
}
response = requests.post(url, json=payload)
print(json.dumps(response.json(), indent=2)) const payload = {
"userpass": "RPC_UserP@SSW0RD",
"method": "kmd_rewards_info"
};
const response = await fetch("http://127.0.0.1:7783", {
method: "POST",
body: JSON.stringify(payload),
});
console.log(await response.json()); <?php
$payload = <<<'JSON'
{
"userpass": "RPC_UserP@SSW0RD",
"method": "kmd_rewards_info"
}
JSON;
$ch = curl_init("http://127.0.0.1:7783");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
curl_close($ch);
echo $response; package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{"userpass":"RPC_UserP@SSW0RD","method":"kmd_rewards_info"}`)
resp, err := http.Post("http://127.0.0.1:7783", "application/json", bytes.NewBuffer(payload))
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
} require 'net/http'
require 'json'
require 'uri'
uri = URI("http://127.0.0.1:7783")
payload = {
"userpass": "RPC_UserP@SSW0RD",
"method": "kmd_rewards_info"
}
response = Net::HTTP.post(uri, payload.to_json, 'Content-Type' => 'application/json')
puts JSON.pretty_generate(JSON.parse(response.body)) Show Response
Response
{
"result": [
{
"accrue_stop_at": 1596144028,
"accrued_rewards": {
"Accrued": "0.00450984"
},
"amount": "47.99897112",
"height": 1986467,
"input_index": 1,
"locktime": 1596099388,
"tx_hash": "016bfb8fcf8704a30b5daf6b4bcce9d7e848141b53df44a5eae3db4279227401"
},
{
"accrue_stop_at": 1596142801,
"accrued_rewards": {
"NotAccruedReason": "UtxoAmountLessThanTen"
},
"amount": "0.5",
"height": 1986481,
"input_index": 0,
"locktime": 1596098161,
"tx_hash": "762d02d9d52faf365b55375da5e61ce34bb0ea391fbcb23e74b2adf8165f1bbb"
}
]
}