> ## Documentation Index
> Fetch the complete documentation index at: https://voltaire.tevm.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# eth Methods

> Standard Ethereum JSON-RPC methods (40 methods)

<Warning>
  **This page is a placeholder.** All examples on this page are currently AI-generated and are not correct. This documentation will be completed in the future with accurate, tested examples.
</Warning>

# eth Methods

The `eth` namespace provides 40 standard Ethereum JSON-RPC methods for blocks, transactions, state queries, and more.

## Overview

Access eth methods via the EIP-1193 `request` API:

```typescript theme={null}
import { Provider } from '@tevm/voltaire/provider';
import * as Address from '@tevm/voltaire/Address';
import * as Rpc from '@tevm/voltaire/jsonrpc';

const address = Address('0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0');

// Call eth methods
const blockNumber = await provider.request(Rpc.Eth.BlockNumberRequest());
const balance = await provider.request(Rpc.Eth.GetBalanceRequest(address, 'latest'));
const tx = await provider.request(Rpc.Eth.GetTransactionByHashRequest(txHash));
```

## Block Methods

### eth\_blockNumber

Get the most recent block number.

```typescript theme={null}
const blockNumber = await provider.request(Rpc.Eth.BlockNumberRequest());
// Quantity
```

### eth\_getBlockByNumber

Get block by number with full transactions or hashes.

```typescript theme={null}
const block = await provider.request(Rpc.Eth.GetBlockByNumberRequest('latest', true));
// Block
```

**Parameters:**

* `blockTag: BlockTag` - Block to query
* `fullTransactions: boolean` - true for full tx objects, false for hashes

### eth\_getBlockByHash

Get block by hash.

```typescript theme={null}
const block = await provider.request(Rpc.Eth.GetBlockByHashRequest(blockHash, false));
// Block
```

**Parameters:**

* `blockHash: Hash` - Block hash
* `fullTransactions: boolean` - true for full tx objects, false for hashes

### eth\_getBlockReceipts

Get all transaction receipts for a block.

```typescript theme={null}
const receipts = await provider.request(Rpc.Eth.GetBlockReceiptsRequest('latest'));
// TransactionReceipt[]
```

### eth\_getBlockTransactionCountByHash

Get transaction count in a block by hash.

```typescript theme={null}
const count = await provider.request(Rpc.Eth.GetBlockTransactionCountByHashRequest(blockHash));
// Quantity
```

### eth\_getBlockTransactionCountByNumber

Get transaction count in a block by number.

```typescript theme={null}
const count = await provider.request(Rpc.Eth.GetBlockTransactionCountByNumberRequest('latest'));
// Quantity
```

### eth\_getUncleCountByBlockHash

Get uncle count for a block by hash.

```typescript theme={null}
const count = await provider.request(Rpc.Eth.GetUncleCountByBlockHashRequest(blockHash));
// Quantity
```

### eth\_getUncleCountByBlockNumber

Get uncle count for a block by number.

```typescript theme={null}
const count = await provider.request(Rpc.Eth.GetUncleCountByBlockNumberRequest('latest'));
// Quantity
```

## Transaction Methods

### eth\_sendRawTransaction

Submit a signed transaction to the network.

```typescript theme={null}
const txHash = await provider.request(Rpc.Eth.SendRawTransactionRequest(signedTx));
// Hash
```

**Parameters:**

* `signedTransaction: Hex` - Signed transaction bytes

### eth\_sendTransaction

Sign and send a transaction (requires unlocked account).

```typescript theme={null}
const txHash = await provider.request(Rpc.Eth.SendTransactionRequest({
  from: Address('0x...'),
  to: Address('0x...'),
  value: Quantity(1000000000000000000n),
  data: Hex('0x...')
}));
// Hash
```

### eth\_getTransactionByHash

Get transaction by hash.

```typescript theme={null}
const tx = await provider.request(Rpc.Eth.GetTransactionByHashRequest(txHash));
// Transaction
```

### eth\_getTransactionByBlockHashAndIndex

Get transaction by block hash and index.

```typescript theme={null}
const tx = await provider.request(Rpc.Eth.GetTransactionByBlockHashAndIndexRequest(
  blockHash,
  Quantity(0)
));
// Transaction
```

### eth\_getTransactionByBlockNumberAndIndex

Get transaction by block number and index.

```typescript theme={null}
const tx = await provider.request(Rpc.Eth.GetTransactionByBlockNumberAndIndexRequest(
  'latest',
  Quantity(0)
));
// Transaction
```

### eth\_getTransactionReceipt

Get transaction receipt (includes logs and status).

```typescript theme={null}
const receipt = await provider.request(Rpc.Eth.GetTransactionReceiptRequest(txHash));
// TransactionReceipt
```

### eth\_getTransactionCount

Get transaction count (nonce) for an address.

```typescript theme={null}
const nonce = await provider.request(Rpc.Eth.GetTransactionCountRequest(address, 'latest'));
// Quantity
```

## State Methods

### eth\_getBalance

Get ether balance of an address.

```typescript theme={null}
const balance = await provider.request(Rpc.Eth.GetBalanceRequest(address, 'latest'));
// Quantity
```

**Parameters:**

* `address: Address` - Account address
* `blockTag: BlockTag` - Block to query

### eth\_getCode

Get contract bytecode at an address.

```typescript theme={null}
const code = await provider.request(Rpc.Eth.GetCodeRequest(address, 'latest'));
// Hex
```

**Parameters:**

* `address: Address` - Contract address
* `blockTag: BlockTag` - Block to query

### eth\_getStorageAt

Get value from a contract storage slot.

```typescript theme={null}
const value = await provider.request(Rpc.Eth.GetStorageAtRequest(
  address,
  Quantity(0),
  'latest'
));
// Hex
```

**Parameters:**

* `address: Address` - Contract address
* `position: Quantity` - Storage slot
* `blockTag: BlockTag` - Block to query

### eth\_getProof

Get Merkle proof for account and storage values.

```typescript theme={null}
const proof = await provider.request(Rpc.Eth.GetProofRequest(
  address,
  [Quantity(0), Quantity(1)],
  'latest'
));
// Proof
```

**Parameters:**

* `address: Address` - Account address
* `storageKeys: Quantity[]` - Storage slots to prove
* `blockTag: BlockTag` - Block to query

## Call Methods

### eth\_call

Execute a read-only contract call without creating a transaction.

```typescript theme={null}
const result = await provider.request(Rpc.Eth.CallRequest({
  from: Address('0x...'),
  to: Address('0x...'),
  data: Hex('0x70a08231...')  // balanceOf(address)
}, 'latest'));
// Hex
```

**Parameters:**

* `callParams: CallParams` - Transaction parameters
* `blockTag: BlockTag` - Block to execute against

### eth\_estimateGas

Estimate gas required for a transaction.

```typescript theme={null}
const gas = await provider.request(Rpc.Eth.EstimateGasRequest({
  from: Address('0x...'),
  to: Address('0x...'),
  value: Quantity(1000000000000000000n),
  data: Hex('0x...')
}));
// Quantity
```

### eth\_createAccessList

Generate an access list for a transaction.

```typescript theme={null}
const accessList = await provider.request(Rpc.Eth.CreateAccessListRequest({
  from: Address('0x...'),
  to: Address('0x...'),
  data: Hex('0x...')
}, 'latest'));
// AccessList
```

### eth\_simulateV1

Simulate multiple transactions (EIP-not-yet-finalized).

```typescript theme={null}
const simulation = await provider.request(Rpc.Eth.SimulateV1Request(params));
// SimulationResult
```

## Log & Filter Methods

### eth\_getLogs

Query event logs matching a filter.

```typescript theme={null}
const logs = await provider.request(Rpc.Eth.GetLogsRequest({
  fromBlock: 'earliest',
  toBlock: 'latest',
  address: Address('0x...'),
  topics: [Hash('0x...')]  // Event signature
}));
// Log[]
```

### eth\_newFilter

Create a new log filter.

```typescript theme={null}
const filterId = await provider.request(Rpc.Eth.NewFilterRequest({
  fromBlock: 'latest',
  toBlock: 'latest',
  address: Address('0x...'),
  topics: []
}));
// Quantity
```

### eth\_newBlockFilter

Create a filter for new blocks.

```typescript theme={null}
const filterId = await provider.request(Rpc.Eth.NewBlockFilterRequest());
// Quantity
```

### eth\_newPendingTransactionFilter

Create a filter for pending transactions.

```typescript theme={null}
const filterId = await provider.request(Rpc.Eth.NewPendingTransactionFilterRequest());
// Quantity
```

### eth\_getFilterChanges

Get new entries for a filter since last poll.

```typescript theme={null}
const changes = await provider.request(Rpc.Eth.GetFilterChangesRequest(filterId));
// Log[] | Hash[]
```

### eth\_getFilterLogs

Get all logs matching a filter.

```typescript theme={null}
const logs = await provider.request(Rpc.Eth.GetFilterLogsRequest(filterId));
// Log[]
```

### eth\_uninstallFilter

Remove a filter.

```typescript theme={null}
const success = await provider.request(Rpc.Eth.UninstallFilterRequest(filterId));
// boolean
```

## Fee Methods

### eth\_gasPrice

Get current gas price.

```typescript theme={null}
const gasPrice = await provider.request(Rpc.Eth.GasPriceRequest());
// Quantity
```

### eth\_maxPriorityFeePerGas

Get current max priority fee per gas (EIP-1559).

```typescript theme={null}
const priorityFee = await provider.request(Rpc.Eth.MaxPriorityFeePerGasRequest());
// Quantity
```

### eth\_feeHistory

Get historical gas fee data.

```typescript theme={null}
const history = await provider.request(Rpc.Eth.FeeHistoryRequest(
  Quantity(10),  // Block count
  'latest',      // Newest block
  [25, 50, 75]   // Percentiles
));
// FeeHistory
```

### eth\_blobBaseFee

Get current blob base fee (EIP-4844).

```typescript theme={null}
const blobFee = await provider.request(Rpc.Eth.BlobBaseFeeRequest());
// Quantity
```

## Network Methods

### eth\_chainId

Get the chain ID.

```typescript theme={null}
const chainId = await provider.request(Rpc.Eth.ChainIdRequest());
// Quantity
```

### eth\_syncing

Get sync status (false if not syncing).

```typescript theme={null}
const syncStatus = await provider.request(Rpc.Eth.SyncingRequest());
// SyncStatus | false
```

### eth\_coinbase

Get the coinbase address (miner/validator).

```typescript theme={null}
const coinbase = await provider.request(Rpc.Eth.CoinbaseRequest());
// Address
```

## Account Methods

### eth\_accounts

List available accounts (if wallet is connected).

```typescript theme={null}
const accounts = await provider.request(Rpc.Eth.AccountsRequest());
// Address[]
```

### eth\_sign

Sign data with an account (requires unlocked account).

```typescript theme={null}
const signature = await provider.request(Rpc.Eth.SignRequest(
  Address('0x...'),
  Hex('0x...')
));
// Hex
```

<Warning>
  `eth_sign` is dangerous and deprecated. Use typed signing methods like EIP-712 instead.
</Warning>

### eth\_signTransaction

Sign a transaction (requires unlocked account).

```typescript theme={null}
const signedTx = await provider.request(Rpc.Eth.SignTransactionRequest({
  from: Address('0x...'),
  to: Address('0x...'),
  value: Quantity(1000000000000000000n)
}));
// Hex
```

## Usage Patterns

### Check Balance and Nonce

```typescript theme={null}
const address = Address('0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0');

try {
  const [balance, nonce] = await Promise.all([
    provider.request(Rpc.Eth.GetBalanceRequest(address, 'latest')),
    provider.request(Rpc.Eth.GetTransactionCountRequest(address, 'latest'))
  ]);

  console.log('Balance:', balance);
  console.log('Nonce:', nonce);
} catch (error) {
  console.error('Failed to fetch account data:', error);
}
```

### Query Contract State

```typescript theme={null}
try {
  // Get contract code
  const code = await provider.request(Rpc.Eth.GetCodeRequest(contractAddress, 'latest'));

  if (code !== '0x') {
    // Contract exists, call a method
    const result = await provider.request(Rpc.Eth.CallRequest({
      to: contractAddress,
      data: Hex('0x18160ddd')  // totalSupply()
    }, 'latest'));
    console.log('Total supply:', result);
  }
} catch (error) {
  console.error('Failed to query contract:', error);
}
```

### Monitor Transaction

```typescript theme={null}
try {
  // Submit transaction
  const txHash = await provider.request(Rpc.Eth.SendRawTransactionRequest(signedTx));

  // Poll for receipt
  let receipt = null;
  while (!receipt) {
    try {
      receipt = await provider.request(Rpc.Eth.GetTransactionReceiptRequest(txHash));
      if (receipt) {
        console.log('Transaction mined in block:', receipt.blockNumber);
      }
    } catch (error) {
      // Receipt not yet available, continue polling
    }
    await new Promise(resolve => setTimeout(resolve, 1000));
  }
} catch (error) {
  console.error('Failed to submit transaction:', error);
}
```

## Type Reference

All parameter and return types are defined in the [JSON-RPC types](/jsonrpc/eth) module.

## Next Steps

* [Method API](/provider/methods) - Learn about the method-based API
* [debug Methods](/provider/debug-methods) - Debugging methods
* [engine Methods](/provider/engine-methods) - Consensus layer methods
* [Events](/provider/events) - Subscribe to blockchain events
