The Web3 RPC API provides you with an easy way to maintain a constant, secure connection to the blockchain. These nodes provide reliable, real-time data access and interaction capabilities for executing transactions, monitoring block events, and querying network data efficiently.

## Supported features

| Supported Chains | Chain ID | JSON-RPC | Websockets/Subscriptions | gRPC | full-node | archive-node |
| :--------------- | :------- | :------: | :----------------------: | :--: | :-------: | :----------: |
| Ethereum         | 1        |    ✅    |            ✅            |  ❌  |    ✅     |      ✅      |
| Solana           | 501      |    ✅    |            ✅            |  ✅  |    ✅     |      ✅      |
| Base             | 8453     |    ✅    |            ✅            |  ❌  |    ✅     |      ✅      |
| BNB              | 56       |    ✅    |            ✅            |  ❌  |    ✅     |      ✅      |
| Monad            | 143      |    ✅    |            ✅            |  ❌  |    ✅     |      ✅      |
| zkSync           | 324      |    ✅    |            ✅            |  ❌  |    ✅     |      ✅      |
| Gnosis           | 100      |    ✅    |            ✅            |  ❌  |    ✅     |      ✅      |
| Optimism         | 10       |    ✅    |            ✅            |  ❌  |    ✅     |      ✅      |
| Polygon          | 137      |    ✅    |            ✅            |  ❌  |    ✅     |      ✅      |
| Linea            | 59144    |    ✅    |            ✅            |  ❌  |    ✅     |      ✅      |
| Sonic            | 146      |    ✅    |            ✅            |  ❌  |    ✅     |      ✅      |
| Unichain         | 130      |    ✅    |            ✅            |  ❌  |    ✅     |      ✅      |
| Arbitrum         | 42161    |    ✅    |            ✅            |  ❌  |    ✅     |      ✅      |
| Robinhood        | 4663     |    ✅    |            ✅            |  ❌  |    ✅     |      ✅      |
| Avalanche        | 43114    |    ✅    |            ✅            |  ❌  |    ✅     |      ✅      |
| Cronos           | 25       |    ✅    |            ✅            |  ❌  |    ✅     |      ✅      |

## Supported API Interaction Methods

- **JSON-RPC** — Standard request–response protocol used for blockchain node interactions.
- **WebSockets (Subscriptions)** — Persistent, event-driven connections for receiving real-time updates.
- **gRPC (Solana only)** — High-performance, streaming-capable remote procedure calls for low-latency and real-time interactions on the Solana blockchain.

:::info
Solana gRPC Support

For real-time Solana blockchain data streaming, check out our [Solana gRPC](./solana/solana-grpc.md) documentation using the Yellowstone protocol.
:::

## Getting Started

Select a chain from the navigation to view available JSON-RPC methods for that network. Each chain has its own set of methods that can be called using JSON-RPC requests.

## Authentication

For authentication details, see the [Authentication documentation](../authentication.md).

## Base URL

The base URL for all Web3 RPC requests is:`https://api.1inch.com/web3/{chainId}`

Where `{chainId}` is the chain ID of the network you want to interact with.

## Benefits

- **Maximal uptime**: we have developed the most advanced internal systems for node health check/load balancing, which enable us to offer the maximum possible uptime.
- **High load resistance**: thanks to our significant expertise, we can support high network load without sacrificing uptime.
- **Support for multiple chains**: the Web3 RPC API supports different EVM networks, allowing you to interact with various blockchains through a single provider.
- **Seamless integration**: easily integrate with your existing web3 projects using standard Web3 libraries.
- **Included in all plans**: the Web3 RPC API, is included in all plans
- **Full and archive node support**: choose between low-latency full nodes for real-time execution and archive nodes with complete historical blockchain state for analytics, auditing, and backtesting.

:::info
Enhanced API services are available as part of our paid plans. They are designed for enterprises with high-demand blockchain interactions or substantial operational scale, ensuring superior performance in terms of connectivity, throughput, and response times.
:::

## Example

### JSON-RPC over HTTP

Here's a simple example using viem to make a JSON-RPC call:

```typescript
import { createPublicClient, http } from "viem";
import { mainnet } from "viem/chains";

const client = createPublicClient({
  chain: mainnet,
  transport: http("https://api.1inch.com/web3/1", {
    fetchOptions: {
      headers: {
        Authorization: `Bearer ${process.env.API_KEY}`
      }
    }
  })
});

// Get the current block number
const blockNumber = await client.getBlockNumber();
console.log("Current block number:", blockNumber);
```

### WebSocket subscriptions

WebSocket connections stay open so you can subscribe to real-time blockchain events instead of polling. Connect to `wss://api.1inch.com/web3/{chainId}` and use the `eth_subscribe` method — for example, the `newHeads` subscription pushes a notification for every new block header.

Authenticate over WebSocket with the `apiKey` query parameter; browsers cannot set request headers on WebSocket connections. See the [Authentication documentation](../authentication.md) for the header alternative.

#### Raw WebSocket

Using [`wscat`](https://github.com/websockets/wscat) to subscribe to new block headers:

```bash
wscat -c 'wss://api.1inch.com/web3/1?apiKey=YOUR_API_KEY'

# Send a subscription request:
> {"jsonrpc":"2.0","id":1,"method":"eth_subscribe","params":["newHeads"]}

# The node replies with a subscription id:
< {"jsonrpc":"2.0","id":1,"result":"0x9ce59a13059e417087c02d3236a0b1cc"}

# Then streams a notification for every new block:
< {"jsonrpc":"2.0","method":"eth_subscription","params":{"subscription":"0x9ce59a13059e417087c02d3236a0b1cc","result":{"number":"0x1b4","hash":"0xabc...","parentHash":"0xdef...","timestamp":"0x64e3f1a0"}}}
```

#### viem WebSocket client

Swap the `http` transport for `webSocket` to open a persistent connection. The idiomatic way to follow new blocks is `watchBlocks`, which uses `eth_subscribe("newHeads")` under the hood when connected over WebSocket:

```typescript
import { createPublicClient, webSocket } from "viem";
import { mainnet } from "viem/chains";

const client = createPublicClient({
  chain: mainnet,
  transport: webSocket(`wss://api.1inch.com/web3/1?apiKey=${process.env.API_KEY}`)
});

// watchBlocks subscribes via eth_subscribe("newHeads") over the WebSocket
const unwatch = client.watchBlocks({
  onBlock: (block) => {
    console.log("New block:", block.number, block.hash);
  }
});

// Stop the subscription when you're done:
// unwatch();
```

To call `eth_subscribe` directly, use the transport's `subscribe` method. `onData` receives the raw JSON-RPC notification (block header fields are hex-encoded):

```typescript
import { createPublicClient, webSocket } from "viem";
import { mainnet } from "viem/chains";

const client = createPublicClient({
  chain: mainnet,
  transport: webSocket(`wss://api.1inch.com/web3/1?apiKey=${process.env.API_KEY}`)
});

const { unsubscribe } = await client.transport.subscribe({
  params: ["newHeads"],
  onData: (data) => {
    console.log("New block header:", data.result);
  },
  onError: (error) => console.error(error)
});

// Stop the subscription when you're done:
// await unsubscribe();
```

## Potential use cases

- **Decentralized applications (dApps)**: ensure your dApp has a stable and secure connection to the blockchain for tasks like reading smart contract data, sending transactions, and querying blockchain state.
- **Decentralized exchanges (DEXes)**: maintain high uptime and reliable data feeds for trading operations, ensuring users can trade assets seamlessly.
- **Trading bots**: achieve fast and reliable access to blockchain data to make timely trading decisions and execute trades.
- **Wallets**: provide users with real-time balance updates, transaction statuses, and other important blockchain data.
- **Analytics platforms**: collect and analyze blockchain data for insights and trends without worrying about node maintenance.

## API Reference

For detailed information about each endpoint, refer to the Web3 RPC API [section](./ethereum/methods).
