# JSON-RPC over HTTP

Send standard JSON-RPC 2.0 requests to blockchain nodes through a single HTTPS endpoint.

## Request format


```
POST https://rpc.vilna.io/{chain}
```

Where `{chain}` is either a [CAIP-2](/apis/platform/caip-standards) chain ID or a network alias (see [supported networks](/apis/rpc#supported-networks)).

| Parameter | Value |
|  --- | --- |
| Content-Type | `application/json` |
| Authentication | `X-Api-Key` header |
| Max request body | 1 MB |
| Timeout | 30 seconds |


## Examples

### Ethereum (EVM)

By alias

```bash
curl -X POST https://rpc.vilna.io/ethereum \
  -H "X-Api-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_blockNumber",
    "params": [],
    "id": 1
  }'
```

By CAIP-2 ID

```bash
curl -X POST https://rpc.vilna.io/eip155:1 \
  -H "X-Api-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_blockNumber",
    "params": [],
    "id": 1
  }'
```

All EVM-compatible chains (Ethereum, BSC, Polygon, Avalanche, Arbitrum, Optimism, Base, etc.) support the same set of [Ethereum JSON-RPC methods](https://ethereum.org/en/developers/docs/apis/json-rpc/).

### Solana

By alias

```bash
curl -X POST https://rpc.vilna.io/solana \
  -H "X-Api-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "getBalance",
    "params": ["83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri"],
    "id": 1
  }'
```

By CAIP-2 ID

```bash
curl -X POST https://rpc.vilna.io/solana:mainnet \
  -H "X-Api-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "getBalance",
    "params": ["83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri"],
    "id": 1
  }'
```

Solana supports its native [JSON-RPC API methods](https://solana.com/docs/rpc).

### Bitcoin

By alias

```bash
curl -X POST https://rpc.vilna.io/bitcoin \
  -H "X-Api-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "getblockcount",
    "params": [],
    "id": 1
  }'
```

By CAIP-2 ID

```bash
curl -X POST https://rpc.vilna.io/bip122:000000000019d6689c085ae165831e93 \
  -H "X-Api-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "getblockcount",
    "params": [],
    "id": 1
  }'
```

Bitcoin supports standard [Bitcoin Core JSON-RPC methods](https://developer.bitcoin.org/reference/rpc/).

## Error handling

### System errors

Returned by Vilna RPC when the request cannot reach the blockchain node:


```json
{"error": "description of the problem"}
```

| Situation | HTTP status |
|  --- | --- |
| Missing API key | 401 |
| Invalid API key | 401 |
| Network not found | 404 |
| Protocol mismatch | 400 |
| Network unavailable | 502 |


For common API errors and troubleshooting, see the [Errors guide](/guides/errors).

### Blockchain node errors

If the request reaches the node but the node returns an error, you receive the node's native JSON-RPC error format:


```json
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "Method not found"
  },
  "id": 1
}
```

These errors come directly from the blockchain node and follow the [JSON-RPC 2.0 error specification](https://www.jsonrpc.org/specification#error_object).

## Next steps

gRPC
Access Tron nodes via gRPC protocol

RPC Overview
Supported networks, authentication, and health checks

Errors
Error handling and troubleshooting guide