# Quai RPC API

In addition to the custom [RPC endpoints documented here](https://docs.quaiscan.io/developer-support/api/rpc-endpoints), the Quaiscan Quai RPC API supports most used methods in the exact format specified for Quai Network nodes, see the [Quai Network JSON-RPC Specification](https://docs.qu.ai/build/playground/overview) for more details.

These methods are provided for your convenience and are most suitable as a fallback option in your JSON RPC API providers. For other use cases, REST or custom RPC methods are recommended.

The following methods are supported:

* quai\_blockNumber
* quai\_getBalance
* quai\_getLogs
* quai\_gasPrice
* quai\_getTransactionByHash
* quai\_getTransactionReceipt
* quai\_chainId
* quai\_maxPriorityFeePerGas
* quai\_getTransactionCount
* quai\_getCode
* quai\_getStorageAt
* quai\_estimateGas
* quai\_getBlockByNumber
* quai\_getBlockByHash
* quai\_sendRawTransaction
* quai\_call

In the following examples we use the Quai Network mainnet with the base instance url `https://quaiscan.io`. When sending a request add `/api/eth-rpc` to the end of the base url.

## quai\_blockNumber

Returns the latest block number in the chain in hexidecimal format. No params are needed.\
Type: <mark style="background-color:green;">POST</mark>

**Example**

{% code overflow="wrap" %}

```json
// Request
curl -H "content-type: application/json" -X POST --data '{"id":0,"jsonrpc":"2.0","method":"quai_blockNumber","params":[]}' https://quaiscan.io/api/eth-rpc
// Response
{
  "jsonrpc": "2.0",
  "result": "0xfa0b0e",
  "id": 0
}
```

{% endcode %}

## quai\_getBalance

Returns the balance of a given address in its. Note the `earliest` parameter does not work as expected because genesis block balances are not currently imported. Parameters are required.

**Required Parameters**

<table><thead><tr><th width="130.5"></th><th></th></tr></thead><tbody><tr><td>Type</td><td><mark style="background-color:green;">POST</mark></td></tr><tr><td>Data (string)</td><td>20 Byte address to check balance</td></tr><tr><td>Quantity or Tag (string)</td><td>Integer value of a block number, or a tag "latest" for the most recent block.</td></tr></tbody></table>

**Example**

{% code overflow="wrap" %}

```json
// Request
curl -H "content-type: application/json" -X POST --data '{"id":0,"jsonrpc":"2.0","method":"quai_getBalance","params":["0x005f644097F8f0E9f996Dca4F4F23aBB6C1Cc8b3","latest"]}' https://quaiscan.io/api/eth-rpc
// Response
{
  "jsonrpc": "2.0",
  "result": "0x1d863bf76508104fb", //34039260923474019579
  "id": 0
}

```

{% endcode %}

## More examples

Refer to the [Quai Network JSON-RPC Specification](https://docs.qu.ai/build/playground/overview) for more examples and info on the remaining methods.
