The eth_ namespace: what an execution client serves. Each export is one JSON-RPC method as a
typed function, and the eth_subscribe kinds are under
Eth.subscribe .
import { Effect } from "effect" ;
import { Eth } from "@ethect/core/rpc" ;
const head = Effect. gen ( function* () {
const number = yield* Eth. blockNumber ();
const block = yield* Eth. getBlockByNumber (number, false );
A method takes its JSON-RPC params in order and returns an
Effect of the decoded result. The name is the wire
name without its prefix: eth_getBalance is Eth.getBalance.
Method
JSON-RPC
Returns
Description
chainId
eth_chainId
number
The chain id of the network.
blockNumber
eth_blockNumber
bigint
The number of the most recent block.
syncing
eth_syncing
false or progress
Whether the node is syncing, and how far it is.
accounts
eth_accounts
Address[]
The accounts the node or wallet holds keys for.
coinbase
eth_coinbase
Address
The address that receives the node’s block rewards.
protocolVersion
eth_protocolVersion
number
The version of the eth wire protocol.
config
eth_config
ChainConfig
The fork configuration: current, next and last.
capabilities
eth_capabilities
Capabilities
What history the node keeps.
Method
JSON-RPC
Returns
Description
getBalance
eth_getBalance
bigint
The balance of an account, in wei.
getTransactionCount
eth_getTransactionCount
number
The number of transactions an account has sent: its next nonce.
getCode
eth_getCode
Hex
The code of a contract.
getStorageAt
eth_getStorageAt
Hex
The value of one storage slot of a contract.
getStorageValues
eth_getStorageValues
Record<Address, Hex[]>
The values of several slots of several contracts.
getProof
eth_getProof
Proof
The Merkle proof of an account and of storage slots.
getAccount
eth_getAccount
Account | null
An account’s nonce, balance, storage root and code hash.
Method
JSON-RPC
Returns
Description
call
eth_call
Hex
Runs a call without sending a transaction.
estimateGas
eth_estimateGas
bigint
The gas a transaction would need.
createAccessList
eth_createAccessList
AccessList.Result
The access list a transaction would use.
simulateV1
eth_simulateV1
simulated blocks
Simulates calls in a sequence of blocks.
Method
JSON-RPC
Returns
Description
feeHistory
eth_feeHistory
FeeHistory
Base fees, gas usage and priority fees over a range of blocks.
gasPrice
eth_gasPrice
bigint
The node’s suggestion for a legacy gas price.
maxPriorityFeePerGas
eth_maxPriorityFeePerGas
bigint
The node’s suggestion for a priority fee.
baseFee
eth_baseFee
bigint
The base fee of the next block.
blobBaseFee
eth_blobBaseFee
bigint | null
The blob base fee of the next block.
Method
JSON-RPC
Returns
Description
getLogs
eth_getLogs
Log[]
The logs matching a filter.
newFilter
eth_newFilter
Hex
Installs a log filter on the node.
newBlockFilter
eth_newBlockFilter
Hex
Installs a filter that collects new block hashes.
newPendingTransactionFilter
eth_newPendingTransactionFilter
Hex
Installs a filter that collects pending transaction hashes.
getFilterChanges
eth_getFilterChanges
Hash[] or Log[]
What a filter collected since it was last polled.
getFilterLogs
eth_getFilterLogs
Log[]
Every log matching a log filter.
uninstallFilter
eth_uninstallFilter
boolean
Removes a filter.
Method
JSON-RPC
Returns
Description
sendTransaction
eth_sendTransaction
Hash
Signs and sends a transaction from an account the node or wallet holds.
sendTransactionSync
eth_sendTransactionSync
Receipt
The same, and waits for the receipt.
sendRawTransaction
eth_sendRawTransaction
Hash
Sends a signed, encoded transaction.
sendRawTransactionSync
eth_sendRawTransactionSync
Receipt
The same, and waits for the receipt.
fillTransaction
eth_fillTransaction
{ raw, tx }
Fills in what a request leaves out, without sending it.
signTransaction
eth_signTransaction
Hex
Signs a transaction without sending it.
sign
eth_sign
Hex
Signs a message with an account’s key.
signTypedDataV4
eth_signTypedData_v4
Hex
Signs EIP-712 typed data.
A subscription is a Stream, and it needs a transport that can push: WebSocket, IPC or
EIP-1193. See Subscriptions .
These eth_ methods have no definition in the namespace. Any of them is
one line to add .
Methods
Why
eth_subscribe, eth_unsubscribe
covered by Eth.subscribe and the Subscriptions service
eth_mining, eth_hashrate, eth_getWork, eth_submitWork, eth_submitHashrate
proof-of-work leftovers
eth_callMany, eth_callBundle, eth_resend, eth_getAccountInfo, eth_signRawTransaction, eth_sendRawTransactionConditional, eth_signTypedData v1 and v3
client-specific or superseded