# JSON-RPC APIs

## **Introduction**

Taker Chain provides Ethereum compatibility through its **JSON-RPC interface**, enabling developers to interact with the chain using familiar Ethereum tooling and methods. This document outlines the supported Ethereum JSON-RPC methods and provides examples to help you integrate them into your workflows.

For testing, use the Taker Chain TestNet endpoint:

```
https://rpc-testnet.taker.xyz/
```

***

#### **Available Methods**

Below is a list of supported JSON-RPC methods with their descriptions, parameters, and examples:

***

**eth\_accounts**

Returns a list of addresses owned by the client.

**Parameters:**\
None

**Example:**

```bash
curl -X POST https://rpc-testnet.taker.xyz/ \
-H "Content-Type: application/json" \
--data '{
    "jsonrpc":"2.0",
    "method":"eth_accounts",
    "params":[],
    "id":1
}'
```

***

**eth\_blockNumber**

Returns the number of the most recent block.

**Parameters:**\
None

**Example:**

```bash
curl -X POST https://rpc-testnet.taker.xyz/ \
-H "Content-Type: application/json" \
--data '{
    "jsonrpc":"2.0",
    "method":"eth_blockNumber",
    "params":[],
    "id":1
}'
```

***

**eth\_call**

Executes a new message call immediately without creating a transaction.

**Parameters:**

* `transaction object`: The transaction call object:
  * `to` (string): Recipient address of the call (20-byte data string).
  * `data` (string): Hash of the method signature and encoded parameters (data string).
  * Other optional fields like `from`, `gas`, `gasPrice`, `value`, and `blockValue`.

**Example:**

```bash
curl -X POST https://rpc-testnet.taker.xyz/ \
-H "Content-Type: application/json" \
--data '{
    "jsonrpc":"2.0",
    "method":"eth_call",
    "params":[{
        "to": "INSERT_RECIPIENT_ADDRESS",
        "data": "INSERT_ENCODED_CALL"
    }, "INSERT_BLOCK_VALUE"],
    "id":1
}'
```

Replace `INSERT_RECIPIENT_ADDRESS`, `INSERT_ENCODED_CALL`, and `INSERT_BLOCK_VALUE` with appropriate values.

***

**eth\_chainId**

Returns the chain ID used for signing transactions.

**Parameters:**\
None

**Example:**

```bash
curl -X POST https://rpc-testnet.taker.xyz/ \
-H "Content-Type: application/json" \
--data '{
    "jsonrpc":"2.0",
    "method":"eth_chainId",
    "params":[],
    "id":1
}'
```

***

**eth\_estimateGas**

Estimates the gas required for a transaction.

**Parameters:**

* `transaction object`: The transaction call object:
  * `to` (string): Recipient address of the call (20-byte data string).
  * `data` (string): Hash of the method signature and encoded parameters (data string).
  * Other optional fields like `from`, `gas`, `gasPrice`, `value`, and `blockValue`.

**Example:**

```bash
curl -X POST https://rpc-testnet.taker.xyz/ \
-H "Content-Type: application/json" \
--data '{
    "jsonrpc":"2.0",
    "method":"eth_estimateGas",
    "params":[{
        "to": "INSERT_RECIPIENT_ADDRESS",
        "data": "INSERT_ENCODED_FUNCTION_CALL"
    }],
    "id":1
}'
```

Replace `INSERT_RECIPIENT_ADDRESS` and `INSERT_ENCODED_FUNCTION_CALL` with appropriate values.

***

**eth\_gasPrice**

Returns the current gas price in Wei.

**Parameters:**\
None

**Example:**

```bash
curl -X POST https://rpc-testnet.taker.xyz/ \
-H "Content-Type: application/json" \
--data '{
    "jsonrpc":"2.0",
    "method":"eth_gasPrice",
    "params":[],
    "id":1
}'
```

***

**eth\_getBalance**

Returns the balance of a given address.

**Parameters:**

* `address` (string): Address to query balance (20-byte data string).
* `blockValue` (string): (Optional) Block tag or block number to fetch.

**Example:**

```bash
curl -X POST https://rpc-testnet.taker.xyz/ \
-H "Content-Type: application/json" \
--data '{
    "jsonrpc":"2.0",
    "method":"eth_getBalance",
    "params":["INSERT_ADDRESS", "INSERT_BLOCK_VALUE"],
    "id":1
}'
```

Replace `INSERT_ADDRESS` and `INSERT_BLOCK_VALUE` with appropriate values.

***

**eth\_getBlockByHash**

Returns information about a block by its hash.

**Parameters:**

* `blockHash` (string): Hash of the block (32-byte data string).
* `fullTransactions` (boolean): If `true`, returns full transaction details; otherwise, only transaction hashes.

**Example:**

```bash
curl -X POST https://rpc-testnet.taker.xyz/ \
-H "Content-Type: application/json" \
--data '{
    "jsonrpc":"2.0",
    "method":"eth_getBlockByHash",
    "params":["INSERT_BLOCK_HASH", INSERT_BOOLEAN],
    "id":1
}'
```

Replace `INSERT_BLOCK_HASH` and `INSERT_BOOLEAN` with appropriate values.

***

**eth\_getBlockByNumber**

Returns information about a block by its number.

**Parameters:**

* `blockValue` (string): Block tag or block number.
* `fullTransactions` (boolean): If `true`, returns full transaction details; otherwise, only transaction hashes.

**Example:**

```bash
curl -X POST https://rpc-testnet.taker.xyz/ \
-H "Content-Type: application/json" \
--data '{
    "jsonrpc":"2.0",
    "method":"eth_getBlockByNumber",
    "params":["INSERT_BLOCK_VALUE", INSERT_BOOLEAN],
    "id":1
}'
```

Replace `INSERT_BLOCK_VALUE` and `INSERT_BOOLEAN` with appropriate values.

***

#### **Response Format**

All responses follow the standard JSON-RPC 2.0 format:

```json
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": ... // The return value varies by method
}
```

***

#### **Error Handling**

If an error occurs, the response will include an error object:

```json
{
    "jsonrpc": "2.0",
    "id": 1,
    "error": {
        "code": -32000,
        "message": "Error message here"
    }
}
```

***

#### **Additional Methods**

Refer to the full list above for additional methods like `eth_getTransactionByHash`, `eth_sendTransaction`, `eth_syncing`, and more. Each method includes detailed parameters and examples to help you integrate with Taker Chain's JSON-RPC interface.

***

Start building with Taker Chain's Ethereum-compatible JSON-RPC API today!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.taker.xyz/taker/developers/evm-developers/json-rpc-apis.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
