EIP-1474 Ethereum RPC specification standard (Remote procedure call specification)

No call decision · Networking & nodes · EIP status Stagnant · created 2018-10-02

A proposal that consolidates into a single standard the JSON-RPC methods, error codes, and value encoding rules that Ethereum nodes should commonly provide.

Why it is needed

Ethereum clients have each implemented the names, parameters, and error codes of the RPC methods they expose externally differently. Because there was no official RPC specification, wallet and dapp developers had to write code tailored to a specific client (Geth, Parity, etc.), and switching to a different client's node risked the same request behaving differently or failing. This proposal codifies the method list, parameter formats, error codes, and number/byte encoding rules so that communication works the same way regardless of which client's node is used.

What changes

Today

After EIP-1474

Who is affected

In depth

Value encoding: Quantity and Data

Every RPC parameter and return value follows one of two formats. Quantity represents a number: it must start with 0x, use the minimum number of digits per byte, and must not have leading zeros (0x0400 is invalid, only 0x400 is valid). Zero must be written as 0x0. Data represents a byte string: it also starts with 0x, but must use exactly two hex digits per byte (0x41 is valid, 0xf0f0f is invalid). Without this distinction, it would be ambiguous whether a parameter is a number or raw bytes, so the specification strictly separates the two formats.

Error code system

If an RPC method fails, the response's error member must contain an object with a code and a descriptive message. The standard codes are -32700 (Parse error), -32600 (Invalid request), -32601 (Method not found), -32602 (Invalid params), and -32603 (Internal error), which come from the JSON-RPC specification itself. The non-standard codes range from -32000 (Invalid input) to -32006 (JSON-RPC version not supported) and were defined by Ethereum nodes to distinguish cases such as transaction rejection, resource not found or unavailable, and unsupported methods.

Block Identifier and EIP-1898

eth_getBalance, eth_getStorageAt, eth_getTransactionCount, eth_getCode, eth_call, and eth_getProof take a second (or third) parameter specifying a block. Since Quantity or Data alone cannot distinguish a block number from a block hash, the object format defined by EIP-1898 is used. blockNumber and blockHash are mutually exclusive, only one may be specified, and when using blockHash, requireCanonical can optionally be set to true to verify that the block is on the canonical chain. If the block cannot be found, error -32001 is recommended, and if it is not on the canonical chain, -32000 is recommended; the nonexistence check should be performed before the canonicality check.

Account and state lookup methods

eth_getBalance returns an address's balance in wei, eth_getCode returns the contract code stored at an address, eth_getStorageAt returns the value at a specific storage slot of an address, and eth_getTransactionCount returns the number of transactions sent from an address (used as the nonce). All four methods accept a Block Identifier (or the strings latest/earliest/pending) to query state at a specific point in time.

Transaction execution and submission methods

eth_call executes a transaction immediately without submitting it to the network and only checks the return value. eth_estimateGas returns a gas estimate that may be higher than actual usage. eth_sendTransaction creates, signs, and sends a transaction from an object containing from, to, gas, gasPrice, value, data, and nonce, while eth_sendRawTransaction sends already-signed transaction data directly to the network as is. eth_signTransaction returns only the signed hash without sending it, so it can be sent later via eth_sendRawTransaction.

Log and filter methods

eth_newFilter creates a filter that watches for state changes based on fromBlock, toBlock, address, and topics conditions, while eth_newBlockFilter and eth_newPendingTransactionFilter create filters that watch for new blocks and pending transactions, respectively. All three filters return an ID, which is used to call eth_getFilterChanges (changes since the last poll) or eth_getFilterLogs (all logs). eth_getLogs queries matching logs immediately without creating a filter, and if blockhash is specified, fromBlock/toBlock cannot be used. topics are order-dependent, and nested arrays express OR conditions.

Signing methods and EIP-712

eth_sign computes an Ethereum-specific signature over the given data in the format keccak256("\x19Ethereum Signed Message:\n" + len(message) + message). eth_signTypedData signs a structured message containing type information, a domain separator, and data, with the exact encoding and signing rules following EIP-712.

Original status

This EIP's status is marked Stagnant, meaning progress has stalled. Actual client RPC implementations do not necessarily follow this document exactly for methods or changes added later, so the method list and behavior summarized here should be taken as the specification as of the proposal date (2018-10-02).

Original EIP · ← EIPs