---
title: "Dokumentasi Ethereum RPC Endpoint"
description: "Gunakan ERPC sebagai Ethereum RPC endpoint berlatensi rendah untuk HTTP JSON-RPC request dan WebSocket subscription."
canonical: "https://erpc.global/id/doc/ethereum-rpc/general/"
locale: "id"
---

# Dokumentasi Ethereum RPC Endpoint

## Dokumentasi Ethereum RPC Endpoint

Gunakan ERPC sebagai endpoint RPC Ethereum Anda untuk HTTP JSON-RPC request dan WebSocket subscription. Ethereum RPC adalah bagian dari RPC APIs ERPC di dalam Global Edge Blockchain Infrastructure kami, dan API key dapat dikelola dari ERPC Web Dashboard.

Anda dapat menggunakan RPC key yang sama dengan Solana.

Tambahkan API key Anda ke parameter 'api-key'.

### Endpoint

Kirim request JSON-RPC 2.0 sebagai HTTP POST ke:

```text
https://edge.erpc.global/eth?api-key=<YOUR_API_KEY>
```

Untuk subscription, hubungkan melalui WebSocket ke:

```text
wss://edge.erpc.global/eth?api-key=<YOUR_API_KEY>
```

### Contoh

Berikut adalah contoh HTTP request.

```bash
curl https://edge.erpc.global/eth?api-key=<YOUR_API_KEY> --header 'Content-Type: application/json' --data '{
  "jsonrpc":"2.0","id":1,
  "method":"eth_blockNumber"
}'
```

Berikut adalah contoh WebSocket subscription.

```bash
wscat -c "wss://edge.erpc.global/eth?api-key=<YOUR_API_KEY>"
# After connected, send:
{"jsonrpc":"2.0","id":1,"method":"eth_subscribe","params":["newHeads"]}
```

Anda dapat membuat dan memeriksa API key Anda di ERPC Web Dashboard: [ERPC Web Dashboard](https://dashboard.erpc.global/id)

### Batch Request

JSON-RPC batch hingga 256 panggilan per HTTP request didukung, dan JSON-RPC notification juga diterima. Setiap panggilan dalam satu batch diukur sebagai panggilan tersendiri.

### Pengukuran Penggunaan

Jumlah token yang digunakan setiap panggilan bersifat tetap dan ditentukan oleh method-nya. Setiap panggilan di dalam batch HTTP, begitu pula setiap panggilan yang dikirim melalui koneksi WebSocket, dihitung sebagai satu panggilan tersendiri. Di WebSocket, setiap notifikasi yang Anda terima dari subscription juga menggunakan token. Di halaman [Penggunaan API](https://dashboard.erpc.global/id/user/api-usage) pada dashboard, setiap token ditampilkan sebagai satu credit.

Jumlah token per panggilan, baik melalui HTTP maupun WebSocket, adalah sebagai berikut:

| Method | Token per panggilan |
| --- | --- |
| 46 method yang tercantum di bawah | 42 |
| 18 method yang tercantum di bawah | 81 |
| `eth_getLogs`, `eth_getFilterLogs`, `eth_sendRawTransaction`, `eth_callMany`, `eth_simulateV1`, `txpool_status`, `txpool_inspect`, `txpool_contentFrom`, `debug_getRawReceipts` | 84 |
| 17 method yang tercantum di bawah | 162 |
| `trace_callMany`, `txpool_content` | 168 |
| `trace_replayBlockTransactions`, `trace_replayTransaction` | 324 |
| Method yang tidak tercantum di baris mana pun di atas | 81, 162, atau 324 |

Untuk memperkirakan pemakaian token, anggap setiap panggilan ke method di baris "81, 162, atau 324" memakai 324 token, nilai tertinggi di antara ketiganya.

Method berikut menggunakan 42 token per panggilan:

- `eth_*` (41): `eth_accounts`, `eth_baseFee`, `eth_blobBaseFee`, `eth_blockNumber`, `eth_call`, `eth_capabilities`, `eth_chainId`, `eth_createAccessList`, `eth_estimateGas`, `eth_feeHistory`, `eth_gasPrice`, `eth_getAccount`, `eth_getBalance`, `eth_getBlockByHash`, `eth_getBlockByNumber`, `eth_getBlockReceipts`, `eth_getBlockTransactionCountByHash`, `eth_getBlockTransactionCountByNumber`, `eth_getCode`, `eth_getFilterChanges`, `eth_getProof`, `eth_getRawTransactionByHash`, `eth_getStorageAt`, `eth_getTransactionByBlockHashAndIndex`, `eth_getTransactionByBlockNumberAndIndex`, `eth_getTransactionByHash`, `eth_getTransactionBySenderAndNonce`, `eth_getTransactionCount`, `eth_getTransactionReceipt`, `eth_getUncleCountByBlockHash`, `eth_getUncleCountByBlockNumber`, `eth_maxPriorityFeePerGas`, `eth_newBlockFilter`, `eth_newFilter`, `eth_newPendingTransactionFilter`, `eth_signTransaction`, `eth_submitWork`, `eth_subscribe`, `eth_syncing`, `eth_uninstallFilter`, `eth_unsubscribe`
- `net_*` (3): `net_listening`, `net_peerCount`, `net_version`
- `web3_*` (2): `web3_clientVersion`, `web3_sha3`

Method berikut menggunakan 81 token per panggilan:

- `eth_*` (18): `eth_cancelPrivateTransaction`, `eth_coinbase`, `eth_getHeaderByNumber`, `eth_getRawTransactionByBlockHashAndIndex`, `eth_getRawTransactionByBlockNumberAndIndex`, `eth_getUncleByBlockHashAndIndex`, `eth_getUncleByBlockNumberAndIndex`, `eth_getUserOperationReceipt`, `eth_getWork`, `eth_hashrate`, `eth_mining`, `eth_pendingTransactions`, `eth_protocolVersion`, `eth_sendPrivateTransaction`, `eth_sendTransaction`, `eth_sign`, `eth_submitHashRate`, `eth_submitHashrate`

Method berikut menggunakan 162 token per panggilan:

- `debug_*` (11): `debug_gcStats`, `debug_getBadBlocks`, `debug_getBlockReceipts`, `debug_getTrieFlushInterval`, `debug_storageRangeAt`, `debug_traceBlock`, `debug_traceBlockByHash`, `debug_traceBlockByNumber`, `debug_traceCall`, `debug_traceCallMany`, `debug_traceTransaction`
- `trace_*` (6): `trace_block`, `trace_call`, `trace_filter`, `trace_get`, `trace_rawTransaction`, `trace_transaction`

Setiap notifikasi subscription yang Anda terima melalui WebSocket (`wss://edge.erpc.global/eth`) menggunakan 42 token. Notifikasi subscription adalah pesan `eth_subscription` yang dikirim server setelah Anda melakukan subscribe dengan `eth_subscribe`.

Setiap pesan yang Anda kirim melalui koneksi tetapi tidak dapat di-parse sebagai panggilan JSON-RPC juga menggunakan 42 token.

Anda dapat memeriksa tarif token per panggilan saat ini di [Referensi API Ethereum RPC](https://erpc.global/id/api-doc/ethereum/).

### Method yang Didukung

Endpoint ini mencakup keluarga method standar Ethereum JSON-RPC — `eth_*`, `net_*`, `txpool_*`, dan `web3_*` — termasuk pembacaan akun dan block (`eth_getBalance`, `eth_getBlockByNumber`, `eth_getLogs`), alur transaksi (`eth_sendRawTransaction`, `eth_getTransactionReceipt`), data fee (`eth_feeHistory`, `eth_maxPriorityFeePerGas`), simulasi panggilan (`eth_call`, `eth_callMany`, `eth_simulateV1`), state proof (`eth_getProof`), filter (`eth_newFilter`, `eth_getFilterChanges`), inspeksi txpool (`txpool_status`, `txpool_content`), dan WebSocket subscription (`eth_subscribe`, `eth_unsubscribe`).

Untuk daftar method lengkap dengan bentuk request dan response, lihat [Referensi API Ethereum RPC](https://erpc.global/id/api-doc/ethereum/).

### Kode Status Response

| Status HTTP | Arti |
| --- | --- |
| 200 | Response JSON-RPC dari upstream. |
| 400 | API key tidak ada, atau request JSON-RPC tidak valid. |
| 401 | API key tidak diotorisasi. |
| 429 | Dibatasi rate. Header `retry-after` menunjukkan waktu tunggu dalam detik. |
| 502 | Request RPC upstream tidak dapat diselesaikan. |
| 503 | Layanan tidak tersedia sementara. |

Koneksi WebSocket menggunakan `101` (peningkatan protokol diterima) selain kode di atas.

### Metode dan Dokumentasi Ethereum RPC

Untuk daftar lengkap metode, parameter, dan spesifikasi subscription, lihat dokumentasi resmi. Dokumentasi tersebut mencakup penggunaan HTTP dan WebSocket.

[https://ethereum.org/en/developers/docs/apis/json-rpc/](https://ethereum.org/en/developers/docs/apis/json-rpc/)
