# Node

## 1. Get Round History of a Node

```
url：/v2/nodes/round-history?page_size=5&page_number=1
method：GET
```

| Request Parameter | Type | Description                          |
| ----------------- | ---- | ------------------------------------ |
| page\_number      | int  | current page number, starting from 1 |
| page\_size        | int  | entries on each page                 |

**Example response**

```json
{
    "code": 0,
    "msg": "SUCCESS",
    "result": {
        "rnd_history_list": [
            {
                "id": 63,
                "rnd_start_blk": 8574300,
                "rnd_end_blk": 8634299,
                "rnd_start_time": 1592737389,
                "cycle": 85
            },
            {
                "id": 62,
                "rnd_start_blk": 8514300,
                "rnd_end_blk": 8574299,
                "rnd_start_time": 1591858049,
                "rnd_end_time": 1592737388,
                "cycle": 84
            },
            {
                "id": 61,
                "rnd_start_blk": 8454300,
                "rnd_end_blk": 8514299,
                "rnd_start_time": 1590983140,
                "rnd_end_time": 1591858045,
                "cycle": 83
            },
            {
                "id": 60,
                "rnd_start_blk": 8394300,
                "rnd_end_blk": 8454299,
                "rnd_start_time": 1590252541,
                "rnd_end_time": 1590983110,
                "cycle": 82
            },
            {
                "id": 59,
                "rnd_start_blk": 8334300,
                "rnd_end_blk": 8394299,
                "rnd_start_time": 1589414958,
                "rnd_end_time": 1590252540,
                "cycle": 81
            }
        ],
        "count": 11
    }
}
```

| Response Parameter | Type   | Description                                                            |
| ------------------ | ------ | ---------------------------------------------------------------------- |
| code               | int    | error code                                                             |
| msg                | String | if successful returns `SUCCESS`, if failed returns failure description |
| result             | String | if successful returns round history, if failed returns ""              |

## 2. Get incentives information of a node

```
url：/v2/nodes/inspire/all?page_number=1&page_size=10
method：GET
```

| Request Parameter | Type | Description                          |
| ----------------- | ---- | ------------------------------------ |
| page\_number      | int  | current page number, starting from 1 |
| page\_size        | int  | entries on each page                 |

**Example Response**

```json
{
    "code": 0,
    "msg": "SUCCESS",
    "result": {
        "total": 48,
        "records": [
            {
                "public_key": "02107546a6a21ac45ebc3e5cdb96f100fb1efac548339926c5ab05dde175e720f4",
                "address": "ALMCC2PCT9YjzMyftvt9ifvK8jKteQfXoY",
                "name": "Node_021075",
                "status": 1,
                "current_stake": 102500,
                "node_released_ong_incentive": 8731,
                "node_released_ong_incentive_rate": "4.06%",
                "user_released_ong_incentive": 78580,
                "user_released_ong_incentive_rate": "1463.22%",
                "node_gas_fee_incentive": 0,
                "node_gas_fee_incentive_rate": "0.00%",
                "user_gas_fee_incentive": 0,
                "user_gas_fee_incentive_rate": "0.00%",
                "node_foundation_bonus_incentive": 19926,
                "node_foundation_bonus_incentive_rate": "9.28%",
                "user_foundation_bonus_incentive": 0,
                "user_foundation_bonus_incentive_rate": "0.00%"
            },
            {
                "public_key": "0223c8669cc98e82284ac2f6197c17bbd587e259260f71ffeb3e1ee5358f3c1cc7",
                "address": "AXwfq4jnhvByDmvuFhFzHSSdKJ3GQTwZ8Z",
                "name": "Node_0223c8",
                "status": 1,
                "current_stake": 893000,
                "node_released_ong_incentive": 608538,
                "node_released_ong_incentive_rate": "283.29%",
                "user_released_ong_incentive": 152134,
                "user_released_ong_incentive_rate": "8.93%",
                "node_gas_fee_incentive": 0,
                "node_gas_fee_incentive_rate": "0.00%",
                "user_gas_fee_incentive": 0,
                "user_gas_fee_incentive_rate": "0.00%",
                "node_foundation_bonus_incentive": 173599,
                "node_foundation_bonus_incentive_rate": "80.81%",
                "user_foundation_bonus_incentive": 0,
                "user_foundation_bonus_incentive_rate": "0.00%"
            },
            {
                "public_key": "02299bd4cf2c81f3e724ba267d5d4e6fbd68cf1282fd4811922a6fb7bb7661df82",
                "address": "AczZ2AmTeAPgpsZZKzT6USBPJ93Er9ThBW",
                "name": "Node_02299b",
                "status": 1,
                "current_stake": 10000,
                "node_released_ong_incentive": 8518,
                "node_released_ong_incentive_rate": "39.65%",
                "user_released_ong_incentive": 0,
                "user_released_ong_incentive_rate": "0.00%",
                "node_gas_fee_incentive": 0,
                "node_gas_fee_incentive_rate": "0.00%",
                "user_gas_fee_incentive": 0,
                "user_gas_fee_incentive_rate": "0.00%",
                "node_foundation_bonus_incentive": 1944,
                "node_foundation_bonus_incentive_rate": "9.05%",
                "user_foundation_bonus_incentive": 0,
                "user_foundation_bonus_incentive_rate": "0.00%"
            }
        ]
    }
}
```

| Response Parameter | Type   | Description                                                            |
| ------------------ | ------ | ---------------------------------------------------------------------- |
| code               | int    | error code                                                             |
| msg                | String | if successful returns `SUCCESS`, if failed returns failure description |
| result             | String | if successful returns incentive details, if failed returns ""          |

## 3. Get incentives information of a node using its public key

```
url：/v2/nodes/inspire?public_key={public_key}
method：GET
```

| Request Parameter | Type   | Description          |
| ----------------- | ------ | -------------------- |
| public\_key       | String | public key of a node |

**Response**

```json
{
    "code": 0,
    "msg": "SUCCESS",
    "result": {
        "public_key": "02107546a6a21ac45ebc3e5cdb96f100fb1efac548339926c5ab05dde175e720f4",
        "address": "ALMCC2PCT9YjzMyftvt9ifvK8jKteQfXoY",
        "name": "Node_021075",
        "status": 1,
        "current_stake": 102500,
        "node_released_ong_incentive": 8731,
        "node_released_ong_incentive_rate": "4.06%",
        "user_released_ong_incentive": 78580,
        "user_released_ong_incentive_rate": "1463.22%",
        "node_gas_fee_incentive": 0,
        "node_gas_fee_incentive_rate": "0.00%",
        "user_gas_fee_incentive": 0,
        "user_gas_fee_incentive_rate": "0.00%",
        "node_foundation_bonus_incentive": 19926,
        "node_foundation_bonus_incentive_rate": "9.28%",
        "user_foundation_bonus_incentive": 0,
        "user_foundation_bonus_incentive_rate": "0.00%"
    }
}
```

| Response Parameter | Type   | Description                                                            |
| ------------------ | ------ | ---------------------------------------------------------------------- |
| code               | int    | error code                                                             |
| msg                | String | if successful returns `SUCCESS`, if failed returns failure description |
| result             | String | if successful returns incentive details, if failed returns ""          |

Fields in an incentive details object:

| Field Name                               | Type   | Description                                                             |
| ---------------------------------------- | ------ | ----------------------------------------------------------------------- |
| public\_key                              | String | public key of the node                                                  |
| address                                  | String | wallet address of the node                                              |
| name                                     | String | node name                                                               |
| status                                   | int    | node type, `1` represents candidate node, `2` represents consensus node |
| current\_stake                           | long   | current stake of a node                                                 |
| node\_released\_ong\_incentive           | long   | ONG incentive released to a node                                        |
| node\_released\_ong\_incentive\_rate     | String | ONG incentive earnings yield ratio of a node                            |
| user\_released\_ong\_incentive           | long   | ONG incentive released to a user                                        |
| user\_released\_ong\_incentive\_rate     | String | ONG incentive earnings yield ratio of a user                            |
| node\_gas\_fee\_incentive                | long   | gas fee received by a node                                              |
| node\_gas\_fee\_incentive\_rate          | String | gas fee earnings yield ratio of a node                                  |
| user\_gas\_fee\_incentive                | long   | gas fee received by a user                                              |
| user\_gas\_fee\_incentive\_rate          | String | gas fee earnings yield ratio of a user                                  |
| node\_foundation\_bonus\_incentive       | long   | foundation bonus received by a node                                     |
| node\_foundation\_bonus\_incentive\_rate | String | foundation bonus earnings yield ratio of a node                         |
| user\_foundation\_bonus\_incentive       | long   | foundation bonus received by a user                                     |
| user\_foundation\_bonus\_incentive\_rate | String | foundation bonus earnings yield ratio of a user                         |

## 4. Query On-Chain Configuration of Registered Nodes

```
url:/v2/nodes/node-on-chain-config?address={address}&public_key={public_key}  
method：GET
```

| Request Parameters | Type   | Description                       |
| ------------------ | ------ | --------------------------------- |
| address            | String | Node staking wallet address       |
| public\_key        | String | Node public key (operator wallet) |

#### Response

```json
{
  "code": 0,
  "msg": "SUCCESS",
  "result": {
    "node_apr": "3371.95%",
    "user_apr": "63966.44%",
    "fee_sharing_ratio_node_t": "90%",
    "fee_sharing_ratio_node_t1": "90%",
    "fee_sharing_ratio_node_t2": "90%",
    "fee_sharing_ratio_user_t": "5%",
    "fee_sharing_ratio_user_t1": "5%",
    "fee_sharing_ratio_user_t2": "5%",
    "promise_stake": "10000",
    "node_stake": "10000",
    "user_stake": "82",
    "total_stake": "10082",
    "cap": "100000",
    "reward": "5444.9085037",
    "withdrawable_amount": "100",
    "locked_amount": "100000",
    "current_round": 234
  }
}
```

| Response Parameter            | Type   | Description                                                              |
| ----------------------------- | ------ | ------------------------------------------------------------------------ |
| node\_apr                     | String | Node public key                                                          |
| user\_apr                     | String | Node name                                                                |
| fee\_sharing\_ratio\_node\_t  | String | Node stake's fee sharing ratio for node in round T                       |
| fee\_sharing\_ratio\_node\_t1 | String | Node stake's fee sharing ratio for node in round T+1                     |
| fee\_sharing\_ratio\_node\_t2 | String | Node stake's fee sharing ratio for node in round T+2                     |
| fee\_sharing\_ratio\_user\_t  | String | User stake's fee sharing ratio for node in round T                       |
| fee\_sharing\_ratio\_user\_t1 | String | User stake's fee sharing ratio for node in round T+1                     |
| fee\_sharing\_ratio\_user\_t2 | String | User stake's fee sharing ratio for node in round T+2                     |
| promise\_stake                | String | Initial stake amount (non-reducible, withdrawn upon cancelling the node) |
| node\_stake                   | String | Node stake amount                                                        |
| user\_stake                   | String | User stake amount                                                        |
| total\_stake                  | String | Node stake amount + user stake amount                                    |
| cap                           | String | Maximum allowed amount of user stake                                     |
| reward                        | String | ONG rewards from node staking                                            |
| withdrawable\_amount          | String | Amount of ONT that can be withdrawn (or null)                            |
| locked\_amount                | String | Amount of ONT locked (or null)                                           |
| current\_round                | Int    | Current staking round                                                    |

***

## 5. Get Staking Rewards of an Address (Supported from Round 244)

```
uri：/v2/nodes/staking-rewards?address={address}&public_key={public_key}&round={round}
method：GET
```

| Request Parameters | Type   | Required | Description            |
| ------------------ | ------ | -------- | ---------------------- |
| `address`          | String | Required | Staking wallet address |
| `public_key`       | String | Optional | Node public key        |
| `round`            | Int    | Optional | Staking round          |

#### Response

```json
{
  "code": 0,
  "msg": "SUCCESS",
  "result": [
    {
      "address": "ALD7JkG8MMCkqwJys2eWgHLJME9oyXEz17",
      "public_key": "0239a0816bc5f989f0cc74146ada8d396bee75753267cdc9ce3b4c4f57c83d5e33",
      "rewards": "2.122491966",
      "round": 244
    },
    {
      "address": "ALD7JkG8MMCkqwJys2eWgHLJME9oyXEz17",
      "public_key": "0239a0816bc5f989f0cc74146ada8d396bee75753267cdc9ce3b4c4f57c83d5e33",
      "rewards": "8.651644582",
      "round": 244
    }
  ]
}
```

| Response Parameter | Type   | Description            |
| ------------------ | ------ | ---------------------- |
| `address`          | String | Staking wallet address |
| `public_key`       | String | Node public key        |
| `rewards`          | String | ONG rewards            |
| `round`            | Int    | Staking round          |

## 6.Get Address Staking Snapshot (Supported from Round 244)

```
uri：/v2/nodes/staking-snapshot?address={address}&public_key={public_key}&round={round}
method：GET
```

| Request Parameters | Type   | Required | Description            |
| ------------------ | ------ | -------- | ---------------------- |
| address            | String | required | staking wallet address |
| public\_key        | String | option   | node public key        |
| round              | int    | option   | staking round          |

**Response**

```json
{
    "code": 0,
    "msg": "SUCCESS",
    "result": [
        {
            "address": "AXkf8gnKpYkvCWvLThvEnKpt8PHjMaNpsX",
            "public_key": "023c2e07eeaf3b3576d8fa60f860fab22304f8779771a80f0bf01274d05decd001",
            "rewards": "0",
            "staked": 0,
            "processing": 0,
            "unstaking": 500,
            "withdrawable": 500,
            "round": 247
        },
        {
            "address": "AXkf8gnKpYkvCWvLThvEnKpt8PHjMaNpsX",
            "public_key": "023c2e07eeaf3b3576d8fa60f860fab22304f8779771a80f0bf01274d05decd001",
            "rewards": "0",
            "staked": 500,
            "processing": 0,
            "unstaking": 1000,
            "withdrawable": 0,
            "round": 246
        }
    ]
}
```

| Field\_Name  | Type   | Description               |
| ------------ | ------ | ------------------------- |
| address      | String | staking wallet address    |
| public\_key  | String | node public key           |
| rewards      | String | ONG rewards               |
| staked       | String | valid stakeing ONT amount |
| processing   | String | processing ONT amount     |
| unstaking    | String | unstaking ONT amount      |
| withdrawable | String | withdrawable ONT amount   |
| round        | int    | staking round             |
