# Etherlink RPC Documentation

## Etherlink RPC plans and rate limits

- **Free plan:** 20 responses per second, up to 100,000 responses a day.
- **Plans:** $49/mo, $299/mo, $999/mo with 25M, 150M, and 500M included responses. Overages billed at $5/$3/$2 per million responses respectively.
- **Paid rate limits:** 100 to 5,000 responses per second (bursts from 500 to 10,000), no daily limit.
- **Billing:** 1 response = 1 API credit on every shared plan, over HTTPS or WebSocket (WSS) where Etherlink supports it.

Details: [Pricing](https://www.dwellir.com/docs/getting-started/pricing) · [Rate limits](https://www.dwellir.com/docs/getting-started/rate-limits) · [Authentication](https://www.dwellir.com/docs/getting-started/authentication) · [Archive nodes](https://www.dwellir.com/docs/getting-started/archive-nodes)

## Why build on Etherlink?

Etherlink runs Ethereum Virtual Machine (EVM) contracts on a Tezos Smart Rollup. Existing Solidity contracts and Ethereum tools can connect through its JSON-RPC interface. The native gas token is tez (XTZ).

Dwellir's mainnet nodes retain historical state. Use fixed block numbers to read balances, contract code, storage, and contract calls. You can also retrieve past blocks, receipts, and event logs.

## Quick start with Etherlink

Replace `YOUR_API_KEY` with your Dwellir API key. The WebSocket URL includes `/ws` after the key.

| Transport | Mainnet endpoint                                            |
| --------- | ----------------------------------------------------------- |
| HTTPS     | `https://api-etherlink-mainnet.n.dwellir.com/YOUR_API_KEY`  |
| WSS       | `wss://api-etherlink-mainnet.n.dwellir.com/YOUR_API_KEY/ws` |

### Check the chain ID

Send a JSON-RPC request over HTTPS before using the endpoint in an application:

```bash
curl -X POST 'https://api-etherlink-mainnet.n.dwellir.com/YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}'
```

The result is `0xa729`, or **42793** in decimal.

### Read historical state

This ethers.js v6 example reads the native XTZ balance at block 1,000,000. Replace the address with the account you need to inspect.

```javascript
import { JsonRpcProvider } from 'ethers';

const provider = new JsonRpcProvider(
  'https://api-etherlink-mainnet.n.dwellir.com/YOUR_API_KEY'
);
const network = await provider.getNetwork();
if (network.chainId !== 42793n) {
  throw new Error(`Expected Etherlink mainnet, received ${network.chainId}`);
}

const balance = await provider.getBalance(
  '0x5d66ec78664f4a0b0929a41270316a6cd4d8bd4b',
  1_000_000
);
console.log(balance.toString());
```

### Subscribe to new heads

Connect to the WebSocket URL shown above and send this message:

```json
{"jsonrpc":"2.0","id":1,"method":"eth_subscribe","params":["newHeads"]}
```

The response contains a subscription ID. Later `eth_subscription` notifications contain new block headers. Send `eth_unsubscribe` with that ID when you finish. Only `newHeads` subscriptions are verified here.

## Network specifications

| Parameter       | Value                                                 | Details                                   |
| --------------- | ----------------------------------------------------- | ----------------------------------------- |
| Chain ID        | 42793                                                 | Mainnet, hexadecimal `0xa729`             |
| Native currency | XTZ                                                   | Tez uses 18 decimals in the EVM interface |
| Network         | Tezos Smart Rollup                                    | EVM-compatible execution                  |
| Node client     | Octez EVM 0.66                                        | Dwellir mainnet archive nodes             |
| RPC transport   | HTTPS and WSS                                         | JSON-RPC 2.0; WSS uses the `/ws` path     |
| Explorer        | [Etherlink Explorer](https://explorer.etherlink.com/) | Mainnet blocks and transactions           |

## API reference

The reference pages use recorded mainnet requests with fixed block numbers, addresses, and transaction hashes. They document methods verified on Dwellir's Etherlink deployment.

## RPC capabilities and limits

| Capability              | Support               | Operational note                                                                                                                                  |
| ----------------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| Historical state        | Archive               | Read balances, code, storage, and calls at fixed block numbers                                                                                    |
| Event logs              | Supported             | Use [`eth_getLogs`](https://www.dwellir.com/docs/etherlink/eth_getLogs) with a block filter                                                                              |
| WebSocket subscriptions | `newHeads` verified   | Use the `/ws` endpoint and `eth_subscribe`                                                                                                        |
| Call traces             | `callTracer` verified | See [`debug_traceTransaction`](https://www.dwellir.com/docs/etherlink/debug_traceTransaction) and [`debug_traceBlockByNumber`](https://www.dwellir.com/docs/etherlink/debug_traceBlockByNumber) |
| `eth_getProof`          | Unsupported           | Octez EVM 0.66 returns `-32004 Method not supported`                                                                                              |
| `eth_syncing`           | Unsupported           | Octez EVM 0.66 returns `-32004 Method not supported`                                                                                              |
| `net_peerCount`         | Unsupported           | Octez EVM 0.66 returns `-32004 Method not supported`                                                                                              |

### Trace availability

Etherlink mainnet block tracing starts at the Bifrost boundary, block **4,162,673**. Use `callTracer` with the verified debug methods. Earlier blocks have no call traces.

The examples use a `119s` timeout value. The endpoint accepted that value, but timeout enforcement was not verified. These examples do not establish support for other debug methods or tracers.

## Resources

- [Etherlink network](https://www.dwellir.com/networks/etherlink)
- [Top Etherlink RPC providers compared](https://www.dwellir.com/blog/top-etherlink-rpc-providers)
- [Authentication](https://www.dwellir.com/docs/getting-started/authentication)
- [Archive nodes](https://www.dwellir.com/docs/getting-started/archive-nodes)
- [Etherlink EVM interface](https://docs.etherlink.com/evm/)
- [Etherlink endpoint support](https://docs.etherlink.com/evm/developing/endpoint-support/)
- [Etherlink tracing documentation](https://docs.etherlink.com/evm/developing/transactions/#tracing-transactions)
