# API documentation

An API server is providing a REST API for ETHO protocol related information. The server can be reached at <https://api.ethoprotocol.com>.&#x20;

The syntax of API calls is:\
<https://api.ethoprotocol.com/api?module=xxxx\\&action=yyyy>

where xxxx represents the functionality type and yyyy represents the requested action.

All JSON replies are strings.

### Basic functionality

The module with basic functionality provides some basic information both from the Etho Protocol chain and from the master nodes.

#### Query Etho Protocol total supply

<mark style="color:blue;">`GET`</mark> `https://api.ethoprotocol.com/api?module=basic&action=totalsupply`

This call returns the total supply emitted by the blockchain at the current block number. The total supply contains both mining rewards, uncles, dev rewards, and node rewards.

#### Query Parameters

| Name                                                 | Type   | Description               |
| ---------------------------------------------------- | ------ | ------------------------- |
| module=basic<mark style="color:red;">\*</mark>       | String | Set the basic function    |
| action=totalsupply<mark style="color:red;">\*</mark> | String | Set action to totalsupply |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  "BlockHeight": "9408103",
  "TotalSupply": "79480009"
}
```

{% endtab %}
{% endtabs %}

#### Query Etho Protocol circulating supply

<mark style="color:blue;">`GET`</mark> `https://api.ethoprotocol.com/api?module=basic&action=supply`

The call returns the circulating supply of Etho Protocol at the current block number. The circulating supply is defined as:\
\
Circulating reward = Total reward - Dev wallet - Staked Etho

The staked ETHO is the result of ETHO providing a storage layer and for that purpose is not in circulation.

#### Query Parameters

| Name                                            | Type   | Description                         |
| ----------------------------------------------- | ------ | ----------------------------------- |
| module=basic<mark style="color:red;">\*</mark>  | String | Set the basic function              |
| action=supply<mark style="color:red;">\*</mark> | String | Set the circulating supply function |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  "BlockHeight": "9407685",
  "CirculatingSupply": "62598687"
}
```

{% endtab %}
{% endtabs %}

#### Query Etho Protocol chain information

<mark style="color:blue;">`GET`</mark> `https://api.ethoprotocol.com/api?module=basic&action=chaininfo`

The call queries the difficulty, hashrate and block number of Etho Protocol at the current block number

#### Query Parameters

| Name                                           | Type   | Description                 |
| ---------------------------------------------- | ------ | --------------------------- |
| module=basic<mark style="color:red;">\*</mark> | String | Set the basic function      |
| action=chaininfo                               | String | Set the chain info function |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "blocktime": 5.7,
    "difficulty": "45898234326",
    "hashrate": 8052321811.578947
}
```

*blocktime*: average time in seconds over the last 10 blocks

*difficulty*: average difficulty over the last 10 blocks

*hashrate*: average hash rate over the last 10 blocks&#x20;
{% endtab %}
{% endtabs %}

#### Query Etho Protocol master node locations

<mark style="color:blue;">`GET`</mark> `https://api.ethoprotocol.com/api?module=basic&action=node_locations`

The call queries the positions and type of Etho Nodes of Etho Protocol.

#### Query Parameters

| Name                                           | Type   | Description                    |
| ---------------------------------------------- | ------ | ------------------------------ |
| module=basic<mark style="color:red;">\*</mark> | String | Set the basic function         |
| action=node\_locations                         | String | Set the node location function |

{% tabs %}
{% tab title="200: OK " %}

```javascript
[
  {
    "id": "02CVFl9ZCY4DWj4VxtGG",
    "x": 49.405,
    "y": 11.1617,
    "nodettype": "gn"
  },
  {
    "id": "0ayWuYvRELov09Ogi3al",
    "x": 49.405,
    "y": 11.1617,
    "nodettype": "gn"
  },
  {
    "id": "0azYOmwRPJMAT2dAF8Qj",
    "x": 49.405,
    "y": 11.1617,
    "nodettype": "gn"
  }
}
```

{% endtab %}
{% endtabs %}

#### Query Etho Protocol master node statistics

<mark style="color:blue;">`GET`</mark> `https://api.ethoprotocol.com/api?module=basic&action=network_stats`

The call queries general stats of Etho Protocol nodes.

#### Query Parameters

| Name                                           | Type   | Description                    |
| ---------------------------------------------- | ------ | ------------------------------ |
| module=basic<mark style="color:red;">\*</mark> | String | Set the basic function         |
| action=network\_stats                          | String | Set the network\_stats funct { |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  "activeUploadContracts": "15975",
  "networkStorageAvailable": "27402000000000",
  "totalNetworkStorageUs": "269574336397.25165",
  "active_gatewaynodes": "292",
  "active_masternodes": "108",
  "active_servicenodes": "29",
  "gatewaynode_reward": "12.376",
  "masternode_reward": "6.18802",
  "servicenode_reward": "1.54701"
}
```

{% endtab %}
{% endtabs %}
