---
title: "Documentazione dell'endpoint RPC di Ethereum"
description: "Usa ERPC come endpoint RPC di Ethereum a bassa latenza per richieste HTTP JSON-RPC e sottoscrizioni WebSocket."
canonical: "https://erpc.global/it/doc/ethereum-rpc/general/"
locale: "it"
---

# Documentazione dell'endpoint RPC di Ethereum

## Documentazione dell'endpoint RPC di Ethereum

Usa ERPC come tuo endpoint RPC di Ethereum per richieste HTTP JSON-RPC e sottoscrizioni WebSocket. Ethereum RPC fa parte delle RPC APIs di ERPC all'interno della nostra Global Edge Blockchain Infrastructure, e la chiave API può essere gestita dalla ERPC Web Dashboard.

Puoi usare la stessa chiave RPC di Solana.

Aggiungi la tua chiave API al parametro 'api-key'.

### Endpoint

Invia richieste JSON-RPC 2.0 come HTTP POST a:

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

Per le sottoscrizioni, connettiti via WebSocket a:

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

### Esempi

Ecco un esempio di richiesta HTTP.

```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"
}'
```

Ecco un esempio di sottoscrizione WebSocket.

```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"]}
```

Puoi ottenere e verificare la tua chiave API sulla ERPC Web Dashboard: [ERPC Web Dashboard](https://dashboard.erpc.global/it)

### Richieste in batch

Sono supportati batch JSON-RPC fino a 256 chiamate per richiesta HTTP, e sono accettate anche le notifiche JSON-RPC. Ogni chiamata in un batch viene misurata come chiamata a sé stante.

### Utilizzo dei token

Ogni chiamata consuma un numero di token fisso per ciascun metodo. Le chiamate contenute in un batch HTTP e quelle inviate su una connessione WebSocket vengono conteggiate singolarmente. Su WebSocket consumano token anche le notifiche ricevute dalle sottoscrizioni. Nella pagina [Utilizzo API](https://dashboard.erpc.global/it/user/api-usage) della dashboard i token sono indicati come crediti: un token equivale a un credito.

La tabella seguente indica i token per chiamata, validi sia via HTTP sia via WebSocket:

| Metodo | Token per chiamata |
| --- | --- |
| I 46 metodi elencati sotto la tabella | 42 |
| I 18 metodi elencati sotto la tabella | 81 |
| `eth_getLogs`, `eth_getFilterLogs`, `eth_sendRawTransaction`, `eth_callMany`, `eth_simulateV1`, `txpool_status`, `txpool_inspect`, `txpool_contentFrom`, `debug_getRawReceipts` | 84 |
| I 17 metodi elencati sotto la tabella | 162 |
| `trace_callMany`, `txpool_content` | 168 |
| `trace_replayBlockTransactions`, `trace_replayTransaction` | 324 |
| Qualsiasi metodo non presente nelle righe precedenti | 81, 162 o 324 |

Per stimare il consumo, considera ogni chiamata a un metodo della riga «81, 162 o 324» come 324 token, cioè il più alto dei tre valori.

Questi metodi consumano 42 token per chiamata:

- `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`

Questi metodi consumano 81 token per chiamata:

- `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`

Questi metodi consumano 162 token per chiamata:

- `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`

Ogni notifica di sottoscrizione ricevuta via WebSocket (`wss://edge.erpc.global/eth`) consuma 42 token. Una notifica di sottoscrizione è un messaggio `eth_subscription` che il server invia dopo che hai creato la sottoscrizione con `eth_subscribe`.

Anche ogni messaggio inviato sulla connessione che non può essere interpretato come una chiamata JSON-RPC consuma 42 token.

Puoi verificare la tariffa attuale in token per chiamata nel [Riferimento API Ethereum RPC](https://erpc.global/it/api-doc/ethereum/).

### Metodi supportati

L'endpoint copre le famiglie di metodi JSON-RPC standard di Ethereum — `eth_*`, `net_*`, `txpool_*` e `web3_*` — inclusi lettura di account e blocchi (`eth_getBalance`, `eth_getBlockByNumber`, `eth_getLogs`), flusso delle transazioni (`eth_sendRawTransaction`, `eth_getTransactionReceipt`), dati sulle commissioni (`eth_feeHistory`, `eth_maxPriorityFeePerGas`), simulazione delle chiamate (`eth_call`, `eth_callMany`, `eth_simulateV1`), prove di stato (`eth_getProof`), filtri (`eth_newFilter`, `eth_getFilterChanges`), ispezione del txpool (`txpool_status`, `txpool_content`), e sottoscrizioni WebSocket (`eth_subscribe`, `eth_unsubscribe`).

Per l'elenco completo dei metodi con i formati di richiesta e risposta, consulta il [Riferimento API Ethereum RPC](https://erpc.global/it/api-doc/ethereum/).

### Codici di stato della risposta

| Stato HTTP | Significato |
| --- | --- |
| 200 | Risposta JSON-RPC upstream. |
| 400 | Chiave API mancante, o richiesta JSON-RPC non valida. |
| 401 | Chiave API non autorizzata. |
| 429 | Rate limitato. L'header `retry-after` indica il tempo di attesa in secondi. |
| 502 | La richiesta RPC upstream non è stata completata. |
| 503 | Il servizio è temporaneamente non disponibile. |

Le connessioni WebSocket utilizzano `101` (aggiornamento di protocollo accettato) in aggiunta ai codici sopra indicati.

### Metodi RPC di Ethereum e documentazione

Per l'elenco completo dei metodi standard, dei parametri e delle specifiche di sottoscrizione, consulta la documentazione ufficiale. Copre sia l'utilizzo HTTP che WebSocket.

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