> For a complete page index, fetch https://docs.conduit.xyz/llms.txt

# Make your First RPC Request

> The same way you might use platforms like Alchemy or Infura to access Ethereum, you can use our endpoints to send requests to the built-in RPCs on Conduit chains.

Conduit RPC endpoints follow the [Ethereum JSON-RPC spec](https://ethereum.org/en/developers/docs/apis/json-rpc/). You send a `POST` request with a JSON body describing the method you want to call, and the node returns the result.

> **Note**
>
> These examples assume your API key doesn't have a JSON Web Token (JWT)
> public key bound to it. After you bind a public key, every request must include
> both the API key in the endpoint URL and a signed JWT in the `Authorization:
>   Bearer <JWT>` header. Learn how to [make an authenticated JWT request](/rpc-nodes/guides/jwt-authentication/make-requests).

## Anatomy of a request

Every request body has four fields:

| Field     | Description                                                         | Example                          |
| --------- | ------------------------------------------------------------------- | -------------------------------- |
| `jsonrpc` | Protocol version always remains `"2.0"`                             | `"2.0"`                          |
| `method`  | The JSON-RPC method to call                                         | `"eth_blockNumber"`              |
| `params`  | Arguments for the method. Use `[]` if the method takes no arguments | `[]` or `["0xabc...", "latest"]` |
| `id`      | An identifier you assign, echoed back in the response               | `"1"`                            |

To call a different method, replace the `method` value with any supported JSON-RPC method and update `params` accordingly. See the examples below.

## Steps

#### Write a request

The example below fetches the latest block number. It takes no arguments, so `params` is an empty array.

> **Note**
>
> You'll need your network's RPC URL and API key from the [Conduit App](https://app.conduit.xyz/). Append them to the request URL as shown above.

**`Request`**

```curl Request
curl -s https://[YOUR_RPC_URL]/[YOUR_API_KEY] -X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":"1","method":"eth_blockNumber","params":[]}'
```

**`Response`**

```curl Response
{"jsonrpc":"2.0","result":"0x430905","id":"1"}
```

The `result` is the block number in hex. `0x430905` = block 4,394,245.

#### Add RPC URL and API key

Replace `[YOUR_RPC_URL]` and `[YOUR_API_KEY]` with your values. Supported networks and their RPC URLs can be found in the Conduit app, under the **Endpoints** tab of your API key page.

> **Info**
>
> If you can't find the RPC URL you're looking for, contact the chain owner.

#### Send the request

Run the command in your terminal. You should see a JSON response with a `result` field. If you see an error, double-check your RPC URL and API key.

## More examples

The examples below show common methods across curl, JavaScript, Python, and Go. Replace `[YOUR_RPC_URL]` and `[YOUR_API_KEY]` with your values.

If you are using a web3 library like viem, ethers.js, or web3.py, see [Using Web3 Libraries](/rpc-nodes/getting-started/web3-libraries).

### eth\_blockNumber

Get the latest block number.

**`curl`**

```curl curl
curl -s https://[YOUR_RPC_URL]/[YOUR_API_KEY] -X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":"1","method":"eth_blockNumber","params":[]}'
```

**`JavaScript`**

```javascript JavaScript
const response = await fetch('https://[YOUR_RPC_URL]/[YOUR_API_KEY]', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ jsonrpc: '2.0', id: '1', method: 'eth_blockNumber', params: [] }),
})
const { result } = await response.json()
console.log(result)
```

**`Python`**

```python Python
import requests

response = requests.post(
    'https://[YOUR_RPC_URL]/[YOUR_API_KEY]',
    json={'jsonrpc': '2.0', 'id': '1', 'method': 'eth_blockNumber', 'params': []},
)
print(response.json()['result'])
```

**`Go`**

```go Go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
)

func main() {
	body, _ := json.Marshal(map[string]any{
		"jsonrpc": "2.0", "id": "1", "method": "eth_blockNumber", "params": []any{},
	})
	resp, _ := http.Post("https://[YOUR_RPC_URL]/[YOUR_API_KEY]", "application/json", bytes.NewReader(body))
	var result map[string]any
	json.NewDecoder(resp.Body).Decode(&result)
	fmt.Println(result["result"])
}
```

---

### eth\_getBalance

Get the ETH balance of an address. `params` takes an address and a block tag (`"latest"`, `"earliest"`, or a hex block number).

**`curl`**

```curl curl
curl -s https://[YOUR_RPC_URL]/[YOUR_API_KEY] -X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":"1","method":"eth_getBalance","params":["0xYOUR_ADDRESS","latest"]}'
```

**`JavaScript`**

```javascript JavaScript
const response = await fetch('https://[YOUR_RPC_URL]/[YOUR_API_KEY]', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    jsonrpc: '2.0', id: '1', method: 'eth_getBalance',
    params: ['0xYOUR_ADDRESS', 'latest'],
  }),
})
const { result } = await response.json()
console.log(result)
```

**`Python`**

```python Python
import requests

response = requests.post(
    'https://[YOUR_RPC_URL]/[YOUR_API_KEY]',
    json={'jsonrpc': '2.0', 'id': '1', 'method': 'eth_getBalance', 'params': ['0xYOUR_ADDRESS', 'latest']},
)
print(response.json()['result'])
```

**`Go`**

```go Go
body, _ := json.Marshal(map[string]any{
	"jsonrpc": "2.0", "id": "1", "method": "eth_getBalance",
	"params": []any{"0xYOUR_ADDRESS", "latest"},
})
resp, _ := http.Post("https://[YOUR_RPC_URL]/[YOUR_API_KEY]", "application/json", bytes.NewReader(body))
var result map[string]any
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result["result"])
```

---

### eth\_call

Call a contract function without sending a transaction.

**`curl`**

```curl curl
curl -s https://[YOUR_RPC_URL]/[YOUR_API_KEY] -X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":"1","method":"eth_call","params":[{"to":"0xCONTRACT_ADDRESS","data":"0xCALLDATA"},"latest"]}'
```

**`JavaScript`**

```javascript JavaScript
const response = await fetch('https://[YOUR_RPC_URL]/[YOUR_API_KEY]', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    jsonrpc: '2.0', id: '1', method: 'eth_call',
    params: [{ to: '0xCONTRACT_ADDRESS', data: '0xCALLDATA' }, 'latest'],
  }),
})
const { result } = await response.json()
console.log(result)
```

**`Python`**

```python Python
import requests

response = requests.post(
    'https://[YOUR_RPC_URL]/[YOUR_API_KEY]',
    json={
        'jsonrpc': '2.0', 'id': '1', 'method': 'eth_call',
        'params': [{'to': '0xCONTRACT_ADDRESS', 'data': '0xCALLDATA'}, 'latest'],
    },
)
print(response.json()['result'])
```

**`Go`**

```go Go
body, _ := json.Marshal(map[string]any{
	"jsonrpc": "2.0", "id": "1", "method": "eth_call",
	"params": []any{map[string]any{"to": "0xCONTRACT_ADDRESS", "data": "0xCALLDATA"}, "latest"},
})
resp, _ := http.Post("https://[YOUR_RPC_URL]/[YOUR_API_KEY]", "application/json", bytes.NewReader(body))
var result map[string]any
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result["result"])
```

---

### eth\_getLogs

Fetch logs matching a filter. See [Throughput](/rpc-nodes/information/throughput) for block range and event count limits.

**`curl`**

```curl curl
curl -s https://[YOUR_RPC_URL]/[YOUR_API_KEY] -X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":"1","method":"eth_getLogs","params":[{"fromBlock":"0x0","toBlock":"latest","address":"0xCONTRACT_ADDRESS"}]}'
```

**`JavaScript`**

```javascript JavaScript
const response = await fetch('https://[YOUR_RPC_URL]/[YOUR_API_KEY]', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    jsonrpc: '2.0', id: '1', method: 'eth_getLogs',
    params: [{ fromBlock: '0x0', toBlock: 'latest', address: '0xCONTRACT_ADDRESS' }],
  }),
})
const { result } = await response.json()
console.log(result)
```

**`Python`**

```python Python
import requests

response = requests.post(
    'https://[YOUR_RPC_URL]/[YOUR_API_KEY]',
    json={
        'jsonrpc': '2.0', 'id': '1', 'method': 'eth_getLogs',
        'params': [{'fromBlock': '0x0', 'toBlock': 'latest', 'address': '0xCONTRACT_ADDRESS'}],
    },
)
print(response.json()['result'])
```

**`Go`**

```go Go
body, _ := json.Marshal(map[string]any{
	"jsonrpc": "2.0", "id": "1", "method": "eth_getLogs",
	"params": []any{map[string]any{"fromBlock": "0x0", "toBlock": "latest", "address": "0xCONTRACT_ADDRESS"}},
})
resp, _ := http.Post("https://[YOUR_RPC_URL]/[YOUR_API_KEY]", "application/json", bytes.NewReader(body))
var result map[string]any
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result["result"])
```