> For the complete documentation index, see [llms.txt](https://bitroot.gitbook.io/bitroot/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bitroot.gitbook.io/bitroot/reference/bitroots-evm-rpc.md).

# Bitroot's EVM RPC

Bitroot supports the standard [Ethereum JSON-RPC API](https://ethereum.org/en/developers/docs/apis/json-rpc/)

#### Standard endpoints <a href="#standard-endpoints" id="standard-endpoints"></a>

* Request
  * HTTP method: always “GET”.
  * header: `accept: application/json`
  * header: `content-type: application/json`
  * body (JSON):
  * id: an arbitrary string identifier.
  * jsonrpc: always “2.0”.
  * method: endpoint name (e.g. “eth\_sendRawTransaction”).
  * params: an array that differs from endpoint to endpoint.
* Response
  * body (JSON):
  * id: the same identifier in request.
  * jsonrpc: always “2.0”.
  * result: an object that differs from endpoint to endpoint.

#### Send Transactions <a href="#send-transactions" id="send-transactions"></a>

***

**eth\_sendRawTransaction**<br>

Sends a signed transaction.

* **Parameters**:

| Type   | Description                                 |
| ------ | ------------------------------------------- |
| string | The hex-encoding of the signed transaction. |

**Result**:

| Type   | Description           |
| ------ | --------------------- |
| string | The transaction hash. |

**bitroot\_associate**

Sends a transaction to establish association between the signer’s Bitroot address and EVM address on-chain.

* **Parameters**:

| Type   | Description                                                                        |
| ------ | ---------------------------------------------------------------------------------- |
| object | A custom object containing a string message and the v, r, s of the signed message. |

Object Schema:

```
{
    custom_message: // Any string message
    r: // The R-part of the signature over the Keccak256 hash of the custom message.
    s: // The S-part of the signature over the Keccak256 hash of the custom message.
    v: // The V-part of the signature over the Keccak256 hash of the custom message.
}
```

#### Transaction Lookup <a href="#transaction-lookup" id="transaction-lookup"></a>

***

**eth\_getTransactionReceipt**

Gets the receipt of a sent transaction

* **Parameters**:

| Type   | Description           |
| ------ | --------------------- |
| string | The transaction hash. |

\
**Result**:

| Type   | Description                                                                                              |
| ------ | -------------------------------------------------------------------------------------------------------- |
| object | The [receipt object ](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactionreceipt). |

\
**eth\_getTransactionByBlockNumberAndIndex**

Gets transaction by the block number and the index of the transaction in the block

* **Parameters**:

<table><thead><tr><th width="174.39999389648438">Type</th><th>Description</th></tr></thead><tbody><tr><td>string</td><td>The block number, which can either be a hexadecimal number, or one of “safe”, “finalized”, “latest”, or “earliest”. Note that “safe”, “finalized”, and “latest” mean the same thing on Bitroot due to its instant finality.</td></tr><tr><td>string</td><td>The transaction index as a hexadecimal number.</td></tr></tbody></table>

* **Result**:

| Type   | Description                                                                                                  |
| ------ | ------------------------------------------------------------------------------------------------------------ |
| object | The [transaction details ](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactionbyhash). |

**eth\_getTransactionByBlockHashAndIndex**

Gets transaction by the block hash and the index of the transaction in the block.

* **Parameters**:

| Type   | Description                                    |
| ------ | ---------------------------------------------- |
| string | The block hash.                                |
| string | The transaction index as a hexadecimal number. |

* **Result**:

| Type   | Description                                                                                                  |
| ------ | ------------------------------------------------------------------------------------------------------------ |
| object | The [transaction details ](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactionbyhash). |

**eth\_getTransactionByHash**

Gets transaction by the transaction hash.

* **Parameters**:

| Type   | Description           |
| ------ | --------------------- |
| string | The transaction hash. |

* **Result**:

| Type   | Description                                                                                                  |
| ------ | ------------------------------------------------------------------------------------------------------------ |
| object | The [transaction details ](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactionbyhash). |

#### Account Information <a href="#account-information" id="account-information"></a>

***

**eth\_getTransactionCount**

Gets the number of transactions sent by the account

* **Parameters**:

| Type   | Description                                                                                                                                                                                                             |
| ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| string | The address to look up.                                                                                                                                                                                                 |
| string | The block number, which can either be a hexadecimal number, or one of “safe”, “finalized”, “latest”, or “earliest”. Note that “safe”, “finalized”, and “latest” mean the same thing on Sei due to its instant finality. |

* **Result**:

| Type   | Description                                         |
| ------ | --------------------------------------------------- |
| string | The hexadecimal form of the number of transactions. |

**eth\_getBalance**

Gets the balance in wei (i.e. 10^-12 ubrt) of the account

* **Parameters**:

| Type   | Description                                                                                                                                                                                                                                                      |
| ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| string | The address to look up.                                                                                                                                                                                                                                          |
| string |                                                                                                                                                                                                                                                                  |
|        | The block number or hash, which can be one of 1. block hash, 2. hexadecimal block number, 3. one of “safe”, “finalized”, “latest”, “pending”, or “earliest”. Note that “safe”, “finalized”, and “latest” mean the same thing on Sei due to its instant finality. |

* **Result**:

| Type   | Description                              |
| ------ | ---------------------------------------- |
| string | The hexadecimal form of the wei balance. |

**eth\_getCode**

Gets EVM code stored at the account address

* **Parameters**:

| Type   | Description                                                                                                                                                                                                                                                      |
| ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| string | The address to look up.                                                                                                                                                                                                                                          |
| string | The block number or hash, which can be one of 1. block hash, 2. hexadecimal block number, 3. one of “safe”, “finalized”, “latest”, “pending”, or “earliest”. Note that “safe”, “finalized”, and “latest” mean the same thing on Sei due to its instant finality. |

* **Result**:

| Type   | Description                              |
| ------ | ---------------------------------------- |
| string | The hexadecimal form of the code binary. |

**eth\_getStorageAt**

Gets value at given key of the account

* **Parameters**:

| Type   | Description                                                                                                                                                                                                                                                      |
| ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| string | The address to look up.                                                                                                                                                                                                                                          |
| string | The hexadecimal form of the key.                                                                                                                                                                                                                                 |
| string | The block number or hash, which can be one of 1. block hash, 2. hexadecimal block number, 3. one of “safe”, “finalized”, “latest”, “pending”, or “earliest”. Note that “safe”, “finalized”, and “latest” mean the same thing on Sei due to its instant finality. |

* **Result**:

| Type   | Description                                |
| ------ | ------------------------------------------ |
| string | The hexadecimal form of the storage value. |

**eth\_getProof**

Gets the IAVL proof (note: not a MPT proof) of the given keys for an account.

* **Parameters**:

| Type      | Description                                                                                                                                                                                                                                                      |
| --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| string    | The address to look up.                                                                                                                                                                                                                                          |
| string\[] | The hexadecimal form of the keys.                                                                                                                                                                                                                                |
| string    | The block number or hash, which can be one of 1. block hash, 2. hexadecimal block number, 3. one of “safe”, “finalized”, “latest”, “pending”, or “earliest”. Note that “safe”, “finalized”, and “latest” mean the same thing on Sei due to its instant finality. |

* **Result**:

| Type   | Description                              |
| ------ | ---------------------------------------- |
| object | An object with data from the IAVL proof. |

Object Schema:

```
{
    address: // The requested address.
    hexValues: // An array of the hexdecimal form of the values at the given keys.
    storageProof: // An array of storage proofs.
}
```

#### Block Information <a href="#block-information" id="block-information"></a>

***

**eth\_getBlockTransactionCountByNumber**

Gets the count of EVM transactions (i.e. excluding native Cosmos transactions) in a block by its number.

* **Parameters**:

| Type   | Description                                                                                                                                                                                                                                                  |
| ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| string | The block number, which can be one of 1. block hash, 2. hexadecimal block number, 3. one of “safe”, “finalized”, “latest”, “pending”, or “earliest”. Note that “safe”, “finalized”, and “latest” mean the same thing on Bitroot due to its instant finality. |

* **Result**:

| Type   | Description                        |
| ------ | ---------------------------------- |
| string | The hexadecimal form of the count. |

**eth\_getBlockTransactionCountByHash**

Gets the count of EVM transactions (i.e. excluding native Cosmos transactions) in a block by its hash.

* **Parameters**:

| Type   | Description     |
| ------ | --------------- |
| string | The block hash. |

* **Result**:

| Type   | Description                        |
| ------ | ---------------------------------- |
| string | The hexadecimal form of the count. |

**eth\_getBlockByHash**

Gets the block metadata and/or its EVM transactions by block hash

* **Parameters**:

| Type   | Description                                      |
| ------ | ------------------------------------------------ |
| string | The block hash.                                  |
| bool   | Whether to include transactions in the response. |

* **Result**:

| Type   | Description                                                                                   |
| ------ | --------------------------------------------------------------------------------------------- |
| string | The [block info ](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbyhash). |

**eth\_getBlockByNumber**

Gets the block metadata and/or its EVM transactions by block number.

* **Parameters**:

| Type   | Description                                                                                                                                                                                                                                              |
| ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| string | The block number, which can be one of 1. block hash, 2. hexadecimal block number, 3. one of “safe”, “finalized”, “latest”, “pending”, or “earliest”. Note that “safe”, “finalized”, and “latest” mean the same thing on Sei due to its instant finality. |
| bool   | Whether to include transactions in the response.                                                                                                                                                                                                         |

* **Result**:

| Type   | Description                                                                                   |
| ------ | --------------------------------------------------------------------------------------------- |
| string | The [block info ](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbyhash). |

**eth\_getBlockReceipts**

Gets an array of EVM transaction receipt in a block by block number

* **Parameters**:

| Type   | Description                                                                                                                                                                                                                                              |
| ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| string | The block number, which can be one of 1. block hash, 2. hexadecimal block number, 3. one of “safe”, “finalized”, “latest”, “pending”, or “earliest”. Note that “safe”, “finalized”, and “latest” mean the same thing on Sei due to its instant finality. |

* **Result**:

| Type      | Description                                                                                                       |
| --------- | ----------------------------------------------------------------------------------------------------------------- |
| object\[] | An array of [receipt objects ](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactionreceipt). |

#### Blockchain Information <a href="#blockchain-information" id="blockchain-information"></a>

***

**eth\_blockNumber**

Gets the latest committed block number.

* **Parameters**:

None

* **Result**:

| Type   | Description                               |
| ------ | ----------------------------------------- |
| string | The hexadecimal form of the block number. |

**eth\_chainId**

Gets the chain ID.

* **Parameters**:

None

* **Result**:

| Type   | Description                           |
| ------ | ------------------------------------- |
| string | The hexadecimal form of the chain ID. |

**eth\_coinbase**

Gets the fee collector address.

* **Parameters**:

None

* **Result**:

| Type   | Description                       |
| ------ | --------------------------------- |
| string | The address of the fee collector. |

**eth\_feeHistory**

Gets fee history over the requested block range.

* **Parameters**:

| Type     | Description                                                                                                                                                                                                 |
| -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| string   | The number of blocks to look at, in either decimal or hexadecimal form.                                                                                                                                     |
| string   | The block number, which can either be a hexadecimal number, or one of “safe”, “finalized”, or “latest”. Note that “safe”, “finalized”, and “latest” mean the same thing on Sei due to its instant finality. |
| float\[] | The reward percentiles.                                                                                                                                                                                     |

* **Result**:

| Type   | Description                                     |
| ------ | ----------------------------------------------- |
| object | The fee history over the requested block range. |

**eth\_gasPrice**

Gets the 50% percentile of gas prices in the most recent block.

* **Parameters**:

None

* **Result**:

| Type   | Description                            |
| ------ | -------------------------------------- |
| string | The hexadecimal form of the gas price. |

**net\_version**

Gets the version (equal to Chain ID).

* **Parameters**:

None

* **Result**:

| Type   | Description                          |
| ------ | ------------------------------------ |
| string | The hexadecimal form of the chainID. |

**web3\_clientVersion**

* **Parameters**:

None

* **Result**:

| Type   | Description                     |
| ------ | ------------------------------- |
| string | The RPC node’s runtime version. |

#### Filter Endpoints <a href="#filter-endpoints" id="filter-endpoints"></a>

***

Note that log filters are subject to the following limits by default:

* 10000 logs in one response if block range is open-ended
* 2000 blocks to query over if block range is close-ended

Your RPC provider may tweak these limits.

**eth\_newFilter**

Creates a new log filter for later queries.

* **Parameters**:

| Type   | Description                                                                                   |
| ------ | --------------------------------------------------------------------------------------------- |
| object | The [filter criteria ](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newfilter). |

* **Result**:

| Type   | Description                    |
| ------ | ------------------------------ |
| string | The newly created filter’s ID. |

**eth\_newBlockFilter**

Creates a new block filter for later queries.

* **Parameters**:

None

* **Result**:

| Type   | Description                    |
| ------ | ------------------------------ |
| string | The newly created filter’s ID. |

**eth\_getFilterChanges**

Gets all the updates since the filter was last queried.

* **Parameters**:

| Type   | Description    |
| ------ | -------------- |
| string | The filter ID. |

* **Result**:

| Type                   | Description                                                                                                                                                                                                    |
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| string\[] OR object\[] | For block filters, the result would be an array of block hashes; for log filters, the result would be an array of [log objects ](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterchanges). |

**eth\_getFilterLogs**

Get all logs for a given log filter, including the logs that have been returned before.

* **Parameters**:

| Type   | Description    |
| ------ | -------------- |
| string | The filter ID. |

* **Result**:

| Type      | Description                                                                                              |
| --------- | -------------------------------------------------------------------------------------------------------- |
| object\[] | An array of [log objects ](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterchanges). |

**eth\_getLogs**

Get all logs for the given filter criteria.

* **Parameters**:

| Type   | Description                                                                                   |
| ------ | --------------------------------------------------------------------------------------------- |
| object | The [filter criteria ](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newfilter). |

* **Result**:

| Type      | Description                                                                                              |
| --------- | -------------------------------------------------------------------------------------------------------- |
| object\[] | An array of [log objects ](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterchanges). |

When using this query, the `logIndex` is not unique. These queries are also limited to 2000 blocks or 10,000 logs (whichever comes first). If 10,000 logs are returned, it’s recommended to split and re-run the query in smaller chunks to ensure all logs are captured. There are no warnings when these limits are exceeded.

**eth\_uninstallFilter**

Removes a created filter.

* **Parameters**:

| Type   | Description    |
| ------ | -------------- |
| string | The filter ID. |

* **Result**:

| Type | Description                 |
| ---- | --------------------------- |
| bool | Whether the filter existed. |

#### Simulation Endpoints <a href="#simulation-endpoints" id="simulation-endpoints"></a>

***

**eth\_estimateGas**

Same as [the official specification ](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_estimategas).

**eth\_call**

Same as [the official specification ](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_call).
