# Welcome to the Graphite API documentation

The Graphite API provides robust support for developers and applications requiring data access and general API integration. This API supports both **GET** and **POST** requests, offering flexibility for a wide range of use cases.

## Accessing the API

To start using the Graphite API, use one of the following endpoints:

* **Mainnet**: <https://api.main.atgraphite.com/api>
* **Testnet**: <https://api.test.atgraphite.com/api>

## Available modules

The Graphite API is divided into several modules to simplify navigation and use. Each module includes specific endpoints, parameters, and examples. Click a module below for more details:

<table data-header-hidden><thead><tr><th width="158"></th><th></th></tr></thead><tbody><tr><td><a href="/account">Account</a></td><td><code>?module=account</code></td></tr><tr><td><a href="/logs">Logs</a></td><td><code>?module=logs</code></td></tr><tr><td><a href="/token">Token</a></td><td><code>?module=token</code></td></tr><tr><td><a href="/gas_tracker">Gas Tracker</a></td><td><code>?module=gastracker</code></td></tr><tr><td><a href="/stats">Stats</a></td><td><code>?module=stats</code></td></tr><tr><td><a href="/block">Block</a></td><td><code>?module=block</code></td></tr><tr><td><a href="/contract">Contract</a></td><td><code>?module=contract</code></td></tr><tr><td><a href="/transaction">Transaction</a></td><td><code>?module=transaction</code></td></tr></tbody></table>

## Getting Started

1. **Choose the appropriate network:** Use the Mainnet for live production data or the Testnet for testing and development purposes.
2. **Select a module:** Navigate to the module you need from the list above.
3. **Construct your query:** Use the provided query parameters (`?module=<module_name>`) to interact with the API.

Enjoy exploring Graphite and building amazing applications!


# Accounts

## Get balance for a single address

Returns the balance of a given address.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=account
   &action=balance
   &address=0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae
   &tag=latest
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=account&action=balance&address=0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae&tag=latest&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                                                                      |
| --------- | -------------------------------------------------------------------------------- |
| address\* | the string representing the address to check for balance                         |
| tag\*     | the string pre-defined block parameter, either `earliest`, `pending` or `latest` |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": "40891626854930000000000" 
}
```

## Get balance history for a single address

Returns the balance history of a given address.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=account
   &action=balancehistory
   &address=0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae
   &starttimestamp=1656010239
   &endtimestamp=1656010242
   &offset=0
   &limit=10
   &sort=desc
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=account&action=balancehistory&address=0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae&starttimestamp=1656010239&endtimestamp=1656010242&offset=0&limit=10&sort=desc&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter      | Description                                                                                                     |
| -------------- | --------------------------------------------------------------------------------------------------------------- |
| address\*      | the string representing the address to check for balance                                                        |
| starttimestamp | the starting timestamp of interval, default value is `null`                                                     |
| endtimestamp   | the ending timestamp of interval, default value is `null`                                                       |
| offset         | skips the `offset` records before beginning to return the records, default value is `0`                         |
| limit          | the number of records displayed per page, default value is `10000`                                              |
| sort           | the sorting preference, use `asc` to sort by ascending and `desc` to sort by descending, default value is `asc` |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "blockNumber": "123",
            "timeStamp": "1656020241",
            "balance": "40126832366005123220000",
            "balanceChange": "-764794488924876780000"
        },
        {
            "blockNumber": "1",
            "timeStamp": "1656010239",
            "balance": "40891626854930000000000",
            "balanceChange": "40891626854930000000000"
        }
    ]
}
```

## Get balance for multiple addresses in a single call

Returns the balance of the accounts from a list of addresses (maximum of 20 addresses per call).

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=account
   &action=balancemulti
   &address=0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a,0x63a9975ba31b0b9626b34300f7f627147df1f526,0x198ef1ec325a96cc354c7266a038be8b5c558f67
   &tag=latest
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=account&action=balancemulti&address=0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a,0x63a9975ba31b0b9626b34300f7f627147df1f526,0x198ef1ec325a96cc354c7266a038be8b5c558f67&tag=latest&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                                                                      |
| --------- | -------------------------------------------------------------------------------- |
| address\* | the strings representing the addresses to check for balance, separated by `,`    |
| tag\*     | the string pre-defined block parameter, either `earliest`, `pending` or `latest` |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "account": "0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a",
            "balance": "40891626854930000000000"
        },
        {
            "account": "0x63a9975ba31b0b9626b34300f7f627147df1f526",
            "balance": "332567136222827062478"
        },
        {
            "account": "0x198ef1ec325a96cc354c7266a038be8b5c558f67",
            "balance": "0"
        }
    ]
}
```

## Get various account counters for a single address

Returns the account counters of a given address.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=account
   &action=counters
   &address=0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae
   &tag=latest
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=account&action=counters&address=0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae&tag=latest&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                                                                      |
| --------- | -------------------------------------------------------------------------------- |
| address\* | the string representing the address to check for counters                        |
| tag       | the string pre-defined block parameter, either `earliest`, `pending` or `latest` |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": {
        "gasUsed": "4328265",
        "transactionCount": {
            "total": "900",
            "incoming": "300",
            "outgoing": "600",
            "self": "0"
        },
        "internalTransactionCount": {
            "total": "1500",
            "incoming": "700",
            "outgoing": "800",
            "self": "0"
        },
        "tokenTransferCount": {
            "total": "600",
            "incoming": "200",
            "outgoing": "400",
            "self": "0"
        },
        "producedBlockCount": "20",
        "balanceChangesCount": "1200"
    } 
}
```

## Get the total number of wallet addresses

Returns the total number of wallet addresses.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=account
   &action=gettotalwalletcount
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=account&action=gettotalwalletcount&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": "264567"
}
```

## Get the number of wallets with a non-zero balance

Returns the number of wallets (contracts and EOA accounts) with a non-zero balance

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=account
   &action=getnonzerowalletcount
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=account&action=getnonzerowalletcount&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": "274"
}
```

## Get a list of 'normal' transactions by address

Returns the list of transactions performed by an address.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=account
   &action=txlist
   &address=0x28c6c06298d514db089934071355e5743bf21d60
   &startblock=18541319
   &endblock=18541319
   &direction=in
   &offset=10
   &limit=10
   &sort=asc
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=account&action=txlist&address=0x28c6c06298d514db089934071355e5743bf21d60&startblock=18541319&endblock=18541319&direction=in&offset=10&limit=10&sort=asc&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter  | Description                                                                                                                           |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| address\*  | the string representing the address to check for normal transactions                                                                  |
| startblock | the integer block number to start searching for transactions, default value is `0`                                                    |
| endblock   | the integer block number to stop searching for transactions, default value is `1000000000`                                            |
| direction  | direction option `in` for incoming transactions, `out` for outgoing, `self` for the equal sender and receiver, default value is `all` |
| offset     | skips the `offset` records before beginning to return the records, default value is `0`                                               |
| limit      | the number of records displayed per page, default value is `10000`                                                                    |
| sort       | the sorting preference, use `asc` to sort by ascending and `desc` to sort by descending, default value is `asc`                       |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "blockHash":"0x7d81377abfa115565cd537df1a5873fca616f531292ff000d24083265590aa06",
            "blockNumber":"18541319",
            "confirmations":"0",
            "contractAddress":null,
            "cumulativeGasUsed":"6769329",
            "decoded":{
                "method_call":"transfer(address _to, uint256 _value)",
                "method_id":"0xa9059cbb",
                "parameters":[
                    {
                        "name":"_to",
                        "type":"address",
                        "value":"0xdc58e6ad03fa3c21c2f68105af3954411d17ad8e"
                    },
                    {
                        "name":"_value",
                        "type":"uint256",
                        "value":"109246000000000000000"
                    }
                ]
            },
            "from":"0x28c6c06298d514db089934071355e5743bf21d60",
            "functionName":"transfer(address _to, uint256 _value)",
            "gas":"207128",
            "gasPrice":"34235322240",
            "gasUsed":"44422",
            "hash":"0x4a92f997fa11357e7dbd07161844d3518bb1bdc980ba6cbc571fe0bf69dc07e3","input":"0xa9059cbb000000000000000000000000dc58e6ad03fa3c21c2f68105af3954411d17ad8e000000000000000000000000000000000000000000000005ec17c2309c530000",
            "isError":"0",
            "methodId":"0xa9059cbb",
            "nonce":"8181556",
            "receiptStatus":"1",
            "revertReason":null,
            "timeStamp":"1699616555",
            "to":"0x767fe9edc9e0df98e07454847909b5e959d7ca0e",
            "transactionIndex":"48",
            "type":"2",
            "value":"0"
        }
    ]
}
```

## Get a list of 'internal' transactions by address

Returns the list of internal transactions performed by an address.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=account
   &action=txlistinternal
   &address=0xe6f0742f01fbab90d76e87ac291be94ff2103363
   &startblock=0
   &endblock=99999999
   &direction=all
   &offset=10
   &limit=10
   &sort=asc
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=account&action=txlistinternal&address=0xe6f0742f01fbab90d76e87ac291be94ff2103363&startblock=0&endblock=99999999&direction=all&offset=10&limit=10&sort=asc&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter  | Description                                                                                                                           |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| address\*  | the string representing the address to check for internal transactions                                                                |
| startblock | the integer block number to start searching for transactions, default value is `0`                                                    |
| endblock   | the integer block number to stop searching for transactions, default value is `1000000000`                                            |
| direction  | direction option `in` for incoming transactions, `out` for outgoing, `self` for the equal sender and receiver, default value is `all` |
| offset     | skips the `offset` records before beginning to return the records, default value is `0`                                               |
| limit      | the number of records displayed per page, default value is `10000`                                                                    |
| sort       | the sorting preference, use `asc` to sort by ascending and `desc` to sort by descending, default value is `asc`                       |

#### Sample response

```json
{
    "status":"1",
    "message":"OK",
    "result": [
        {
            "blockNumber": "2535368",
            "timeStamp": "1477837690",
            "hash": "0x8a1a9989bda84f80143181a68bc137ecefa64d0d4ebde45dd94fc0cf49e70cb6",
            "index": "0",
            "transactionIndex": "0",
            "from": "0x20d42f2e99a421147acf198d775395cac2e8b03d",
            "to": null,
            "value": "0",
            "contractAddress": "0x2c1ba59d6f58433fb1eaee7d20b26ed83bda51a3",
            "input": "0x",
            "type": "create",
            "callType": null,
            "gas": "254791",
            "gasUsed": "46750",
            "traceId": "0",
            "isError": "0",
            "errCode": null
        },
        {
            "blockNumber": "2535479",
            "timeStamp": "1477839134",
            "hash": "0x1a50f1dc0bc912745f7d09b988669f71d199719e2fb7592c2074ede9578032d0",
            "index": "0",
            "transactionIndex": "0",
            "from": "0x2c1ba59d6f58433fb1eaee7d20b26ed83bda51a3",
            "to": "0x20d42f2e99a421147acf198d775395cac2e8b03d",
            "value": "100000000000000000",
            "contractAddress": null,
            "input": "0x",
            "type": "call",
            "callType": "call",
            "gas": "235231",
            "gasUsed": "0",
            "traceId": "0",
            "isError": "0",
            "errCode": null
        }
    ]
}
```

## Get a list of 'ERC20 - Token Transfer Events' by Address

Returns the list of ERC-20 tokens transferred by an address, with optional filtering by token contract.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=account
   &action=tokentx
   &contractaddress=0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2
   &address=0x4e83362442b8d1bec281594cea3050c8eb01311c
   &startblock=0
   &endblock=27025780
   &offset=0
   &limit=10
   &sort=asc
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=account&action=tokentx&contractaddress=0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2&address=0x4e83362442b8d1bec281594cea3050c8eb01311c&startblock=0&endblock=27025780&offset=0&limit=10&sort=asc&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

Usage:

* ERC-20 transfers from an address, specify the `address` parameter
* ERC-20 transfers from a contract address, specify the `contractaddress` parameter
* ERC-20 transfers from an address filtered by a token contract, specify both `address` and `contractaddress` parameters

#### Request query parameters

| Parameter           | Description                                                                                                     |
| ------------------- | --------------------------------------------------------------------------------------------------------------- |
| address\*\*         | the string representing the token address                                                                       |
| contractaddress\*\* | the string representing the contract address                                                                    |
| startblock          | the integer block number to start searching for transactions, default value is `0`                              |
| endblock            | the integer block number to stop searching for transactions, default value is `1000000000`                      |
| offset              | skips the `offset` records before beginning to return the records, default value is `0`                         |
| limit               | the number of records displayed per page, default value is `10000`                                              |
| sort                | the sorting preference, use `asc` to sort by ascending and `desc` to sort by descending, default value is `asc` |

#### Sample response

```json
{
    "status":"1",
    "message":"OK",
    "result":[
        {
            "blockNumber":"4730207",
            "index": 0,
            "timeStamp":"1513240363",
            "hash":"0xe8c208398bd5ae8e4c237658580db56a2a94dfa0ca382c99b776fa6e7d31d5b4",
            "nonce":"406",
            "blockHash":"0x022c5e6a3d2487a8ccf8946a2ffb74938bf8e5c8a3f6d91b41c56378a96b5c37",
            "from":"0x642ae78fafbb8032da552d619ad43f1d81e4dd7c",
            "contractAddress":"0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2",
            "to":"0x4e83362442b8d1bec281594cea3050c8eb01311c",
            "value":"5901522149285533025181",
            "tokenName":"Maker",
            "tokenSymbol":"MKR",
            "tokenDecimal":"18",
            "tokenPriceUSD": "1123.78",
            "transactionIndex":"81",
            "gas":"940000",
            "gasPrice":"32010000000",
            "gasUsed":"77759",
            "cumulativeGasUsed":"2523379",
            "input":"deprecated",
            "confirmations":"7968350",
            "methodId": "0xa9059cbb",
            "functionName": "transfer(address _to, uint256 _value)"
        },
        {
            "blockNumber":"4764973",
            "index": 0,
            "timeStamp":"1513764636",
            "hash":"0x9c82e89b7f6a4405d11c361adb6d808d27bcd9db3b04b3fb3bc05d182bbc5d6f",
            "nonce":"428",
            "blockHash":"0x87a4d04a6d8fce7a149e9dc528b88dc0c781a87456910c42984bdc15930a2cac",
            "from":"0x4e83362442b8d1bec281594cea3050c8eb01311c",
            "contractAddress":"0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2",
            "to":"0x69076e44a9c70a67d5b79d95795aba299083c275",
            "value":"132520488141080",
            "tokenName":"Maker",
            "tokenSymbol":"MKR",
            "tokenDecimal":"18",
            "tokenPriceUSD": "1123.78",
            "transactionIndex":"167",
            "gas":"940000",
            "gasPrice":"35828000000",
            "gasUsed":"127593",
            "cumulativeGasUsed":"6315818",
            "input":"deprecated",
            "confirmations":"7933584",
            "methodId": "0xa9059cbb",
            "functionName": "transfer(address _to, uint256 _value)"
        }
    ]
}
```

## Get list of blocks mined by address

Returns the list of blocks mined by an address.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=account
   &action=getminedblocks
   &address=0x9dd134d14d1e65f84b706d6f205cd5b1cd03a46b
   &offset=0
   &limit=10
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=account&action=getminedblocks&address=0x9dd134d14d1e65f84b706d6f205cd5b1cd03a46b&offset=0&limit=10&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                                                                             |
| --------- | --------------------------------------------------------------------------------------- |
| address\* | the string representing the address                                                     |
| offset    | skips the `offset` records before beginning to return the records, default value is `0` |
| limit     | the number of records displayed per page, default value is `10000`                      |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "blockNumber": "3462296",
            "timeStamp": "1491118514",
            "blockReward": "5194770940000000000"
        },
        {
            "blockNumber": "2691400",
            "timeStamp": "1480072029",
            "blockReward": "5086562212310617100"
        }
    ]
}
```

## Get KYC level, activation status and reputation by address

Returns information about the KYC level, activation status, and reputation (trust score) of an address.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=account
   &action=kyc
   &address=0xc3a8119e77803a306bcf250db89d9eed89842af3
   &tag=latest
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=account&action=kyc&address=0xc3a8119e77803a306bcf250db89d9eed89842af3&tag=latest&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                                                                                        |
| --------- | -------------------------------------------------------------------------------------------------- |
| address\* | the string representing the address                                                                |
| tag       | the string pre-defined block parameter, either block number or `latest`, default value is `latest` |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": {
        "activated": true,
        "activationBlockNumber": "2",
        "kycLastUpdateBlockNumber": null,
        "kycLevel": "0",
        "reputation": "205"
    }
}
```

## Get volumes for a single address

Returns the total funds sent, received, and the spent fees for a given address.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=account
   &action=volumes
   &address=0x4642227a142d77b4b1b46ab38ca41be19263f8e8
   &starttimestamp=1734083783
   &endtimestamp=1734095612
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=account&action=volumes&address=0x4642227a142d77b4b1b46ab38ca41be19263f8e8&starttimestamp=1734083783&endtimestamp=1734095612&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter      | Description                                                 |
| -------------- | ----------------------------------------------------------- |
| address\*      | the string representing the address                         |
| starttimestamp | the starting timestamp of interval, default value is `null` |
| endtimestamp   | the ending timestamp of interval, default value is `null`   |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": {
        "fee": "662285354000000000",
        "inputVolume": "100000000000000000000",
        "outputVolume": "10000000000000000"
    }
}
```

## Get top accounts by balance

Returns a list of addresses of the top 10,000 accounts by native coin balance.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=account
   &action=topbalance
   &offset=0
   &limit=10
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=account&action=topbalance&offset=0&limit=10&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                                                                             |
| --------- | --------------------------------------------------------------------------------------- |
| offset    | skips the `offset` records before beginning to return the records, default value is `0` |
| limit     | the number of records displayed per page, default value is `10000`                      |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": {
        "accounts": [
            {
                "address": "0x0000000000000000000000000000000000001100",
                "balance": "333000000000000000000000000",
                "percentage": "33.300000",
                "transactionCount": "0"
            },
            {
                "address": "0x0000000000000000000000000000000000001110",
                "balance": "135000000000000000000000000",
                "percentage": "13.500000",
                "transactionCount": "0"
            },
            {
                "address": "0x0000000000000000000000000000000000001101",
                "balance": "100000000000000000000000000",
                "percentage": "10.000000",
                "transactionCount": "0"
            }
        ]
    }
}
```


# API key stats

## Get quantitative request statistics for a given api key and time period

Returns quantitative request statistics.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/apikey_stats
   ?apikey=YourApiKeyToken
   &timerange=day
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/apikey_stats?apikey=YourApiKeyToken&timerange=day'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter   | Description                                                                               |
| ----------- | ----------------------------------------------------------------------------------------- |
| apikey\*    | the string representing the api key                                                       |
| timerange\* | the string pre-defined time period parameter, either `hour`, `day`, `week` or `fortnight` |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "calls": 252,
            "timestamp": 1670410800
        },
        {
            "calls": 256,
            "timestamp": 1670414400
        }
    ] 
}
```

## Get last api calls for a given api key

Returns 20 last calls.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/apikey_lastcalls
   ?apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/apikey_lastcalls?apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                         |
| --------- | ----------------------------------- |
| apikey\*  | the string representing the api key |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "chain": {
                "type": "graphite",
                "network": "mainnet"
            },
            "action": "avgblocktime",
            "from": "10.190.6.130",
            "module": "stats",
            "timestamp": 1670492713,
            "data": null
        },
        {
            "chain": {
                "type": "graphite",
                "network": "mainnet"
            },
            "action": "gettotalwalletcount",
            "from": "10.190.6.130",
            "module": "account",
            "timestamp": 1670492713,
            "data": null
        }
    ] 
}
```


# Blocks

## Get the most recent block number

Returns number of the most recent block.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=block
   &action=getlatestblockno
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=block&action=getlatestblockno&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": "0x26a8c"
}
```

## Get block header by block number

Returns block header (including hashes of the transactions) by block number.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=block
   &action=getblockbyno
   &blockno=4000
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=block&action=getblockbyno&blockno=4000&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                                            |
| --------- | ------------------------------------------------------ |
| blockno\* | a nonnegative integer that represents the block number |

#### Sample response

```json
{
    "message": "OK",
    "status": "1",
    "result": {
        "confirmations": "339013",
        "decodedExtraData": {
            "awn": 28000,
            "signature": "0x77effa4dd280642e45f3eccc3a70318b530241e06d0e5c51283b8385638c3dae6358465dd700dbfb0f7382d6343c60b23e9f4b3fbf9b2700a5d178061c38cd5500",
            "validators": [
                "0xcedfbaf9728a447bad47a0b1b9637dd87b569967",
                "0x876c2a819e5ff874f3bf7ba6bb702b3d669bd8c4",
                "0xc4ec71b541e0830c090a39d7534d78e36e797073",
                "0xa07b131a8f4feca511dbf5cb75bc42fbb606c840",
                "0x2e51ff20551537d3cdadf0db406d66a0ecba4eda",
                "0x8ae6be0dedb5e4f7531c08d1642f7c058be3fbd1",
                "0xddca5562cf3914e6815c87746109f478a46a6373"
            ],
            "vanity": "0xd883010101846765746888676f312e31392e39856c696e757800000000000000"
        },
        "difficulty": "0x01",
        "epoch": true,
        "extraData": "0xd883010101846765746888676f312e31392e39856c696e75780000000000000000000000000000006d60cedfbaf9728a447bad47a0b1b9637dd87b569967876c2a819e5ff874f3bf7ba6bb702b3d669bd8c4c4ec71b541e0830c090a39d7534d78e36e797073a07b131a8f4feca511dbf5cb75bc42fbb606c8402e51ff20551537d3cdadf0db406d66a0ecba4eda8ae6be0dedb5e4f7531c08d1642f7c058be3fbd1ddca5562cf3914e6815c87746109f478a46a637377effa4dd280642e45f3eccc3a70318b530241e06d0e5c51283b8385638c3dae6358465dd700dbfb0f7382d6343c60b23e9f4b3fbf9b2700a5d178061c38cd5500",
        "gasLimit": "0x1c9c380",
        "gasUsed": "0xa410",
        "gasUsedPercentage": "0.140000",
        "hash": "0x5b3c968bbb6f09f1742b38c0f608f5e509af0dc452c992d1fefd8071468a8542",
        "internalTransactionCount": "0",
        "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "miner": "0xc4ec71b541e0830c090a39d7534d78e36e797073",
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "nonce": "0x0200000000000000",
        "number": "0xfa0",
        "parentHash": "0x81f0c6eeff8bb15d93faa313fb5400709e4c1e88b15bec4621586750200ed90a",
        "receiptsRoot": "0xd95b673818fa493deec414e01e610d97ee287c9421c8eff4102b1647c1a184e4",
        "reward": "756000000000000",
        "size": "0x3de",
        "slashingVote": null,
        "stateRoot": "0x7c6dd81c890afdbfe84689062e9ae11452cd4b1efd899b70725678197e1f892c",
        "timestamp": "0x6740df66",
        "totalDifficulty": "0x0fa1",
        "transactionCount": "2",
        "transactionFees": "756000000000000",
        "transactionsRoot": "0x742017cee12a062cbd0b42194cbfd9e096d9417e3e42e361306218cb7774d1ab"
    }
}
```

> **Note**: If the block is an epoch block (the `epoch` flag is set to `true`), then the `extraData` field contains, in addition to other fields, a list of validators. Otherwise, the list is always empty.

## Get block header by block hash

Returns block header (including hashes of the transactions) by block hash.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=block
   &action=getblockbyhash
   &blockhash=0x5b3c968bbb6f09f1742b38c0f608f5e509af0dc452c992d1fefd8071468a8542
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=block&action=getblockbyhash&blockhash=0x5b3c968bbb6f09f1742b38c0f608f5e509af0dc452c992d1fefd8071468a8542&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter   | Description                   |
| ----------- | ----------------------------- |
| blockhash\* | hash of contents of the block |

#### Sample response

```json
{
    "message": "OK",
    "status": "1",
    "result": {
        "confirmations": "339013",
        "decodedExtraData": {
            "awn": 28000,
            "signature": "0x77effa4dd280642e45f3eccc3a70318b530241e06d0e5c51283b8385638c3dae6358465dd700dbfb0f7382d6343c60b23e9f4b3fbf9b2700a5d178061c38cd5500",
            "validators": [
                "0xcedfbaf9728a447bad47a0b1b9637dd87b569967",
                "0x876c2a819e5ff874f3bf7ba6bb702b3d669bd8c4",
                "0xc4ec71b541e0830c090a39d7534d78e36e797073",
                "0xa07b131a8f4feca511dbf5cb75bc42fbb606c840",
                "0x2e51ff20551537d3cdadf0db406d66a0ecba4eda",
                "0x8ae6be0dedb5e4f7531c08d1642f7c058be3fbd1",
                "0xddca5562cf3914e6815c87746109f478a46a6373"
            ],
            "vanity": "0xd883010101846765746888676f312e31392e39856c696e757800000000000000"
        },
        "difficulty": "0x01",
        "epoch": true,
        "extraData": "0xd883010101846765746888676f312e31392e39856c696e75780000000000000000000000000000006d60cedfbaf9728a447bad47a0b1b9637dd87b569967876c2a819e5ff874f3bf7ba6bb702b3d669bd8c4c4ec71b541e0830c090a39d7534d78e36e797073a07b131a8f4feca511dbf5cb75bc42fbb606c8402e51ff20551537d3cdadf0db406d66a0ecba4eda8ae6be0dedb5e4f7531c08d1642f7c058be3fbd1ddca5562cf3914e6815c87746109f478a46a637377effa4dd280642e45f3eccc3a70318b530241e06d0e5c51283b8385638c3dae6358465dd700dbfb0f7382d6343c60b23e9f4b3fbf9b2700a5d178061c38cd5500",
        "gasLimit": "0x1c9c380",
        "gasUsed": "0xa410",
        "gasUsedPercentage": "0.140000",
        "hash": "0x5b3c968bbb6f09f1742b38c0f608f5e509af0dc452c992d1fefd8071468a8542",
        "internalTransactionCount": "0",
        "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "miner": "0xc4ec71b541e0830c090a39d7534d78e36e797073",
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "nonce": "0x0200000000000000",
        "number": "0xfa0",
        "parentHash": "0x81f0c6eeff8bb15d93faa313fb5400709e4c1e88b15bec4621586750200ed90a",
        "receiptsRoot": "0xd95b673818fa493deec414e01e610d97ee287c9421c8eff4102b1647c1a184e4",
        "reward": "756000000000000",
        "size": "0x3de",
        "slashingVote": null,
        "stateRoot": "0x7c6dd81c890afdbfe84689062e9ae11452cd4b1efd899b70725678197e1f892c",
        "timestamp": "0x6740df66",
        "totalDifficulty": "0x0fa1",
        "transactionCount": "2",
        "transactionFees": "756000000000000",
        "transactionsRoot": "0x742017cee12a062cbd0b42194cbfd9e096d9417e3e42e361306218cb7774d1ab"
    }
}
```

## Get an array of block headers by block number range

Returns an array of block headers by block number range (maximum of 20 blocks per call).

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=block
   &action=getblockrange
   &startblock=4000
   &endblock=4000
   &sort=asc
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=block&action=getblockrange&startblock=4000&endblock=4000&sort=asc&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter    | Description                                                                             |
| ------------ | --------------------------------------------------------------------------------------- |
| startblock\* | the integer block number that represents the first number of range                      |
| endblock\*   | the integer block number that represents the last number of range                       |
| sort\*       | the sorting preference, use `asc` to sort by ascending and `desc` to sort by descending |

#### Sample response

```json
{
    "status": "1",
    "message": "OK-Missing",
    "result": [
        {
            "confirmations": "339013",
            "decodedExtraData": {
                "awn": 28000,
                "signature": "0x77effa4dd280642e45f3eccc3a70318b530241e06d0e5c51283b8385638c3dae6358465dd700dbfb0f7382d6343c60b23e9f4b3fbf9b2700a5d178061c38cd5500",
                "validators": [
                    "0xcedfbaf9728a447bad47a0b1b9637dd87b569967",
                    "0x876c2a819e5ff874f3bf7ba6bb702b3d669bd8c4",
                    "0xc4ec71b541e0830c090a39d7534d78e36e797073",
                    "0xa07b131a8f4feca511dbf5cb75bc42fbb606c840",
                    "0x2e51ff20551537d3cdadf0db406d66a0ecba4eda",
                    "0x8ae6be0dedb5e4f7531c08d1642f7c058be3fbd1",
                    "0xddca5562cf3914e6815c87746109f478a46a6373"
                ],
                "vanity": "0xd883010101846765746888676f312e31392e39856c696e757800000000000000"
            },
            "difficulty": "0x01",
            "epoch": true,
            "extraData": "0xd883010101846765746888676f312e31392e39856c696e75780000000000000000000000000000006d60cedfbaf9728a447bad47a0b1b9637dd87b569967876c2a819e5ff874f3bf7ba6bb702b3d669bd8c4c4ec71b541e0830c090a39d7534d78e36e797073a07b131a8f4feca511dbf5cb75bc42fbb606c8402e51ff20551537d3cdadf0db406d66a0ecba4eda8ae6be0dedb5e4f7531c08d1642f7c058be3fbd1ddca5562cf3914e6815c87746109f478a46a637377effa4dd280642e45f3eccc3a70318b530241e06d0e5c51283b8385638c3dae6358465dd700dbfb0f7382d6343c60b23e9f4b3fbf9b2700a5d178061c38cd5500",
            "gasLimit": "0x1c9c380",
            "gasUsed": "0xa410",
            "gasUsedPercentage": "0.140000",
            "hash": "0x5b3c968bbb6f09f1742b38c0f608f5e509af0dc452c992d1fefd8071468a8542",
            "internalTransactionCount": "0",
            "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
            "miner": "0xc4ec71b541e0830c090a39d7534d78e36e797073",
            "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
            "nonce": "0x0200000000000000",
            "number": "0xfa0",
            "parentHash": "0x81f0c6eeff8bb15d93faa313fb5400709e4c1e88b15bec4621586750200ed90a",
            "receiptsRoot": "0xd95b673818fa493deec414e01e610d97ee287c9421c8eff4102b1647c1a184e4",
            "reward": "756000000000000",
            "size": "0x3de",
            "slashingVote": null,
            "stateRoot": "0x7c6dd81c890afdbfe84689062e9ae11452cd4b1efd899b70725678197e1f892c",
            "timestamp": "0x6740df66",
            "totalDifficulty": "0x0fa1",
            "transactionCount": "2",
            "transactionFees": "756000000000000",
            "transactionsRoot": "0x742017cee12a062cbd0b42194cbfd9e096d9417e3e42e361306218cb7774d1ab"
        }
    ]
}
```

## Get an array of block headers by number list

Returns an array of block headers by number list (maximum of 20 blocks per call).

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=block
   &action=getblocklist
   &blockno=4000,4001
   &sort=asc
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=block&action=getblocklist&blockno=4000,4001&sort=asc&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                                                                                                |
| --------- | ---------------------------------------------------------------------------------------------------------- |
| blockno\* | the numbers separated by `,`                                                                               |
| sort      | the sorting preference, use `asc` to sort by ascending and `desc` to sort by descending, `desc` is default |

#### Sample response

```json
{
    "message": "OK-Missing/Invalid API Key, free rate limit applied",
    "result": [
        {
            "confirmations": "339105",
            "decodedExtraData": {
                "awn": 28007,
                "signature": "0x7329de1e4808a90ac206f533f4d25d053b4620d3cddcf08551c9b795078bb9a3258b15895fe88193b7f5b249b870c6b6fe2c368dcf3c430969b0fcc1b676b39a00",
                "vanity": "0xd883010101846765746888676f312e31392e39856c696e757800000000000000"
            },
            "difficulty": "0x01",
            "epoch": false,
            "extraData": "0xd883010101846765746888676f312e31392e39856c696e75780000000000000000000000000000006d677329de1e4808a90ac206f533f4d25d053b4620d3cddcf08551c9b795078bb9a3258b15895fe88193b7f5b249b870c6b6fe2c368dcf3c430969b0fcc1b676b39a00",
            "gasLimit": "0x1c9c380",
            "gasUsed": "0x14820",
            "gasUsedPercentage": "0.280000",
            "hash": "0x4bb12210633e11af577bb235e55a63bf475a39eb5fec6d6abe4c2f89e7e0b308",
            "internalTransactionCount": "0",
            "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
            "miner": "0x876c2a819e5ff874f3bf7ba6bb702b3d669bd8c4",
            "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
            "nonce": "0x0400000000000000",
            "number": "0xfa1",
            "parentHash": "0x5b3c968bbb6f09f1742b38c0f608f5e509af0dc452c992d1fefd8071468a8542",
            "receiptsRoot": "0x04deb4be6955e1a300123be48007597f67e4229f8ce70f4f10388de6fd3fa267",
            "reward": "1512000000000000",
            "size": "0x436",
            "slashingVote": null,
            "stateRoot": "0x1a81b1809ed73c59e0680d9111f8a09e9c31f0b421450d109a28d29312b3f28e",
            "timestamp": "0x6740df69",
            "totalDifficulty": "0x0fa2",
            "transactionCount": "4",
            "transactionFees": "1512000000000000",
            "transactionsRoot": "0xc8e65fa1d4919a558961bea81162ddfc730b386582f06e350fa2f0427cd7300a"
        },
        {
            "confirmations": "339106",
            "decodedExtraData": {
                "awn": 28000,
                "signature": "0x77effa4dd280642e45f3eccc3a70318b530241e06d0e5c51283b8385638c3dae6358465dd700dbfb0f7382d6343c60b23e9f4b3fbf9b2700a5d178061c38cd5500",
                "validators": [
                    "0xcedfbaf9728a447bad47a0b1b9637dd87b569967",
                    "0x876c2a819e5ff874f3bf7ba6bb702b3d669bd8c4",
                    "0xc4ec71b541e0830c090a39d7534d78e36e797073",
                    "0xa07b131a8f4feca511dbf5cb75bc42fbb606c840",
                    "0x2e51ff20551537d3cdadf0db406d66a0ecba4eda",
                    "0x8ae6be0dedb5e4f7531c08d1642f7c058be3fbd1",
                    "0xddca5562cf3914e6815c87746109f478a46a6373"
                ],
                "vanity": "0xd883010101846765746888676f312e31392e39856c696e757800000000000000"
            },
            "difficulty": "0x01",
            "epoch": true,
            "extraData": "0xd883010101846765746888676f312e31392e39856c696e75780000000000000000000000000000006d60cedfbaf9728a447bad47a0b1b9637dd87b569967876c2a819e5ff874f3bf7ba6bb702b3d669bd8c4c4ec71b541e0830c090a39d7534d78e36e797073a07b131a8f4feca511dbf5cb75bc42fbb606c8402e51ff20551537d3cdadf0db406d66a0ecba4eda8ae6be0dedb5e4f7531c08d1642f7c058be3fbd1ddca5562cf3914e6815c87746109f478a46a637377effa4dd280642e45f3eccc3a70318b530241e06d0e5c51283b8385638c3dae6358465dd700dbfb0f7382d6343c60b23e9f4b3fbf9b2700a5d178061c38cd5500",
            "gasLimit": "0x1c9c380",
            "gasUsed": "0xa410",
            "gasUsedPercentage": "0.140000",
            "hash": "0x5b3c968bbb6f09f1742b38c0f608f5e509af0dc452c992d1fefd8071468a8542",
            "internalTransactionCount": "0",
            "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
            "miner": "0xc4ec71b541e0830c090a39d7534d78e36e797073",
            "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
            "nonce": "0x0200000000000000",
            "number": "0xfa0",
            "parentHash": "0x81f0c6eeff8bb15d93faa313fb5400709e4c1e88b15bec4621586750200ed90a",
            "receiptsRoot": "0xd95b673818fa493deec414e01e610d97ee287c9421c8eff4102b1647c1a184e4",
            "reward": "756000000000000",
            "size": "0x3de",
            "slashingVote": null,
            "stateRoot": "0x7c6dd81c890afdbfe84689062e9ae11452cd4b1efd899b70725678197e1f892c",
            "timestamp": "0x6740df66",
            "totalDifficulty": "0x0fa1",
            "transactionCount": "2",
            "transactionFees": "756000000000000",
            "transactionsRoot": "0x742017cee12a062cbd0b42194cbfd9e096d9417e3e42e361306218cb7774d1ab"
        }
    ],
    "status": "1"
}
```

## Get block number by block timestamp

Returns block number by the closest timestamp.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=block
   &action=getblocknobytimestamp
   &timestamp=1658293068
   &closest=after
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=block&action=getblocknobytimestamp&timestamp=1658293068&closest=after&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter   | Description                                                                                           |
| ----------- | ----------------------------------------------------------------------------------------------------- |
| timestamp\* | a nonnegative integer that represents the block timestamp (Unix timestamp in seconds)                 |
| closest\*   | direction to find the closest block number to given timestamp. Available values: `before` and `after` |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": "0x1"
}
```

## Get block account balances changes by block number

Returns all account balances changes in a block by block number.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=block
   &action=getblockbalancechanges
   &blockno=10000
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=block&action=getblockbalancechanges&blockno=10000&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                                            |
| --------- | ------------------------------------------------------ |
| blockno\* | a nonnegative integer that represents the block number |

#### Sample response

```json
{   
    "status": "1",
    "message": "OK",
    "result": [
        {
            "address": "0x0000000000000000000000000000000000000000",
            "balance": "69706756410585043245",
            "balanceChange": "6725754630960973",
            "prevChangeBlockNumber": "9999",
            "prevChangeTimeStamp": "1702143759"
        },
        {
            "address": "0x0aea70d72d5e2218cf9af28410ed388ae03b799b",
            "balance": "1337130978337379414956755",
            "balanceChange": "-7103754630960973",
            "prevChangeBlockNumber": "9999",
            "prevChangeTimeStamp": "1702143759"
        },
        {
            "address": "0xa40e515e604b41a4a3f6f4baa321fd87f6ff6f66",
            "balance": "1093554000000000000",
            "balanceChange": "378000000000000",
            "prevChangeBlockNumber": "9998",
            "prevChangeTimeStamp": "1702143747"
        }
    ]
}
```


# Common

## Account

#### Type

| Value | Description                    |
| ----- | ------------------------------ |
| 0     | Externally owned account (EOA) |
| 1     | Contract account               |

## Transaction

#### Status

| Value | Description |
| ----- | ----------- |
| 0     | failure     |
| 1     | success     |
| 2     | pending     |

#### Type

| Value | Description        |
| ----- | ------------------ |
| 0     | Legacy transaction |

## Internal Transaction

#### Type

| Value        |
| ------------ |
| create       |
| call         |
| selfdestruct |

#### Call Type

| Value        |
| ------------ |
| call         |
| callcode     |
| delegatecall |
| staticcall   |


# Contracts

## Get the total number of deployed smart contracts

Returns the total number of deployed smart contracts.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=contract
   &action=gettotalcontractcount
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=contract&action=gettotalcontractcount&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": "9"
}
```

## Get ABI for verified contract

Returns ABI for verified contract.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=contract
   &action=getabi
   &address=0x0000000000000000000000000000000000001000
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=contract&action=getabi&address=0x0000000000000000000000000000000000001000&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                                      |
| --------- | ------------------------------------------------ |
| address\* | address hex-string used for identifying contract |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": "[{\"constant\":false,\"inputs\":[{\"name\":\"voucher_token\",\"type\":\"bytes32\"}],\"name\":\"burn\",\"outputs\":[{\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"voucher_token\",\"type\":\"bytes32\"}],\"name\":\"is_expired\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"voucher_token\",\"type\":\"bytes32\"}],\"name\":\"is_burnt\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"voucher_token\",\"type\":\"bytes32\"},{\"name\":\"_lifetime\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}]"
}
```

## Get contract deployed byte code

Returns deployed bytecode for a given contract address

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=contract
   &action=getbytecode
   &address=0x0000000000000000000000000000000000001000
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=contract&action=getbytecode&address=0x0000000000000000000000000000000000001000&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                                      |
| --------- | ------------------------------------------------ |
| address\* | address hex-string used for identifying contract |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": "0x312f378576e12537b1243c15723a31231bf23123e23167e568c57fb45b12309f9989e99dc9899"
}
```

## Get contract creation bytecode

Returns creation bytecode for a given contract address

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=contract
   &action=getcreationbytecode
   &address=0x0000000000000000000000000000000000001000
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=contract&action=getcreationbytecode&address=0x0000000000000000000000000000000000001000&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                                      |
| --------- | ------------------------------------------------ |
| address\* | address hex-string used for identifying contract |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": "0x312f378576e12537b1243c15723a31231bf23123e23167e568c57fb45b12309f9989e99dc9899"
}
```

## Get contract source code for verified contract

Returns source code for verified contract.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=contract
   &action=getsourcecode
   &address=0x0000000000000000000000000000000000001000
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=contract&action=getsourcecode&address=0x0000000000000000000000000000000000001000&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                                      |
| --------- | ------------------------------------------------ |
| address\* | address hex-string used for identifying contract |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": {
        "abi": "[{\n\"type\":\"event\",\n\"inputs\": [{\"name\":\"a\",\"type\":\"uint256\",\"indexed\":true},{\"name\":\"b\",\"type\":\"bytes32\",\"indexed\":false}],\n\"name\":\"Event\"\n}, {\n\"type\":\"event\",\n\"inputs\": [{\"name\":\"a\",\"type\":\"uint256\",\"indexed\":true},{\"name\":\"b\",\"type\":\"bytes32\",\"indexed\":false}],\n\"name\":\"Event2\"\n}, {\n\"type\":\"function\",\n\"inputs\": [{\"name\":\"a\",\"type\":\"uint256\"}],\n\"name\":\"foo\",\n\"outputs\": []\n}]\n",
        "compilerVersion": "v0.2.1-2016-01-30-91a6b35",
        "contractName": "Test",
        "optimizationUsed": "1",
        "sourceCode": "pragma solidity >0.4.24;\n\ncontract Test {\nconstructor() public { b = hex\"12345678901234567890123456789012\"; }\nevent Event(uint indexed a, bytes32 b);\nevent Event2(uint indexed a, bytes32 b);\nfunction foo(uint a) public { emit Event(a, b); }\nbytes32 b;\n}\n",
        "byteCode": "0x312f378576e12537b1243c15723a31231bf23123e23167e568c57fb45b12309f9989e99dc9899",
        "constructorArguments": "",
        "implementationAddress": null
    }
}
```

## Get Contract creator and creation transaction hash

Returns a contract's deployer address and transaction hash it was created, up to 5 at a time.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=contract
   &action=getcontractcreation
   &contractaddresses=0xb83c27805aaca5c7082eb45c868d955cf04c337f,0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=contract&action=getcontractcreation&contractaddresses=0xb83c27805aaca5c7082eb45c868d955cf04c337f,0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter           | Description                               |
| ------------------- | ----------------------------------------- |
| contractaddresses\* | the `contract address`, up to 5 at a time |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "contractAddress": "0xb83c27805aaca5c7082eb45c868d955cf04c337f",
            "contractCreator": "0x390dcfddebeff949b9862ec91d7be337b8995553",
            "txHash": "0x0dbad4991b6727df606650635c9e632dad8a92c6363c91652307680efd336c6e",
            "blockNumber": "15062235"
        },
        {
            "contractAddress": "0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45",
            "contractCreator": "0x6c9fc64a53c1b71fb3f9af64d1ae3a4931a5f4e9",
            "txHash": "0x7299cca7203f60a831756e043f4c2ccb0ee6cb7cf8aed8420f0ae99a16883a2b",
            "blockNumber": "13804681"
        }
    ]
}
```

## Get contract addresses by contract method identifier

Returns a list of contract addresses by contract method identifier, sorted by creation block number

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=contract
   &action=getcontractsbymethod
   &methodid=0xa9059cbb
   &offset=0
   &limit=10
   &sort=asc
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=contract&action=getcontractsbymethod&methodid=0xa9059cbb&offset=0&limit=10&sort=asc&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter  | Description                                                                                                     |
| ---------- | --------------------------------------------------------------------------------------------------------------- |
| methodid\* | the hex string representing the method id (4 bytes)                                                             |
| offset     | skips the `offset` records before beginning to return the records, default value is `0`                         |
| limit      | the number of records displayed per page, default value is `10000`                                              |
| sort       | the sorting preference, use `asc` to sort by ascending and `desc` to sort by descending, default value is `asc` |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        "0x741b84be98a7181eb05d8d0fcc7ce285bc9e5c4a",
        "0xd9fdf6d8340df2c358e9e4f6aecc08b8373ae054",
        "0xca54e68e81915143f1fa261e253cf6777c36dbd4",
        "0xac331ff69d4cf665a54013c419bcafaf90f7e1d0",
        "0x32286efee48171b29e066ef8992bb3063231d61e",
        "0xa0eb9b10d9e24ed8e0910f204118f44af7bf7cb9",
        "0xe8df28ef22990009e1d247a329f8507ba4cfa58a",
        "0x5e6c18ceea41c161118b62c8737f5ba9400ba54f",
        "0x8e2b9e2764c213872b70af4586ea75a5627e4555",
        "0x158c14bbedb24398785553b9ec8c71387f52df44"
    ]
}
```

## Get Contract destructor and destruction transaction hash

Returns a contract's destructor address and transaction hash it was destructed, up to 5 at a time.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=contract
   &action=getcontractdestruction
   &contractaddresses=0x838e90a2f735276d8c7824c3858b7ceb3aa6b110,0x76173df7aceeeb990839dc0c359c4a3ec1e01da7
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=contract&action=getcontractdestruction&contractaddresses=0x838e90a2f735276d8c7824c3858b7ceb3aa6b110,0x76173df7aceeeb990839dc0c359c4a3ec1e01da7&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter           | Description                               |
| ------------------- | ----------------------------------------- |
| contractaddresses\* | the `contract address`, up to 5 at a time |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "contractAddress": "0x838e90a2f735276d8c7824c3858b7ceb3aa6b110",
            "contractDestructor": "0x9b2c46642caf6b936dc0633da521f1e946b7e18f",
            "txHash": "0x3340c44ecdfc73450f030f01e4f95328d1df5cf11e2646f5b94325d68ecb97f1",
            "blockNumber": "55245"
        },
        {
            "contractAddress": "0x76173df7aceeeb990839dc0c359c4a3ec1e01da7",
            "contractDestructor": "0x3d0768da09ce77d25e2d998e6a7b6ed4b9116c2d",
            "txHash": "0x55cee382ac5ed2e48638db8fa1ae8df356a6f2d4190f270e9e8938648f8c84ad",
            "blockNumber": "55502"
        }
    ]
}
```

## Verify a contract with its source code and contract creation information

Verifies a contract with its source code.

#### Body parameters (json)

| Parameter            | Description                                             |
| -------------------- | ------------------------------------------------------- |
| addressHash\*        | the address of the contract                             |
| name\*               | the name of the contract                                |
| compilerVersion\*    | the compiler version for the contract                   |
| optimization\*       | whether or not compiler optimizations were enabled      |
| contractSourceCode\* | the source code of the contract                         |
| evmVersion           | the EVM version for the contract                        |
| optimizationRuns     | the number of optimization runs used during compilation |

#### Sample request (HTTP POST)

```
https://api.main.atgraphite.com/api
   ?module=contract
   &action=verifysourcecode
   &apikey=YourApiKeyToken
```

Body (json):

```json
{
    "addressHash": "0x9271602210f21ab82999dd43792a12e63c6e3269",
    "name": "test_contract",
    "compilerVersion": "v0.2.1-2016-01-30-91a6b35",
    "optimization": true,
    "optimizationRuns": 200,
    "contractSourceCode": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13; contract Counter { uint public count; function get() public view returns (uint) { return count; } function inc() public { count += 1; } function dec() public { count -= 1; }}"
}
```

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": {
        "abi": "[{\n\"type\":\"event\",\n\"inputs\": [{\"name\":\"a\",\"type\":\"uint256\",\"indexed\":true},{\"name\":\"b\",\"type\":\"bytes32\",\"indexed\":false}],\n\"name\":\"Event\"\n}, {\n\"type\":\"event\",\n\"inputs\": [{\"name\":\"a\",\"type\":\"uint256\",\"indexed\":true},{\"name\":\"b\",\"type\":\"bytes32\",\"indexed\":false}],\n\"name\":\"Event2\"\n}, {\n\"type\":\"function\",\n\"inputs\": [{\"name\":\"a\",\"type\":\"uint256\"}],\n\"name\":\"foo\",\n\"outputs\": []\n}]\n",
        "compilerVersion": "v0.2.1-2016-01-30-91a6b35",
        "contractName": "test_contract",
        "optimizationUsed": "0",
        "sourceCode": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13; contract Counter { uint public count; function get() public view returns (uint) { return count; } function inc() public { count += 1; } function dec() public { count -= 1; }}",
        "byteCode": "0x312f378576e12537b1243c15723a31231bf23123e23167e568c57fb45b12309f9989e99dc9899",
        "constructorArguments": "",
        "implementationAddress": null
    }
}
```

## Get supported compiler versions

Returns supported compiler versions.

#### Sample request (HTTP POST)

```
https://api.main.atgraphite.com/api
   ?module=contract
   &action=getcompilerversions
   &apikey=YourApiKeyToken
```

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        "v0.8.10+commit.fc410830",
        "v0.8.11+commit.d7f03943",
        "v0.8.12+commit.f00d7308",
        "v0.8.13+commit.abaa5c0e",
        "v0.8.14+commit.80d49f37",
        "v0.8.15+commit.e14f2714",
        "v0.8.16+commit.07a7930e",
        "v0.8.17+commit.8df45f5f"
    ]
}
```

## Get contract creation history

Returns a contract creation history (creator address, transaction hash and block number when it was created)

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=contract
   &action=getcreationhistory
   &contractaddress=0x3293d43cf57cdd7f78e8b193e6628939400b321d
   &offset=0
   &limit=10
   &sort=desc
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=contract&action=getcreationhistory&contractaddress=0x3293d43cf57cdd7f78e8b193e6628939400b321d&offset=0&limit=10&sort=desc&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter         | Description                                      |
| ----------------- | ------------------------------------------------ |
| contractaddress\* | address hex-string used for identifying contract |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "blockNumber": "18009592",
            "contractAddress": "0x3293d43cf57cdd7f78e8b193e6628939400b321d",
            "contractCreator": "0xd7bdff042c48ed3d5dd527301e8001d5860ae717",
            "txHash": "0x8fe362efc9a222c8f025f9663e88bdaf331acbcf538afc64499487dd185c76c0"
        },
        {
            "blockNumber": "17859733",
            "contractAddress": "0x3293d43cf57cdd7f78e8b193e6628939400b321d",
            "contractCreator": "0xd7bdff042c48ed3d5dd527301e8001d5860ae717",
            "txHash": "0xed5a6a39d95feafa537a104b311082348e1ea9e2cf9457bac4e1c4f31c45d198"
        },
        {
            "blockNumber": "17809911",
            "contractAddress": "0x3293d43cf57cdd7f78e8b193e6628939400b321d",
            "contractCreator": "0xd7bdff042c48ed3d5dd527301e8001d5860ae717",
            "txHash": "0x194b3bed50a6a68047b87c79e9829010011eb9e79768d1926169c676c81983b1"
        },
        {
            "blockNumber": "17565842",
            "contractAddress": "0x3293d43cf57cdd7f78e8b193e6628939400b321d",
            "contractCreator": "0xd7bdff042c48ed3d5dd527301e8001d5860ae717",
            "txHash": "0x8d54a2c20ac872db263d7a3615caff32313130dc765fa6f3706c467612474a63"
        },
        {
            "blockNumber": "17293429",
            "contractAddress": "0x3293d43cf57cdd7f78e8b193e6628939400b321d",
            "contractCreator": "0xd7bdff042c48ed3d5dd527301e8001d5860ae717",
            "txHash": "0x03fd065e38fd4ac05eab45d40cd8bee8878b7985b46fa5a680ea83b1920aa3e0"
        }
    ]
}
```

## Get contract destruction history

Returns a contract destruction history (destructor address, transaction hash and block number when it was destructed)

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=contract
   &action=getdestructionhistory
   &contractaddress=0x3293d43cf57cdd7f78e8b193e6628939400b321d
   &offset=0
   &limit=10
   &sort=desc
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=contract&action=getdestructionhistory&contractaddress=0x3293d43cf57cdd7f78e8b193e6628939400b321d&offset=0&limit=10&sort=desc&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter         | Description                                      |
| ----------------- | ------------------------------------------------ |
| contractaddress\* | address hex-string used for identifying contract |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "blockNumber": "18009583",
            "contractAddress": "0x3293d43cf57cdd7f78e8b193e6628939400b321d",
            "contractDestructor": "0xd7bdff042c48ed3d5dd527301e8001d5860ae717",
            "txHash": "0xff59edcb5257f2fae321d4caaf52a1793d511c9460497be82fa1fbe456e27f7b"
        },
        {
            "blockNumber": "17859565",
            "contractAddress": "0x3293d43cf57cdd7f78e8b193e6628939400b321d",
            "contractDestructor": "0xd7bdff042c48ed3d5dd527301e8001d5860ae717",
            "txHash": "0xe31c4cce8b8b531f911880fb2bd978c42b6a3da8581c63309dc5174ecc5f5a1a"
        },
        {
            "blockNumber": "17809898",
            "contractAddress": "0x3293d43cf57cdd7f78e8b193e6628939400b321d",
            "contractDestructor": "0xd7bdff042c48ed3d5dd527301e8001d5860ae717",
            "txHash": "0xb928c47de5fc18e2a968f695d9c31e0d418d4a24968fa73e2d7313f73e713f30"
        },
        {
            "blockNumber": "17565798",
            "contractAddress": "0x3293d43cf57cdd7f78e8b193e6628939400b321d",
            "contractDestructor": "0xd7bdff042c48ed3d5dd527301e8001d5860ae717",
            "txHash": "0xd6a832782779c901802063b65e33f7da890c0d758ebc3f36a177875ca713dc1f"
        }
    ]
}
```


# Common Error Messages

An API call that encounters an error will return 0 as its `status code` and display the cause of the error under the `result` field.

```json
{
    "status": "0",
    "message": "Internal error",
    "result": null
}
```


# Gas Tracker

## Get Gas Oracle

Returns the current Slow, Normal and Fast gas prices.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=gastracker
   &action=gasoracle
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=gastracker&action=gasoracle&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": {
        "gasPrices": {
            "fast": "5305908822",
            "normal": "3686535382",
            "slow": "3267933483"
        },
        "lastBlock": "20670327"
    }
}
```


# Logs

## Get event logs by transaction hash

Returns the event logs by transaction hash.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=logs
   &action=getlogs
   &hash=0x5d46e804447353e3c7785d8c618fde6b9d68a5ecdcc7323463ddff5ea76aa6fa
   &offset=0
   &limit=10
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=logs&action=getlogs&hash=0x5d46e804447353e3c7785d8c618fde6b9d68a5ecdcc7323463ddff5ea76aa6fa&offset=0&limit=10&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                                                                             |
| --------- | --------------------------------------------------------------------------------------- |
| hash\*    | the string representing the transaction hash                                            |
| eventid\* | firt 4 bytes from event signature                                                       |
| offset    | skips the `offset` records before beginning to return the records, default value is `0` |
| limit     | the number of records displayed per page, default value is `10000`                      |

**Note:** The `eventid` parameter may be used as a filter.

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "address":"0xdac17f958d2ee523a2206206994597c13d831ec7",
            "blockNumber":"18468653",
            "data":"0x0000000000000000000000000000000000000000000000000000000002ca0254",
            "logIndex":"388",
            "topics":[
                "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                "0x0000000000000000000000008c8d7c46219d9205f056f28fee5950ad564d7465",
                "0x00000000000000000000000088b50d989682dac8f1b9e4f7bd29883138bd7154"
            ],
            "transactionHash":"0x5d46e804447353e3c7785d8c618fde6b9d68a5ecdcc7323463ddff5ea76aa6fa",
            "decoded": {
                "method_call":"Transfer(address indexed from, address indexed to, uint256 value)",
                "method_id":"0xddf252ad",
                "parameters":[
                    {
                        "indexed":true,
                        "name":"from",
                        "type":"address",
                        "value":"0x8c8d7c46219d9205f056f28fee5950ad564d7465"
                    },
                    {
                        "indexed":true,
                        "name":"to",
                        "type":"address",
                        "value":"0x88b50d989682dac8f1b9e4f7bd29883138bd7154"
                    },
                    {
                        "indexed":false,
                        "name":"value",
                        "type":"uint256",
                        "value":"46793300"
                    }
                ]
            },
        }
    ]
}
```

## Get event logs by address

Returns the event logs from an address, with optional filtering by block range.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=logs
   &action=getlogs
   &address=0xdac17f958d2ee523a2206206994597c13d831ec7
   &startblock=12878196
   &endblock=12878196
   &offset=0
   &limit=10
   &sort=asc
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=logs&action=getlogs&address=0xdac17f958d2ee523a2206206994597c13d831ec7&startblock=12878196&endblock=12878196&offset=0&limit=10&sort=asc&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter  | Description                                                                                                     |
| ---------- | --------------------------------------------------------------------------------------------------------------- |
| address\*  | the string representing the address to check for logs                                                           |
| eventid\*  | firt 4 bytes from event signature                                                                               |
| startblock | the integer block number to start searching for logs                                                            |
| endblock   | the integer block number to stop searching for logs                                                             |
| offset     | skips the `offset` records before beginning to return the records, default value is `0`                         |
| limit      | the number of records displayed per page, default value is `10000`                                              |
| sort       | the sorting preference, use `asc` to sort by ascending and `desc` to sort by descending, default value is `asc` |

**Note:** The `eventid` parameter may be used as a filter.

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "address":"0xdac17f958d2ee523a2206206994597c13d831ec7",
            "blockNumber":"18468653",
            "data":"0x0000000000000000000000000000000000000000000000000000000002ca0254",
            "logIndex":"388",
            "topics":[
                "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                "0x0000000000000000000000008c8d7c46219d9205f056f28fee5950ad564d7465",
                "0x00000000000000000000000088b50d989682dac8f1b9e4f7bd29883138bd7154"
            ],
            "transactionHash":"0x5d46e804447353e3c7785d8c618fde6b9d68a5ecdcc7323463ddff5ea76aa6fa",
            "decoded": {
                "method_call":"Transfer(address indexed from, address indexed to, uint256 value)",
                "method_id":"0xddf252ad",
                "parameters":[
                    {
                        "indexed":true,
                        "name":"from",
                        "type":"address",
                        "value":"0x8c8d7c46219d9205f056f28fee5950ad564d7465"
                    },
                    {
                        "indexed":true,
                        "name":"to",
                        "type":"address",
                        "value":"0x88b50d989682dac8f1b9e4f7bd29883138bd7154"
                    },
                    {
                        "indexed":false,
                        "name":"value",
                        "type":"uint256",
                        "value":"46793300"
                    }
                ]
            },
        }
    ]
}
```

## Get event logs count

Returns the event logs count either by transaction hash or by address.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=logs
   &action=getlogscount
   &hash=0x4ffd22d986913d33927a392fe4319bcd2b62f3afe1c15a2c59f77fc2cc4c20a9
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=logs&action=getlogscount&hash=0x4ffd22d986913d33927a392fe4319bcd2b62f3afe1c15a2c59f77fc2cc4c20a9&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter  | Description                                                                             |
| ---------- | --------------------------------------------------------------------------------------- |
| hash\*     | the string representing the transaction hash                                            |
| address\*  | the string representing the address to check for logs                                   |
| startblock | the integer block number to start searching for logs                                    |
| endblock   | the integer block number to stop searching for logs                                     |
| offset     | skips the `offset` records before beginning to return the records, default value is `0` |
| limit      | the number of records displayed per page, default value is `10000`                      |

Usage:

* In order to get event logs count by transaction hash, specify the `hash` parameter
* In order to get event logs count by address, specify the `address` parameter with optional filtering by block range (`startblock` and `endblock` parameters)

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": "32"
}
```


# Stats

## Get Native Coin Price

Returns the price of 1 native coin.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=stats
   &action=price
   &tag=latest
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=stats&action=price&tag=latest&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                                                                                                                  |
| --------- | ---------------------------------------------------------------------------------------------------------------------------- |
| tag       | the string pre-defined block parameter, either `earliest`, `latest` or block number in hex format, default value is `latest` |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": {
        "timestamp": "1624961308",
        "priceUSD": "2149.18"
    }
}
```

## Get Native Coin Price History

Returns historical prices for a native coin.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=stats
   &action=pricehistory
   &starttimestamp=1734039719
   &endtimestamp=1734043319
   &interval=10m
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=stats&action=pricehistory&starttimestamp=1734039719&endtimestamp=1734043319&interval=10m&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter      | Description                                                                                                                                                                                   |
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| starttimestamp | the starting timestamp, default value is `null`                                                                                                                                               |
| endtimestamp   | the ending timestamp, default value is `null`                                                                                                                                                 |
| interval       | the interval between quotes, default value is `1d`. Allowed values: `5m`, `10m`, `15m`, `30m`, `45m`, `1h`, `2h`, `3h`, `4h`, `6h`, `12h`, `1d`, `2d`, `3d`, `7d`, `14d`, `15d`, `30d`, `60d` |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": {
        "priceChange": "0.1612893643",
        "priceChangePercent": "81.121328",
        "quotes": [
            {
                "priceUSD": "0.1988248560",
                "timestamp": "1734039719"
            },
            {
                "priceUSD": "0.3601142203",
                "timestamp": "1734041519"
            }
        ]
    }
}
```

## Get Total Supply

Returns the current amount of a native coin in circulation.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=stats
   &action=supply
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=stats&action=supply&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": "1000000000000000000000000000"
}
```

## Get Daily Transaction Count `PRO`

Returns the number of transactions performed on the blockchain per day.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=stats
   &action=dailytx
   &startdate=2019-02-01
   &enddate=2019-02-28
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=stats&action=dailytx&startdate=2019-02-01&enddate=2019-02-28&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter   | Description                              |
| ----------- | ---------------------------------------- |
| startdate\* | the starting date in `yyyy-MM-dd` format |
| enddate\*   | the ending date in `yyyy-MM-dd` format   |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "UTCDate": "2019-02-01",
            "unixTimeStamp": "1548979200",
            "transactionCount": 498856
        },
        {
            "UTCDate": "2019-02-28",
            "unixTimeStamp": "1551312000",
            "transactionCount": 541458
        }
    ]
}
```

## Get Daily Average Time for A Block to be Included in the Blockchain `PRO`

Returns the daily average of time needed for a block to be successfully validated.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=stats
   &action=dailyavgblocktime
   &startdate=2019-02-01
   &enddate=2019-02-28
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=stats&action=dailyavgblocktime&startdate=2019-02-01&enddate=2019-02-28&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter   | Description                              |
| ----------- | ---------------------------------------- |
| startdate\* | the starting date in `yyyy-MM-dd` format |
| enddate\*   | the ending date in `yyyy-MM-dd` format   |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "UTCDate": "2019-02-01",
            "unixTimeStamp": "1548979200",
            "blockTime_sec": "3.674321"
        },
        {
            "UTCDate": "2019-02-28",
            "unixTimeStamp": "1551312000",
            "blockTime_sec": "3.777531"
        }
    ]
}
```

## Get Average Time for A Block to be Included in the Blockchain `PRO`

Returns the average (last 1000 blocks) of time needed for a block to be successfully validated.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=stats
   &action=avgblocktime
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=stats&action=avgblocktime&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": "3.424671"
}
```

## Get Daily Network Transaction Fee `PRO`

Returns the amount of transaction fees per day.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=stats
   &action=dailytxnfee
   &startdate=2019-02-01
   &enddate=2019-02-28
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=stats&action=dailytxnfee&startdate=2019-02-01&enddate=2019-02-28&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter   | Description                              |
| ----------- | ---------------------------------------- |
| startdate\* | the starting date in `yyyy-MM-dd` format |
| enddate\*   | the ending date in `yyyy-MM-dd` format   |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "UTCDate":"2019-02-01",
            "unixTimeStamp":"1548979200",
            "transactionFee":"358558440870590355682"
        },
        {
            "UTCDate":"2019-02-28",
            "unixTimeStamp":"1551312000",
            "transactionFee":"545141762162356907132"
        }
    ]
}
```

## Get Daily New Address Count `PRO`

Returns the number of new addresses created per day.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=stats
   &action=dailynewaddress
   &startdate=2019-02-01
   &enddate=2019-02-28
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=stats&action=dailynewaddress&startdate=2019-02-01&enddate=2019-02-28&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter   | Description                              |
| ----------- | ---------------------------------------- |
| startdate\* | the starting date in `yyyy-MM-dd` format |
| enddate\*   | the ending date in `yyyy-MM-dd` format   |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "UTCDate":"2019-02-01",
            "unixTimeStamp":"1548979200",
            "newAddressCount":54081
        },
        {
            "UTCDate":"2019-02-28",
            "unixTimeStamp":"1551312000",
            "newAddressCount":53117
        }
    ]
}
```

## Get Daily New Contract Count `PRO`

Returns the number of new contracts created per day.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=stats
   &action=dailynewcontract
   &startdate=2019-02-01
   &enddate=2019-02-28
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=stats&action=dailynewcontract&startdate=2019-02-01&enddate=2019-02-28&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter   | Description                              |
| ----------- | ---------------------------------------- |
| startdate\* | the starting date in `yyyy-MM-dd` format |
| enddate\*   | the ending date in `yyyy-MM-dd` format   |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "UTCDate":"2019-02-01",
            "unixTimeStamp":"1548979200",
            "newContractCount":127
        },
        {
            "UTCDate":"2019-02-28",
            "unixTimeStamp":"1551312000",
            "newContractCount":198
        }
    ]
}
```

## Get Daily Network Utilization `PRO`

Returns the daily average gas used over gas limit, in percentage.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=stats
   &action=dailynetutilization
   &startdate=2019-02-01
   &enddate=2019-02-28
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=stats&action=dailynetutilization&startdate=2019-02-01&enddate=2019-02-28&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter   | Description                              |
| ----------- | ---------------------------------------- |
| startdate\* | the starting date in `yyyy-MM-dd` format |
| enddate\*   | the ending date in `yyyy-MM-dd` format   |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "UTCDate":"2019-02-01",
            "unixTimeStamp":"1548979200",
            "networkUtilization":"0.8464"
        },
        {
            "UTCDate":"2019-02-28",
            "unixTimeStamp":"1551312000",
            "networkUtilization":"0.9472"
        }
    ]
}
```

## Get Daily Block Rewards `PRO`

Returns the amount of block rewards distributed to miners daily.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=stats
   &action=dailyblockrewards
   &startdate=2019-02-01
   &enddate=2019-02-28
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=stats&action=dailyblockrewards&startdate=2019-02-01&enddate=2019-02-28&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter   | Description                              |
| ----------- | ---------------------------------------- |
| startdate\* | the starting date in `yyyy-MM-dd` format |
| enddate\*   | the ending date in `yyyy-MM-dd` format   |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "UTCDate":"2019-02-01",
            "unixTimeStamp":"1548979200",
            "blockRewards":"358558440870590355682"
        },
        {
            "UTCDate":"2019-02-28",
            "unixTimeStamp":"1551312000",
            "blockRewards":"545141762162356907132"
        }
    ]
}
```

## Get Daily Total Token Holder Count `PRO`

Returns the total number of token holders by days.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=stats
   &action=dailytotaltokenholders
   &contractaddress=0xdac17f958d2ee523a2206206994597c13d831ec7
   &startdate=2019-02-01
   &enddate=2019-02-28
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=stats&action=dailytotaltokenholders&contractaddress=0xdac17f958d2ee523a2206206994597c13d831ec7&startdate=2019-02-01&enddate=2019-02-28&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter   | Description                              |
| ----------- | ---------------------------------------- |
| startdate\* | the starting date in `yyyy-MM-dd` format |
| enddate\*   | the ending date in `yyyy-MM-dd` format   |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "UTCDate":"2019-02-01",
            "unixTimeStamp":"1548979200",
            "holderCount":14
        },
        {
            "UTCDate":"2019-02-28",
            "unixTimeStamp":"1551312000",
            "holderCount":54
        }
    ]
}
```


# Tokens

## Get ERC20-Token Account Balance for TokenContractAddress

Returns the current balance of an ERC-20 token of an address.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=tokenbalance
   &contractaddress=0x57d90b64a1a57749b0f932f1a3395792e12e7055
   &address=0xe04f27eb70e025b78871a2ad7eabe85e61212761
   &tag=0xde6cf2
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=tokenbalance&contractaddress=0x57d90b64a1a57749b0f932f1a3395792e12e7055&address=0xe04f27eb70e025b78871a2ad7eabe85e61212761&tag=0xde6cf2&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter         | Description                                                                                                                  |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| contractaddress\* | the contract address of the ERC-20 token                                                                                     |
| address\*         | the string representing the address to check for token balance                                                               |
| tag               | the string pre-defined block parameter, either `earliest`, `latest` or block number in hex format, default value is `latest` |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": "135499"
}
```

## Get Historical ERC20-Token TotalSupply by ContractAddress & BlockNo `PRO`

Returns the amount of an ERC-20 token in circulation at a certain block height.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=tokensupplyhistory
   &contractaddress=0x57d90b64a1a57749b0f932f1a3395792e12e7055
   &blockno=8000000
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=tokensupplyhistory&contractaddress=0x57d90b64a1a57749b0f932f1a3395792e12e7055&blockno=8000000&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter         | Description                                    |
| ----------------- | ---------------------------------------------- |
| contractaddress\* | the contract address of the ERC-20 token       |
| blockno\*         | the integer block number to check total supply |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": "21265524714464"
}
```

## Get Historical ERC20-Token Account Balance for TokenContractAddress by BlockNo `PRO`

Returns the balance of an ERC-20 token of an address at a certain block height.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=tokenbalancehistory
   &contractaddress=0x57d90b64a1a57749b0f932f1a3395792e12e7055
   &address=0xe04f27eb70e025b78871a2ad7eabe85e61212761
   &blockno=8000000
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=tokenbalancehistory&contractaddress=0x57d90b64a1a57749b0f932f1a3395792e12e7055&address=0xe04f27eb70e025b78871a2ad7eabe85e61212761&blockno=8000000&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter         | Description                                              |
| ----------------- | -------------------------------------------------------- |
| contractaddress\* | the contract address of the ERC-20 token                 |
| address\*         | the string representing the address to check for balance |
| blockno\*         | the integer block number to check total supply           |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": "135499"
}
```

## Get Token Holder List by Contract Address `PRO`

Return the current ERC20 token holders and number of tokens held.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=tokenholderlist
   &contractaddress=0xdac17f958d2ee523a2206206994597c13d831ec7
   &offset=0
   &limit=10
   &sort=asc
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=tokenholderlist&contractaddress=0xdac17f958d2ee523a2206206994597c13d831ec7&offset=0&limit=10&sort=asc&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter         | Description                                                                                                     |
| ----------------- | --------------------------------------------------------------------------------------------------------------- |
| contractaddress\* | the contract address of the ERC-20 token                                                                        |
| offset            | skips the `offset` records before beginning to return the records, default value is `0`                         |
| limit             | the number of records displayed per page, default value is `10000`                                              |
| sort              | the sorting preference, use `asc` to sort by ascending and `desc` to sort by descending, default value is `asc` |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "address": "0xf977814e90da44bfa03b6295a0616a897441acec",
            "balance": "13578034371767156",
            "holdingPercentage": "17.8900",
            "tokenDivisor": "6",
            "balanceUSD": "13575848308.2333"
        },
        {
            "address": "0x5a52e96bacdabb82fd05763e25335261b270efcb",
            "balance": "5261766805626635",
            "holdingPercentage": "6.9328",
            "tokenDivisor": "6",
            "balanceUSD": "5451725524.4802"
        }
    ]
}
```

## Get Number of Token Balances by Contract Address `PRO`

Returns the number of current token balance entries for the specified token.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=tokenbalancescount
   &contractaddress=0xd766ea5e716bbbc8b7185d176def07124c7a89ec
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=tokenbalancescount&contractaddress=0xd766ea5e716bbbc8b7185d176def07124c7a89ec&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter         | Description                              |
| ----------------- | ---------------------------------------- |
| contractaddress\* | the contract address of the ERC-20 token |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": "7"
}
```

## Get Token Info by ContractAddress `PRO`

Returns project information and social media links of an ERC20/ERC721/ERC1155 token.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=tokeninfo
   &contractaddress=0xdac17f958d2ee523a2206206994597c13d831ec7
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=tokeninfo&contractaddress=0xdac17f958d2ee523a2206206994597c13d831ec7&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter         | Description                                                             |
| ----------------- | ----------------------------------------------------------------------- |
| contractaddress\* | the contract address of the ERC-20/ERC-721 token to retrieve token info |

#### Sample response

```json
{
    "status":"1",
    "message":"OK",
    "result":[
        {
            "circulatingMarketCapUSD": "83535944312.996231",
            "contractAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7",
            "divisor": "6",
            "holders": "4543145",
            "holdersChangePercent": "0.036765",
            "priceChangePercent": "-0.010285",
            "symbol": "USDT",
            "tokenName": "Tether USD",
            "tokenPriceUSD": "1.000193",
            "tokenType": "ERC20",
            "totalSupply": "39024700485595726",
            "transfers": "208569273",
            "volumeUSD": "18641246057.291306"
        }
    ]
}
```

## Get Token List `PRO`

Returns a list of tokens (ERC-20, ERC-721).

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=tokenlist
   &marketonly=true
   &type=erc20
   &sortby=circulating_market_cap
   &offset=0
   &limit=10
   &sort=asc
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=tokenlist&marketonly=true&type=erc20&sortby=circulating_market_cap&offset=0&limit=10&sort=asc&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter  | Description                                                                                                                         |
| ---------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| marketonly | the boolean flag, `false` to include all tokens, `true` to include only those tokens that have market data, default value is `true` |
| type       | the string representing the token type, either `erc20`, `erc721` or `erc1155`                                                       |
| sortby     | the sorting preference, either `holders`, `price`, `change`, `circulating_market_cap` or `volume`                                   |
| offset     | skips the `offset` records before beginning to return the records, default value is `0`                                             |
| limit      | the number of records displayed per page, default value is `10000`                                                                  |
| sort       | the sorting preference, use `asc` to sort by ascending and `desc` to sort by descending, default value is `asc`                     |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "circulatingMarketCapUSD": "83535944312.996231",
            "contractAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7",
            "divisor": "6",
            "holders": "4543145",
            "holdersChangePercent": "0.036765",
            "priceChangePercent": "-0.010285",
            "symbol": "USDT",
            "tokenName": "Tether USD",
            "tokenPriceUSD": "1.000193",
            "tokenType": "ERC20",
            "totalSupply": "39024700485595726",
            "transfers": "208569273",
            "volumeUSD": "18641246057.291306"
        }
    ]
}
```

## Get the total number of tokens `PRO`

Returns the total number of tokens for a given token type.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=tokencount
   &marketonly=false
   &type=erc20
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=tokencount&marketonly=false&type=erc20&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter  | Description                                                                                                                         |
| ---------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| marketonly | the boolean flag, `false` to include all tokens, `true` to include only those tokens that have market data, default value is `true` |
| type       | the string representing the token type, either `erc20`, `erc721` or `erc1155`                                                       |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": "826"
}
```

## Get Address ERC20 Token Holding `PRO`

Returns the ERC-20 tokens and amount held by an address.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=addresstokenbalance
   &address=0x983e3660c0bE01991785F80f266A84B911ab59b0
   &offset=0
   &limit=10
   &sort=desc
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=addresstokenbalance&address=0x983e3660c0bE01991785F80f266A84B911ab59b0&offset=0&limit=10&sort=desc&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                                                                                                                                |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| address\* | the string representing the address to check for balance                                                                                   |
| offset    | skips the `offset` records before beginning to return the records, default value is `0`                                                    |
| limit     | the number of records displayed per page, default value is `10000`                                                                         |
| sort      | the sorting preference by amount of tokens in usd, use `asc` to sort by ascending and `desc` to sort by descending, default value is `asc` |

#### Sample response

```json
{
    "status":"1",
    "message":"OK",
    "result":[
        {
            "TokenAddress": "0xffffffff2ba8f66d4e51811c5190992176930278",
            "TokenName": "Furucombo",
            "TokenSymbol": "COMBO",
            "TokenQuantity": "1861606940000000000",
            "TokenDivisor": "18",
            "TokenPriceUSD": "0.002999"
        },
        {
            "TokenAddress": "0xb753428af26e81097e7fd17f40c88aaa3e04902c",
            "TokenName": "Spice",
            "TokenSymbol": "SFI",
            "TokenQuantity": "7",
            "TokenDivisor": "18",
            "TokenPriceUSD": null
        }
    ]
}
```

## Get the number of ERC20 holding tokens `PRO`

Returns the number of ERC-20 holding tokens by an address.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=addresstokencount
   &address=0x983e3660c0bE01991785F80f266A84B911ab59b0
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=addresstokencount&address=0x983e3660c0bE01991785F80f266A84B911ab59b0&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                         |
| --------- | ----------------------------------- |
| address\* | the string representing the address |

#### Sample response

```json
{
    "status":"1",
    "message":"OK",
    "result": "7"
}
```

## Get a list of 'ERC20 - Token Transfer Events' `PRO`

Returns the list of ERC-20 token transfers.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=tokentx
   &startblock=0
   &endblock=1000
   &offset=0
   &limit=10
   &sort=asc
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=tokentx&startblock=0&endblock=1000&offset=0&limit=10&sort=asc&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter  | Description                                                                                                     |
| ---------- | --------------------------------------------------------------------------------------------------------------- |
| startblock | the integer block number to start searching for transactions                                                    |
| endblock   | the integer block number to stop searching for transactions                                                     |
| offset     | skips the `offset` records before beginning to return the records, default value is `0`                         |
| limit      | the number of records displayed per page, default value is `10000`                                              |
| sort       | the sorting preference, use `asc` to sort by ascending and `desc` to sort by descending, default value is `asc` |

#### Sample response

```json
{
    "status":"1",
    "message":"OK",
    "result":[
        {
            "blockNumber":"4730207",
            "index": 0,
            "timeStamp":"1513240363",
            "hash":"0xe8c208398bd5ae8e4c237658580db56a2a94dfa0ca382c99b776fa6e7d31d5b4",
            "nonce":"406",
            "blockHash":"0x022c5e6a3d2487a8ccf8946a2ffb74938bf8e5c8a3f6d91b41c56378a96b5c37",
            "from":"0x642ae78fafbb8032da552d619ad43f1d81e4dd7c",
            "contractAddress":"0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2",
            "to":"0x4e83362442b8d1bec281594cea3050c8eb01311c",
            "value":"5901522149285533025181",
            "tokenName":"Maker",
            "tokenSymbol":"MKR",
            "tokenDecimal":"18",
            "tokenPriceUSD": "1123.78",
            "transactionIndex":"81",
            "gas":"940000",
            "gasPrice":"32010000000",
            "gasUsed":"77759",
            "cumulativeGasUsed":"2523379",
            "input":"deprecated",
            "confirmations":"7968350",
            "methodId": "0xa9059cbb",
            "functionName": "transfer(address _to, uint256 _value)"
        },
        {
            "blockNumber":"4764973",
            "index": 0,
            "timeStamp":"1513764636",
            "hash":"0x9c82e89b7f6a4405d11c361adb6d808d27bcd9db3b04b3fb3bc05d182bbc5d6f",
            "nonce":"428",
            "blockHash":"0x87a4d04a6d8fce7a149e9dc528b88dc0c781a87456910c42984bdc15930a2cac",
            "from":"0x4e83362442b8d1bec281594cea3050c8eb01311c",
            "contractAddress":"0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2",
            "to":"0x69076e44a9c70a67d5b79d95795aba299083c275",
            "value":"132520488141080",
            "tokenName":"Maker",
            "tokenSymbol":"MKR",
            "tokenDecimal":"18",
            "tokenPriceUSD": "1123.78",
            "transactionIndex":"167",
            "gas":"940000",
            "gasPrice":"35828000000",
            "gasUsed":"127593",
            "cumulativeGasUsed":"6315818",
            "input":"deprecated",
            "confirmations":"7933584",
            "methodId": "0xa9059cbb",
            "functionName": "transfer(address _to, uint256 _value)"
        }
    ]
}
```

## Get the total number of token transactions `PRO`

Returns the total number of token transactions.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=tokentxcount
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=tokentxcount&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": "7431297"
}
```

## Get a list of 'ERC20 - Token Approvals' `PRO`

Returns the list of ERC-20 token approvals.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=tokenapproval
   &owner=0x7d71f82611ba86bc302a655ec3d2050e98baf49c
   &contractaddress=0x306000d966a28ca768e2a3b84b63a7bcf4cca58a
   &offset=0
   &limit=1
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=tokenapproval&owner=0x7d71f82611ba86bc302a655ec3d2050e98baf49c&contractaddress=0x306000d966a28ca768e2a3b84b63a7bcf4cca58a&offset=0&limit=1&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter       | Description                                                                             |
| --------------- | --------------------------------------------------------------------------------------- |
| owner           | the string representing the address of the token owner                                  |
| spender         | the string representing the address of the token spender                                |
| contractaddress | the contract address of the ERC-20 token                                                |
| offset          | skips the `offset` records before beginning to return the records, default value is `0` |
| limit           | the number of records displayed per page, default value is `10000`                      |

**Note:** You must specify at least one of the following parameters: `owner`, `spender`, or `contractaddress`. Approvals are returned in reverse chronological order.

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "blockNumber": "4663",
            "contractAddress": "0x306000d966a28ca768e2a3b84b63a7bcf4cca58a",
            "hash": "0xfcadea3e4de19fe4a17a15fda09fac6c95195648809efb7aa14bc9133de78845",
            "index": "0",
            "owner": "0x7d71f82611ba86bc302a655ec3d2050e98baf49c",
            "spender": "0xcbccce385ad801376b31d6038eee3d3a7e8f7351",
            "timestamp": "1748989380",
            "tokenDecimal": "18",
            "tokenName": "Test Graphite Token",
            "tokenPriceUSD": null,
            "tokenSymbol": "TGT",
            "transactionIndex": "0",
            "value": "22000000000000000000"
        }
    ]
}
```

## Get the most recent 'ERC20 - Token Approvals' `PRO`

Returns a list of the latest ERC-20 token approvals.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=latestapproval
   &owner=0x7d71f82611ba86bc302a655ec3d2050e98baf49c
   &contractaddress=0x306000d966a28ca768e2a3b84b63a7bcf4cca58a
   &includezero=true
   &offset=0
   &limit=1
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=latestapproval&owner=0x7d71f82611ba86bc302a655ec3d2050e98baf49c&contractaddress=0x306000d966a28ca768e2a3b84b63a7bcf4cca58a&includezero=true&offset=0&limit=1&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter       | Description                                                                                      |
| --------------- | ------------------------------------------------------------------------------------------------ |
| owner           | the string representing the address of the token owner                                           |
| spender         | the string representing the address of the token spender                                         |
| contractaddress | the contract address of the ERC-20 token                                                         |
| includezero     | the boolean flag (`true` or `false`) for including zero value approvals, default value is `true` |
| offset          | skips the `offset` records before beginning to return the records, default value is `0`          |
| limit           | the number of records displayed per page, default value is `10000`                               |

**Note:** You must specify at least one of the following parameters: `owner`, `spender`, or `contractaddress`.

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "blockNumber": "4663",
            "contractAddress": "0x306000d966a28ca768e2a3b84b63a7bcf4cca58a",
            "hash": "0xfcadea3e4de19fe4a17a15fda09fac6c95195648809efb7aa14bc9133de78845",
            "index": "0",
            "owner": "0x7d71f82611ba86bc302a655ec3d2050e98baf49c",
            "spender": "0xcbccce385ad801376b31d6038eee3d3a7e8f7351",
            "timestamp": "1748989380",
            "tokenDecimal": "18",
            "tokenName": "Test Graphite Token",
            "tokenPriceUSD": null,
            "tokenSymbol": "TGT",
            "transactionIndex": "0",
            "value": "22000000000000000000"
        }
    ]
}
```


# Transactions

## Get transaction info

Returns transaction info of a given transaction hash.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=transaction
   &action=gettxinfo
   &txhash=0x6e3bcabae8fd17c4f4e3dc2ee6346a89fa5542881d6e5cccb68a5d6732aa3f08
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=transaction&action=gettxinfo&txhash=0x6e3bcabae8fd17c4f4e3dc2ee6346a89fa5542881d6e5cccb68a5d6732aa3f08&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                         |
| --------- | ----------------------------------- |
| txhash\*  | hash of contents of the transaction |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": {
        "blockHash": "0xf8e5da60865d0b9d47bb4e0cf99098c771515ec562d12b5f7e2b2946542867b0",
        "blockNumber": "41330",
        "confirmations": "1710509",
        "contractAddress": null,
        "cumulativeGasUsed": "188184",
        "decoded": null,
        "epAddress": null,
        "fee": "3387312000000000",
        "from": "0x0aea70d72d5e2218cf9af28410ed388ae03b799b",
        "functionName": null,
        "gas": "188184",
        "gasPrice": "18000000000",
        "gasUsed": "188184",
        "hash": "0x6e3bcabae8fd17c4f4e3dc2ee6346a89fa5542881d6e5cccb68a5d6732aa3f08",
        "input": "0x1a7106730000000000000000000000000000000000000000000000000000000000000003bc0824f80393007f7b83ddc99acedc64179087302cb0d57fba79cf88719b524a",
        "isError": "0",
        "methodId": "0x1a710673",
        "nonce": "46119",
        "receiptStatus": "1",
        "revertReason": null,
        "timeStamp": "1702561026",
        "to": "0x0000000000000000000000000000000000001001",
        "transactionIndex": "0",
        "type": "0",
        "value": "0"
    }
}
```

## Get info for multiple transactions in a single call

Returns transaction info from a list of transaction hashes (maximum of 20 transactions per call).

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=transaction
   &action=gettxinfomulti
   &txhash=0x7eea5123ad91e4c21a3177cb50f7f6f6287fea52a602f6effb93759d29c6578d,0x804bf3159f80f6bf46ff9daf5f8f73c8111c1d9a16054f67935035135ade8342
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=transaction&action=gettxinfomulti&txhash=0x7eea5123ad91e4c21a3177cb50f7f6f6287fea52a602f6effb93759d29c6578d,0x804bf3159f80f6bf46ff9daf5f8f73c8111c1d9a16054f67935035135ade8342&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                                                              |
| --------- | ------------------------------------------------------------------------ |
| txhash\*  | the strings representing the hash to check for balance, separated by `,` |

#### Sample response

```json
{
    "status": "1",
    "message": "OK-Missing/Invalid API Key, free rate limit applied",
    "result": [
        {
            "blockHash": "0x5dfeb2237099456093fe9def81d145ec5d80bff57baeb5a9c748bd82b12afc6c",
            "blockNumber": "1751915",
            "confirmations": "122",
            "contractAddress": null,
            "cumulativeGasUsed": "21000",
            "decoded": null,
            "epAddress": null,
            "fee": "378000000000000",
            "from": "0x0aea70d72d5e2218cf9af28410ed388ae03b799b",
            "functionName": null,
            "gas": "26000",
            "gasPrice": "18000000000",
            "gasUsed": "21000",
            "hash": "0x7eea5123ad91e4c21a3177cb50f7f6f6287fea52a602f6effb93759d29c6578d",
            "input": "0x",
            "isError": "0",
            "methodId": null,
            "nonce": "1854378",
            "receiptStatus": "1",
            "revertReason": null,
            "timeStamp": "1726236825",
            "to": "0x0000000000000000000000000000000000000000",
            "transactionIndex": "0",
            "type": "0",
            "value": "864325134364028"
        },
        {
            "blockHash": "0x928b87e92fbb24f22e795c4ed12ffa5780679c3a2aa4de90714041803bf61cb5",
            "blockNumber": "1751916",
            "confirmations": "121",
            "contractAddress": null,
            "cumulativeGasUsed": "21000",
            "decoded": null,
            "epAddress": null,
            "fee": "378000000000000",
            "from": "0x0aea70d72d5e2218cf9af28410ed388ae03b799b",
            "functionName": null,
            "gas": "26000",
            "gasPrice": "18000000000",
            "gasUsed": "21000",
            "hash": "0x804bf3159f80f6bf46ff9daf5f8f73c8111c1d9a16054f67935035135ade8342",
            "input": "0x",
            "isError": "0",
            "methodId": null,
            "nonce": "1854379",
            "receiptStatus": "1",
            "revertReason": null,
            "timeStamp": "1726236837",
            "to": "0x0000000000000000000000000000000000000000",
            "transactionIndex": "0",
            "type": "0",
            "value": "9089481279288811"
        }
    ]
}
```

## Get the total number of confirmed transactions

Returns the total number of confirmed transactions.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=transaction
   &action=gettotaltxcount
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=transaction&action=gettotaltxcount&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": "1854644"
}
```

## Get pending transactions

Returns a list of pending transactions.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=transaction
   &action=pendingtxlist
   &offset=0
   &limit=10
   &sort=asc
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=transaction&action=pendingtxlist&offset=0&limit=10&sort=asc&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                                                                                                     |
| --------- | --------------------------------------------------------------------------------------------------------------- |
| offset    | skips the `offset` records before beginning to return the records, default value is `0`                         |
| limit     | the number of records displayed per page, default value is `10000`                                              |
| sort      | the sorting preference, use `asc` to sort by ascending and `desc` to sort by descending, default value is `asc` |

#### Sample response

```json
{
   "status": "1",
   "message": "OK",
   "result": [
        {
            "blockHash": "0xe495e264658553da8f84a67c0cc0cf5c8178ec1f8de0b0a57475cebd74a2377b",
            "blockNumber": "17573",
            "confirmations": "1734512",
            "contractAddress": null,
            "cumulativeGasUsed": "21000",
            "decoded": null,
            "epAddress": null,
            "fee": "378000000000000",
            "from": "0x0aea70d72d5e2218cf9af28410ed388ae03b799b",
            "functionName": null,
            "gas": "26000",
            "gasPrice": "18000000000",
            "gasUsed": "21000",
            "hash": "0xceeb761a5ab7962096f1b5dc2ce54379b0142c18d023b208815a86df82a14db4",
            "input": "0x",
            "isError": "0",
            "methodId": null,
            "nonce": "21777",
            "receiptStatus": "1",
            "revertReason": null,
            "timeStamp": "1702244586",
            "to": "0x0000000000000000000000000000000000000000",
            "transactionIndex": "0",
            "type": "0",
            "value": "8084928199013178"
        }
    ]
}
```

## Get the number of pending transactions

Returns the number of pending transactions.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=transaction
   &action=pendingtxcount
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=transaction&action=pendingtxcount&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": "1"
}
```

## Get a list of 'normal' transactions

Returns the list of 'normal' transactions.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=transaction
   &action=txlist
   &startblock=17563
   &endblock=17573
   &offset=10
   &limit=10
   &sort=asc
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=transaction&action=txlist&startblock=17563&endblock=17573&offset=10&limit=10&sort=asc&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter  | Description                                                                                                     |
| ---------- | --------------------------------------------------------------------------------------------------------------- |
| startblock | the integer block number to start searching for transactions, default value is `0`                              |
| endblock   | the integer block number to stop searching for transactions, default value is `1'000'000'000`                   |
| offset     | skips the `offset` records before beginning to return the records, default value is `0`                         |
| limit      | the number of records displayed per page, default value is `10000`                                              |
| sort       | the sorting preference, use `asc` to sort by ascending and `desc` to sort by descending, default value is `asc` |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "blockHash": "0xe495e264658553da8f84a67c0cc0cf5c8178ec1f8de0b0a57475cebd74a2377b",
            "blockNumber": "17573",
            "confirmations": "1734512",
            "contractAddress": null,
            "cumulativeGasUsed": "21000",
            "decoded": null,
            "epAddress": null,
            "fee": "378000000000000",
            "from": "0x0aea70d72d5e2218cf9af28410ed388ae03b799b",
            "functionName": null,
            "gas": "26000",
            "gasPrice": "18000000000",
            "gasUsed": "21000",
            "hash": "0xceeb761a5ab7962096f1b5dc2ce54379b0142c18d023b208815a86df82a14db4",
            "input": "0x",
            "isError": "0",
            "methodId": null,
            "nonce": "21777",
            "receiptStatus": "1",
            "revertReason": null,
            "timeStamp": "1702244586",
            "to": "0x0000000000000000000000000000000000000000",
            "transactionIndex": "0",
            "type": "0",
            "value": "8084928199013178"
        }
    ]
}
```

## Get a list of 'internal' transactions by transaction hash

Returns the list of internal transactions performed within a transaction.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=transaction
   &action=txlistinternal
   &txhash=0xf63190705bd6459ca40b87b1374ec1a156e0408f7dc73469ea2506e08873b59b
   &includezero=true
   &offset=10
   &limit=10
   &sort=asc
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=transaction&action=txlistinternal&txhash=0xf63190705bd6459ca40b87b1374ec1a156e0408f7dc73469ea2506e08873b59b&includezero=true&offset=10&limit=10&sort=asc&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter   | Description                                                                                                     |
| ----------- | --------------------------------------------------------------------------------------------------------------- |
| txhash\*    | the string representing the transaction hash to check for internal transactions                                 |
| includezero | the boolean flag (`true` or `false`) for including zero value internal transactions, default value is `true`    |
| offset      | skips the `offset` records before beginning to return the records, default value is `0`                         |
| limit       | the number of records displayed per page, default value is `10000`                                              |
| sort        | the sorting preference, use `asc` to sort by ascending and `desc` to sort by descending, default value is `asc` |

#### Sample response

```json
{   
    "status": "1",
    "message": "OK",
    "result": [
        {
            "blockNumber": "1638541",
            "callType": "call",
            "contractAddress": null,
            "errCode": null,
            "from": "0x0000000000000000000000000000000000001001",
            "gas": "2904460",
            "gasUsed": "4467",
            "hash": "0xf63190705bd6459ca40b87b1374ec1a156e0408f7dc73469ea2506e08873b59b",
            "index": "0",
            "input": "0xf340fa010000000000000000000000008d8129f2f56d87f39a3dea1ba33a3bd930849f81",
            "isError": "0",
            "timeStamp": "1724674248",
            "to": "0x0000000000000000000000000000000000001003",
            "traceId": "0",
            "transactionIndex": "0",
            "type": "call",
            "value": "0"
        }
    ]
}
```

## Get a list of 'internal' transactions by block range

Returns the list of internal transactions performed within block range.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=transaction
   &action=txlistinternal
   &startblock=1638541
   &endblock=1638542
   &offset=10
   &limit=10
   &sort=desc
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=transaction&action=txlistinternal&startblock=1638541&endblock=1638542&offset=10&limit=10&sort=desc&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter    | Description                                                                                                     |
| ------------ | --------------------------------------------------------------------------------------------------------------- |
| startblock\* | the integer block number to start searching for transactions                                                    |
| endblock\*   | the integer block number to stop searching for transactions                                                     |
| offset       | skips the `offset` records before beginning to return the records, default value is `0`                         |
| limit        | the number of records displayed per page, default value is `10000`                                              |
| sort         | the sorting preference, use `asc` to sort by ascending and `desc` to sort by descending, default value is `asc` |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "blockNumber": "1638541",
            "callType": "call",
            "contractAddress": null,
            "errCode": null,
            "from": "0x0000000000000000000000000000000000001001",
            "gas": "2904460",
            "gasUsed": "4467",
            "hash": "0xf63190705bd6459ca40b87b1374ec1a156e0408f7dc73469ea2506e08873b59b",
            "index": "0",
            "input": "0xf340fa010000000000000000000000008d8129f2f56d87f39a3dea1ba33a3bd930849f81",
            "isError": "0",
            "timeStamp": "1724674248",
            "to": "0x0000000000000000000000000000000000001003",
            "traceId": "0",
            "transactionIndex": "0",
            "type": "call",
            "value": "0"
        }
    ]
}
```

## Get a number of internal transaction for a transaction

Returns the number of internal transaction for a transaction by its hash.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=transaction
   &action=getinternaltxcount
   &txhash=0xf63190705bd6459ca40b87b1374ec1a156e0408f7dc73469ea2506e08873b59b
   &includezero=true
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=transaction&action=getinternaltxcount&txhash=0xf63190705bd6459ca40b87b1374ec1a156e0408f7dc73469ea2506e08873b59b&includezero=true&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter   | Description                                                                                                  |
| ----------- | ------------------------------------------------------------------------------------------------------------ |
| txhash\*    | the string representing the transaction hash to check for internal transactions                              |
| includezero | the boolean flag (`true` or `false`) for including zero value internal transactions, default value is `true` |

#### Sample response

```json
{
   "status": "1",
   "message": "OK",
   "result": "1" 
}
```

## Get a list of 'ERC20 - Token Transfer Events' by hash

Returns the list of ERC-20 tokens transferred by hash.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=transaction
   &action=tokentx
   &hash=0xd2743ca301ecda403a9a4c4ccfbdca5126aff03f30dcbb5a360f12cf78405c84
   &offset=0
   &limit=10
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=transaction&action=tokentx&hash=0xd2743ca301ecda403a9a4c4ccfbdca5126aff03f30dcbb5a360f12cf78405c84&offset=0&limit=10&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                                                                             |
| --------- | --------------------------------------------------------------------------------------- |
| hash\*    | the string representing the transaction hash                                            |
| offset    | skips the `offset` records before beginning to return the records, default value is `0` |
| limit     | the number of records displayed per page, default value is `10000`                      |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "blockHash": "0x9912251ac1f1d6e79cb2156ebd76ae3181c92f9409a6606ca14daa21843f8583",
            "blockNumber": "1732506",
            "confirmations": 19710,
            "contractAddress": "0x8043763af8e103b693e822dae4ccfd70924f6b9e",
            "cumulativeGasUsed": "2702601",
            "from": "0x0000000000000000000000000000000000000000",
            "gas": "2702601",
            "gasPrice": "18000000000",
            "gasUsed": "2702601",
            "hash": "0xd2743ca301ecda403a9a4c4ccfbdca5126aff03f30dcbb5a360f12cf78405c84",
            "index": "0",
            "nonce": "18",
            "timeStamp": "1725971040",
            "to": "0xf8a673a3c162ab71cfb2629beb049289408f8ee3",
            "tokenDecimal": "18",
            "tokenName": "MyToken",
            "tokenPriceUSD": null,
            "tokenSymbol": "MTK",
            "transactionIndex": "0",
            "value": "10000000000000000000"
        }
    ]
}
```

## Get a number of 'ERC20 - Token Transfer Events' by hash

Returns the number of ERC-20 tokens transferred by hash.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=transaction
   &action=tokentxcount
   &hash=0xd2743ca301ecda403a9a4c4ccfbdca5126aff03f30dcbb5a360f12cf78405c84
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=transaction&action=tokentxcount&hash=0xd2743ca301ecda403a9a4c4ccfbdca5126aff03f30dcbb5a360f12cf78405c84&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                                  |
| --------- | -------------------------------------------- |
| hash\*    | the string representing the transaction hash |

#### Sample response

```json
{
   "status": "1",
   "message": "OK",
   "result": "1" 
}
```

## Get a list of transactions by called contract method

Returns the list of transaction hashes by called contract method identifier, always sorted by block number in descending order.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=transaction
   &action=gettxsbymethod
   &methodid=0x90ec8f7e
   &offset=0
   &limit=10
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=transaction&action=gettxsbymethod&methodid=0x90ec8f7e&offset=0&limit=10&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter  | Description                                                                             |
| ---------- | --------------------------------------------------------------------------------------- |
| methodid\* | the hex string representing the method id (4 bytes)                                     |
| offset     | skips the `offset` records before beginning to return the records, default value is `0` |
| limit      | the number of records displayed per page, default value is `10000`                      |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        "0xcb23dee75e98420005a46600b213542103ff3221f2627a03c882ddd3eb845d5d",
        "0xee677992aa8d38df0d58693c6cae0e7aedcb12a01de3ef3454126136f2c1ef54",
        "0x33b8b5859bd15882188e9a173cc8862ab181df29fe1de5e675ae78c3d46114e3",
        "0xc8b536d1f7a1375a1b960d443a40b988b1e353a3f78afe40cd7194e563bfb349",
        "0x4d7419272b47dc895ebdd7a452efc3e538123bda113d9985051a233c1797c91b"
    ]
}
```


# WebSocket

## Connection URL

```
wss://api.main.atgraphite.com/ws
```

Once the socket is open, you can subscribe or unsubscribe from a topic by sending requests.

## Subscribing to new block headers

Sends an update each time a new block is appended to the chain.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```json
{
    "method": "subscribe",
    "params": {
        "topic": "blocks"
    }
}
```

{% endtab %}

{% tab title="Inline" %}

```bash
'{"method":"subscribe","params":{"topic":"blocks"}}'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                  |
| --------- | ---------------------------- |
| method\*  | `subscribe` or `unsubscribe` |

#### Sample response

```json
{
    "method": "subscribe",
    "result": {
        "topic": "blocks"
    },
    "success": true
}
```

#### Sample update response

```json
{
    "topic": "blocks",
    "data": {
        "confirmations": "0",
        "decodedExtraData": {
            "awn": 3899,
            "signature": "0xfa29ec77110e0cc3733326b0d195b96f186854a8f4e16b10f54aef1645aaec0e07410caef3fea4464c968707508c3138772d5bea3753d6b92d2886cc675d2df800",
            "vanity": "0x6d61696e6e65742d76616c696461746f722d362d657500000000000000000000"
        },
        "difficulty": "0x01",
        "epoch": false,
        "extraData": "0x6d61696e6e65742d76616c696461746f722d362d65750000000000000000000000000000000000000f3bfa29ec77110e0cc3733326b0d195b96f186854a8f4e16b10f54aef1645aaec0e07410caef3fea4464c968707508c3138772d5bea3753d6b92d2886cc675d2df800",
        "gasLimit": "0xbebc200",
        "gasUsed": "0x5208",
        "gasUsedPercentage": "0.010500",
        "hash": "0x4b3eef2671c3395d3b2958330af6b9bad57907e196d874147b06bd8b88f449a1",
        "internalTransactionCount": "0",
        "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "miner": "0xddca5562cf3914e6815c87746109f478a46a6373",
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "nonce": "0x0100000000000000",
        "number": "0x22d",
        "parentHash": "0x967e2f106a034bf5df2e1ed85c2a78e359fd4b041be1e749e5f4d0bc8cfa0858",
        "receiptsRoot": "0x962005faf1c6a68f940ece9b33cdb5baf7875b5fa60ba34f1b110adfb2872bc5",
        "reward": "4200000000000000",
        "size": "0x2e4",
        "slashingVote": null,
        "stateRoot": "0x714531b9b07d229abcd934f858c16348773156e364c9f4526192d17f3c209d38",
        "timestamp": "0x6790c7e5",
        "totalDifficulty": "0x022e",
        "transactionCount": "1",
        "transactionFees": "4200000000000000",
        "transactionsRoot": "0x8104e51285600c04a1ea494209851e1fa61578e4d756372499eaf760be8740a2"
    }
}
```

## Subscribing to new pending transactions

Sends an update each time a new transaction is appended to the mempool.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```json
{
    "method": "subscribe",
    "params": {
        "topic": "mempool"
    }
}
```

{% endtab %}

{% tab title="Inline" %}

```bash
'{"method":"subscribe","params":{"topic":"mempool"}}'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                  |
| --------- | ---------------------------- |
| method\*  | `subscribe` or `unsubscribe` |

#### Sample response

```json
{
    "method": "subscribe",
    "result": {
        "topic": "mempool"
    },
    "success": true
}
```

#### Sample update response

```json
{
    "topic": "mempool",
    "data": {
        "from": "0x58af7455c7b23d246b62ccc0b9640ac1d4911761",
        "functionName": null,
        "gasPrice": "0",
        "hash": "0xf8f8ef28a7972aa7bd87d6203decc7c573da5787ccd71a31e52b3a3c47410692",
        "methodId": null,
        "timeStamp": "1737542831",
        "to": "0x12652c6d93fdb6f4f37d48a8687783c782bb0d10",
        "type": "0",
        "value": "0"
    }
}
```

## Subscribing to new confirmed transactions

Sends update with transactions from each new block as soon as it is appended to the chain.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```json
{
    "method": "subscribe",
    "params": {
        "topic": "transactions",
        "from": "0x5b0fda57971f09d3ac8fc4a037930a88174ec8bc",
        "to": "0x0000000000000000000000000000000000001105"
    }
}
```

{% endtab %}

{% tab title="Inline" %}

```bash
'{"method":"subscribe","params":{"topic":"transactions","from":"0x5b0fda57971f09d3ac8fc4a037930a88174ec8bc","to":"0x0000000000000000000000000000000000001105"}}'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                                  |
| --------- | -------------------------------------------- |
| method\*  | `subscribe` or `unsubscribe`                 |
| from      | string with the transaction sender address   |
| to        | string with the transaction receiver address |

**Note:** The `from` and `to` parameters are optional. They can be used together, separately, or not provided at all.

#### Sample response

```json
{
    "method": "subscribe",
    "result": {
        "from": "0x5b0fda57971f09d3ac8fc4a037930a88174ec8bc",
        "to": "0x0000000000000000000000000000000000001105",
        "topic": "transactions"
    },
    "success": true
}
```

#### Sample update response

```json
{
    "data": {
        "blockNumber": "1650870",
        "fee": "26681000000000000",
        "from": "0x5b0fda57971f09d3ac8fc4a037930a88174ec8bc",
        "functionName": "transfer(address _to, uint256 _value)",
        "gasPrice": "200000000000",
        "gasUsed": "133405",
        "hash": "0xed09fd81515f8cf83fbdaa73cdc16a761bcc967d4bd949ab5f7ca1fe69d85ee9",
        "methodId": "0xa9059cbb",
        "timeStamp": "1756461192",
        "to": "0x0000000000000000000000000000000000001105",
        "type": "0",
        "value": "0"
    },
    "topic": "transactions"
}
```


