Node API

Supported Chains

API Reference

Optimism

# Optimism

> Optimism API is available on [Web3 API platform (opens in a new tab)](/content/rpc/optimism/index.html).

_Optimism_ is a fast, stable, and scalable L2 blockchain built by Ethereum developers, for Ethereum developers. Built as a minimal extension to existing Ethereum software, Optimism’s EVM-equivalent architecture scales your Ethereum apps without surprises. If it works on Ethereum, it works on Optimism at a fraction of the cost.

In order for your Web3 application to interact with Optimism — either by reading blockchain data or sending transactions to the network — it must connect to an Optimism node. Developers interact with the blockchain using the methods provided by the API.

The API interaction follows the [JSON-RPC (opens in a new tab)](https://www.jsonrpc.org/specification) which is a stateless, light-weight remote procedure call (RPC) protocol. It defines several data structures and the rules around their processing. It is transport agnostic in that the concepts can be used within the same process, over sockets, over HTTP, or in other message-passing environments. It uses JSON (RFC 4627) as data format.

For Optimism, we support the following methods:

- [EVM JSON-RPC methods](/content/docs/rpc-service/chains/chains-api/optimism/#evm-json-rpc-methods/index.html)
- [Flashblocks methods](/content/docs/rpc-service/chains/chains-api/optimism/#flashblocks-methods/index.html)

* * *

## EVM JSON-RPC methods [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#evm-json-rpc-methods/index.html)

- [`web3_clientVersion`](/content/docs/rpc-service/chains/chains-api/optimism/#web3_clientversion/index.html) — returns the current client version.
- [`web3_sha3`](/content/docs/rpc-service/chains/chains-api/optimism/#web3_sha3/index.html) — returns Keccak-256 (not the standardized SHA3-256) of the given data.
- [`net_version`](/content/docs/rpc-service/chains/chains-api/optimism/#net_version/index.html) — returns the current network ID.
- [`net_listening`](/content/docs/rpc-service/chains/chains-api/optimism/#net_listening/index.html) — returns true if client is actively listening for network connections.
- [`eth_protocolversion`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_protocolversion/index.html) — returns the current Ethereum protocol version.
- [`eth_syncing`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_syncing/index.html) — returns data on the sync status or false.
- [`eth_gasPrice`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_gasprice/index.html) — returns the current price per gas in wei.
- [`eth_accounts`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_accounts/index.html) — returns a list of addresses owned by client.
- [`eth_blockNumber`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_blocknumber/index.html) — returns the number of most recent block.
- [`eth_getBalance`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_getbalance/index.html) — returns the balance of the account specified by address.
- [`eth_getStorageAt`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_getstorageat/index.html) — returns the value from a storage position at an address specified.
- [`eth_getTransactionCount`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_gettransactioncount/index.html) — returns the number of transactions sent from an address.
- [`eth_getBlockTransactionCountByHash`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_getblocktransactioncountbyhash/index.html) — returns the number of transactions in a block specified by block hash.
- [`eth_getBlockTransactionCountByNumber`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_getblocktransactioncountbynumber/index.html) — returns the number of transactions in the block specified by number.
- [`eth_getUncleCountByBlockHash`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_getunclecountbyblockhash/index.html) — returns the number of uncles in a block specified by block hash.
- [`eth_getUncleCountByBlockNumber`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_getunclecountbyblocknumber/index.html) — returns the number of uncles in a block specified by block number.
- [`eth_getCode`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_getcode/index.html) — returns code at an address specified.
- [`eth_sendRawTransaction`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_sendrawtransaction/index.html) — creates a new message call transaction or a contract creation for signed transactions.
- [`eth_call`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_call/index.html) — executes a new message call immediately without creating a transaction on the blockchain.
- [`eth_estimateGas`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_estimategas/index.html) — generates and returns an estimate of how much gas is necessary to allow the transaction to complete.
- [`eth_getBlockByHash`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_getblockbyhash/index.html) — returns information for the block specified by block hash.
- [`eth_getBlockByNumber`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_getblockbynumber/index.html) — returns information for the block specified by block number.
- [`eth_getTransactionByHash`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_gettransactionbyhash/index.html) — returns information on a transaction specified by transaction hash.
- [`eth_getTransactionByBlockHashAndIndex`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_gettransactionbyblockhashandindex/index.html) — returns information on a transaction specified by block hash and transaction index position.
- [`eth_getTransactionByBlockNumberAndIndex`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_gettransactionbyblocknumberandindex/index.html) — returns information on a transaction by block number and transaction index position.
- [`eth_getTransactionReceipt`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_gettransactionreceipt/index.html) — returns the receipt of a transaction by transaction hash.
- [`eth_getUncleByBlockHashAndIndex`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_getunclebyblockhashandindex/index.html) — returns information about an uncle of a block by hash and uncle index position.
- [`eth_getUncleByBlockNumberAndIndex`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_getunclebyblocknumberandindex/index.html) — returns information about an uncle of a block by number and uncle index position.
- [`eth_getLogs`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_getlogs/index.html) — returns logs matching the parameters specified.

* * *

## `web3_clientVersion` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#web3_clientversion/index.html)

> Returns the current client version.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters/index.html)

- `id` (integer; required): a request ID (example: 1).
- `jsonrpc` (string; required): a JSON RPC spec used (example: 2.0).
- `method` (string; required): a method used for the request.
- `params` (array; required): None.

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns/index.html)

- `<string>`: the current client version.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "web3_clientVersion",
      "params": [],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example/index.html)

```
{
    "jsonrpc": "2.0",
    "result": "Geth/v1.9.10-stable/linux-amd64/go1.19.3",
    "id": 1
}
```

* * *

## `web3_sha3` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#web3_sha3/index.html)

> Returns Keccak-256 (not the standardized SHA3-256) of the given data.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-1/index.html)

- `id` (integer; required): a request ID (example: 1).

- `jsonrpc` (string; required): a JSON RPC spec used (example: 2.0).

- `method` (string; required): a method used for the request.

- `params` (array; required):

- `<string>` (data): the data to convert into a SHA3 hash.

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-1/index.html)

- `<string>` (data): the SHA3 result of the given string.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-1/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "web3_sha3",
      "params": ["0x68656c6c6f20776f726c64"],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-1/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad"
}
```

* * *

## `net_version` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#net_version/index.html)

> Returns the current network ID.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-2/index.html)

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-2/index.html)

- `<string>`: the current network ID.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-2/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "net_version",
      "params": [],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-2/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "10"
}
```

* * *

## `net_listening` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#net_listening/index.html)

> Returns `true` if client is actively listening for network connections.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-3/index.html)

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-3/index.html)

- `<boolean>`: `true` when listening, otherwise `false`.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-3/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "net_listening",
      "params": [],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-3/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": true
}
```

* * *

## `eth_protocolVersion` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_protocolversion/index.html)

> Returns the current Ethereum protocol version.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-4/index.html)

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-4/index.html)

- `<string>`: the current Ethereum protocol version.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-4/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_protocolVersion",
      "params": [],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-4/index.html)

```
{
    "jsonrpc": "2.0",
    "result": "0x40",
    "id": 1
}
```

* * *

## `eth_syncing` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_syncing/index.html)

> Returns an object with data about the sync status or false.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-5/index.html)

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-5/index.html)

- `<object>`\|`<boolean>`: an object with sync status data or `false`, when not syncing:
- `startingBlock` (quantity): the block at which the import started (will only be reset, after the sync reached its head).
- `currentBlock` (quantity): the current block, same as `eth_blockNumber`.
- `highestBlock` (quantity): the estimated highest block.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-5/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_syncing",
      "params": [],
      "id": 1
    }'
```

### Response example (syncing) [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-syncing/index.html)

```
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "startingBlock": "0x384",
        "currentBlock": "0x386",
        "highestBlock": "0x454"
    }
}
```

### Response example (not syncing) [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-not-syncing/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": false
}
```

* * *

## `eth_gasPrice` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_gasprice/index.html)

> Returns the current price per gas in wei.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-6/index.html)

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-6/index.html)

- `<string>` (quantity): the current gas price in wei.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-6/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_gasPrice",
      "params": [],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-5/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0xf4240"
}
```

* * *

## `eth_accounts` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_accounts/index.html)

> Returns a list of addresses owned by client.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-7/index.html)

- `id` (integer; required): a request ID (example: 1).
- `jsonrpc` (string; required): a JSON RPC spec used (example: 2.0).
- `method` (string; required): a method used for the request.
- `params` (array): None.

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-7/index.html)

- `<array>` (string; data, 20 bytes): addresses owned by the client.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-7/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_accounts",
      "params": [],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-6/index.html)

```
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": [\
        "0x407d73d8a49eeb85d32cf465507dd71d507100c1"\
    ]
}
```

* * *

## `eth_blockNumber` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_blocknumber/index.html)

> Returns the number of most recent block.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-8/index.html)

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-8/index.html)

- `<string>` (quantity): the current block number the client is on.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-8/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_blockNumber",
      "params": [],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-7/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x47774df"
}
```

* * *

## `eth_getBalance` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_getbalance/index.html)

> Returns the balance of the account specified by address.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-9/index.html)

- `id` (integer; required): a request ID (example: 1).
- `jsonrpc` (string; required): a JSON RPC spec used (example: 2.0).
- `method` (string; required): a method used for the request.
- `params` (array; required):

1. `<string>` (data, 20 bytes; required): an address to check for balance.
2. `<string>` (quantity\|tag; required): either the hex value of a _block number_ or one of the following _block tags_:

- `earliest`: the lowest numbered block available on the client.
- `finalized`: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.
- `safe`: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.
- `latest`: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.
- `pending`: a sample next block built by the client on top of the `latest` and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-9/index.html)

- `<string>` (quantity): the current balance in wei.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-9/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getBalance",
      "params": ["0x323B69eaAa302B940f4cAFA9FB8684016959600f", "latest"],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-8/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x158ab28842d51ca0a"
}
```

* * *

## `eth_getStorageAt` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_getstorageat/index.html)

> Returns the value from a storage position at an address specified.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-10/index.html)

1. `<string>` (data, 20 bytes; required): an address of the storage (hex encoded).
2. `<string>` (quantity; required): a slot position in the storage (hex encoded unsigned integer).
3. `<string>` (quantity\|tag; required): either the hex value of a _block number_ or one of the following _block tags_:

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-10/index.html)

- `<string>` (data): the value at this storage position.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-10/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getStorageAt",
      "params": ["0x295a70b2de5e3953354a6a8344e616ed314d7251", "0x0", "latest"],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-9/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
```

* * *

## `eth_getTransactionCount` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_gettransactioncount/index.html)

> Returns the number of transactions sent from an address.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-11/index.html)

1. `<string>` (data, 20 bytes): an address.
2. `<string>` (quantity\|tag): either the hex value of a _block number_ or one of the following _block tags_:

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-11/index.html)

- `<string>` (quantity): the number of transactions send from this address.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-11/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getTransactionCount",
      "params": ["0xf9e8466141d032AAaE3306227bb34c8278737425", "latest"],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-10/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x4d"
}
```

* * *

## `eth_getBlockTransactionCountByHash` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_getblocktransactioncountbyhash/index.html)

> Returns the number of transactions in a block specified by block hash.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-12/index.html)

1. `<string>` (data, 32 bytes): a block hash.

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-12/index.html)

- `<string>` (quantity): the number of transactions in this block.

### Request example: [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-12/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getBlockTransactionCountByHash",
      "params": ["0x6326ed6707a6c28b52994295610963173655a1d127ea637f174ed733d66d4824"],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-11/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x1"
}
```

* * *

## `eth_getBlockTransactionCountByNumber` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_getblocktransactioncountbynumber/index.html)

> Returns the number of transactions in the block specified by number.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-13/index.html)

1. `<string>` (quantity\|tag): either the hex value of a _block number_ or one of the following _block tags_:

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-13/index.html)

- `<string>` (quantity): the number of transactions in this block.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-13/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getBlockTransactionCountByNumber",
      "params": ["0x4777962"],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-12/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x1"
}
```

* * *

## `eth_getUncleCountByBlockHash` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_getunclecountbyblockhash/index.html)

> Returns the number of uncles in a block specified by block hash.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-14/index.html)

1. `<string>` (data, 32 bytes): a block's hash.

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-14/index.html)

- `<string>` (quantity): the number of uncles in this block.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-14/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getUncleCountByBlockHash",
      "params": ["0x6326ed6707a6c28b52994295610963173655a1d127ea637f174ed733d66d4824"],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-13/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x0"
}
```

* * *

## `eth_getUncleCountByBlockNumber` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_getunclecountbyblocknumber/index.html)

> Returns the number of uncles in a block specified by block number.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-15/index.html)

1. `<string>` (quantity\|tag): either the hex value of a _block number_ or one of the following _block tags_:

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-15/index.html)

- `<string>` (quantity): the number of uncles in this block.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-15/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getUncleCountByBlockNumber",
      "params": ["0x4777962"],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-14/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x0"
}
```

* * *

## `eth_getCode` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_getcode/index.html)

> Returns code at a given address.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-16/index.html)

1. `<string>` (data, 20 bytes): an address to get the code from.
2. `<string>` (quantity\|tag): either the hex value of a _block number_ or one of the following _block tags_:

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-16/index.html)

- `<string>` (data): the code from the given address.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-16/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getCode",
      "params": ["0xb1398c4D958B97c181Df60148678f04eCEc62c69", "0x0"],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-15/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x"
}
```

* * *

## `eth_sendRawTransaction` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_sendrawtransaction/index.html)

> Creates new message call transaction or a contract creation for signed transactions.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-17/index.html)

1. `<string>` (data): the signed transaction data.

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-17/index.html)

- `<string>` (data, 32 bytes): the transaction hash, or the zero hash if the transaction is not yet available.

Use [eth\_getTransactionReceipt](/content/docs/rpc-service/chains/chains-api/optimism/#eth_gettransactionreceipt/index.html) to get the contract address, after the transaction was mined, when you created a contract.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-17/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
    "jsonrpc": "2.0",
    "method": "eth_sendRawTransaction",
    "params": ["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"],
    "id": 1
}'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-16/index.html)

```
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
}
```

* * *

## `eth_call` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_call/index.html)

> Executes a new message call immediately without creating a transaction on the blockchain.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-18/index.html)

1. `<object>` (hex encoded): the transaction object:

- `from` (string; data, 20 bytes; optional): the address the transaction is sent from.
- `to` (string; data, 20 bytes): the address the transaction is directed to.
- `gas` (string; quantity; optional): the gas provided for the transaction execution. `eth_call` consumes zero gas, but this parameter may be needed by some executions.
- `gasPrice` (string; quantity; optional): the gas price willing to be paid by the sender in wei.
- `value` (string; quantity; optional): the value sent with this transaction, in wei.
- `data` (string; data; optional): the hash of the method signature and encoded parameters.

2. `<string>` (quantity\|tag): either the hex value of a _block number_ or one of the following _block tags_:

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-18/index.html)

- `<string>` (hex encoded bytes): the return value of executed contract.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-18/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
    "jsonrpc": "2.0",
    "method": "eth_call",
    "params": [{"from":null,"to":"0x6b175474e89094c44da98b954eedeac495271d0f","data":"0x70a082310000000000000000000000006E0d01A76C3Cf4288372a29124A26D4353EE51BE"}, "latest"],
    "id": 1
}'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-17/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x0000000000000000000000000000000000000000000000000858898f93629000"
}
```

* * *

## `eth_estimateGas` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_estimategas/index.html)

> Generates and returns an estimate of how much gas is necessary to allow the transaction to complete.

The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-19/index.html)

1. `<object>` (hex encoded): the transaction object:

- `from` (string; data, 20 bytes; optional): the address the transaction is sent from.
- `to` (string; data, 20 bytes; optional): the address the transaction is directed to.
- `gas` (string; quantity; optional): the gas provided for the transaction execution. `eth_call` consumes zero gas, but this parameter may be needed by some executions.
- `gasPrice` (string; quantity; optional): the gas price willing to be paid by the sender in wei.
- `value` (string; quantity; optional): the value sent with this transaction, in wei.
- `data` (string; data; optional): the hash of the method signature and encoded parameters.

2. `<string>` (quantity\|tag; optional): either a HEX value of a _block number_ or one of the following _block tags_:

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-19/index.html)

- `<string>` (quantity): the amount of gas used.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-19/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
    "jsonrpc": "2.0",
    "method": "eth_estimateGas",
    "params": [{"from":"0x07f327929A3A3131EB4BE83f784DBD3E5C2698f8"}],
    "id": 1
}'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-18/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0xcf08"
}
```

* * *

## `eth_getBlockByHash` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_getblockbyhash/index.html)

> Returns information for the block specified by block hash.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-20/index.html)

1. `<string>` (data, 32 bytes): the block's hash.
2. `<boolean>`: if `true` it returns the full transaction objects, if `false` — only the hashes of the transactions.

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-20/index.html)

- `<object>`: a block object, or null when no block was found:
- `number` (string; quantity): the block number; null when it's a pending block.
- `hash` (string; data, 32 bytes): the hash of the block; null when it's a pending block.
- `parentHash` (string; data, 32 bytes): the hash of the parent block.
- `nonce` (string; data, 8 bytes): the hash of the generated proof-of-work; null when it's a pending block.
- `sha3Uncles` (string; data, 32 bytes): SHA3 of the uncles data in the block.
- `logsBloom` (string; data, 256 bytes): the bloom filter for the logs of the block. null when its pending block.
- `transactionsRoot` (string; data, 32 bytes): the root of the transaction trie of the block.
- `stateRoot` (string; data, 32 bytes): the root of the final state trie of the block.
- `receiptsRoot` (string; data, 32 bytes): the root of the receipts trie of the block.
- `miner` (string; data, 20 bytes): the address of the beneficiary to whom the mining rewards were given.
- `difficulty` (string; quantity): the difficulty for this block.
- `totalDifficulty` (string; quantity): the total difficulty of the chain until this block.
- `extraData` (string; data): the **extra data** field of this block.
- `size` (string; quantity): the size of this block in bytes.
- `gasLimit` (string; quantity): the maximum gas allowed in this block.
- `gasUsed` (string; quantity): the total used gas by all transactions in this block.
- `timestamp` (string; quantity): the unix timestamp for when the block was collated.
- `transactions` (array of strings): an array of transaction objects, or 32 bytes transaction hashes depending on the last given parameter.
- `uncles` (array of strings): an array of uncle hashes.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-20/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getBlockByHash",
      "params": ["0x6326ed6707a6c28b52994295610963173655a1d127ea637f174ed733d66d4824", false],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-19/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "difficulty": "0x2",
        "extraData": "0xd98301090a846765746889676f312e31352e3133856c696e7578000000000000960f93ea46e2665a34c02840497b8cb8507574e76bae487c9e4d72a8c72313f408c9d460e9a0974d2180f906c3057357afe35482ce26338ba6c85427f16aa60d00",
        "gasLimit": "0xe4e1c0",
        "gasUsed": "0x1d969",
        "hash": "0x6326ed6707a6c28b52994295610963173655a1d127ea637f174ed733d66d4824",
        "logsBloom": "0x04000000000000000000001001000000000000000020000000000000000200000000000000000000000000000000000000000000000000800000000040000000000000000000000000000008000000000000000000000000000000000000000000000000020000000000008000000800000000000000000000000010000000000000000000000000000000000000000000000000000000000000010000000000000000800000000000400102000000000000000000000000000000000100000000000002020000000000000000000000000000000002000000000200800020000000000000000000200000000000000000000000008000000000000000000000",
        "miner": "0x0000000000000000000000000000000000000000",
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "nonce": "0x0000000000000000",
        "number": "0x4777962",
        "parentHash": "0xc1c52c72a20f9717472d2682205ff9a2e26e7450af0e3c70f45c65e695e27916",
        "receiptsRoot": "0x30362eab5823888eaf08ea4ec8c2bf7856d7bfeba9eb98cad0c1a6de92ca754a",
        "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
        "size": "0x337",
        "stateRoot": "0x7fdbea84428c764d4a8757e6057046dfcd15f0f482a57a51f1f3659c4b1059ce",
        "timestamp": "0x63ef4ee7",
        "totalDifficulty": "0x8eef2c5",
        "transactions": [\
            "0x8fcf92cce7a7a7803a18737d5ead11ab3afffd8394e8ee1fb8ccfd7227d1cdbd"\
        ],
        "transactionsRoot": "0x6dc519ebb4d0acbdbea7a7e676264e66f22cd847016ce584ff20259a00bb74a3",
        "uncles": []
    }
}
```

* * *

## `eth_getBlockByNumber` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_getblockbynumber/index.html)

> Returns information for the block specified by block number.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-21/index.html)

1. `<string>` (quantity\|tag): either the hex value of a _block number_ or one of the following _block tags_:

2. `<boolean>`: if `true` it returns the full transaction objects, if `false` — only the hashes of the transactions.

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-21/index.html)

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-21/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getBlockByNumber",
      "params": ["0x4777962", false],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-20/index.html)

* * *

## `eth_getTransactionByHash` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_gettransactionbyhash/index.html)

> Returns information on a transaction specified by transaction hash.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-22/index.html)

1. `<string>` (data, 32 bytes): a transaction hash.

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-22/index.html)

- `blockHash` (string; data, 32 bytes): a hash of the block containing the transaction; null when it's pending.
- `blockNumber` (string; quantity): a number of the block containing the transaction; null when it's pending.
- `from` (string; data, 20 bytes): an address of the sender.
- `gas` (string; quantity): the gas provided by the sender.
- `gasPrice` (string; quantity): the gas price provided by the sender in wei.
- `hash` (string; data, 32 bytes): the hash of the transaction.
- `input` (string; data): the data send along with the transaction.
- `nonce` (string; quantity): the number of transactions made by the sender prior to this one.
- `to` (string: data, 20 bytes): an address of the receiver: null when it's a contract creation transaction.
- `transactionIndex` (string; quantity): the transaction index position in the block; null when it's pending.
- `value` (string; quantity): the value transferred in wei.
- `v` (string; quantity): ECDSA recovery ID.
- `r` (string; quantity): ECDSA signature r.
- `s` (string; quantity): ECDSA signature s.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-22/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getTransactionByHash",
      "params": ["0x635add970f86930850511ed1a490512d72135ea255f9e2e37b17ab4e4331f726"],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-21/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "blockHash": "0xa2456a6d9186112c41e8e00a182a390d0453cd97bdbd0702f362c75db4f11703",
        "blockNumber": "0x4777969",
        "from": "0xf9e8466141d032aaae3306227bb34c8278737425",
        "gas": "0x73347",
        "gasPrice": "0xf4240",
        "hash": "0x635add970f86930850511ed1a490512d72135ea255f9e2e37b17ab4e4331f726",
        "input": "0xd294f093",
        "nonce": "0x4c",
        "to": "0x4a16a42407aa491564643e1dfc1fd50af29794ef",
        "transactionIndex": "0x0",
        "value": "0x0",
        "v": "0x37",
        "r": "0xf0d949424a51f2f1e2f61fd095588d42ad89f0b861cdb1d16f3d2471bb17a3e",
        "s": "0x285287ca022d5a057cc3c498f7bab00340379544db9064f81c7933cab48cda79",
        "queueOrigin": "sequencer",
        "l1TxOrigin": null,
        "l1BlockNumber": "0xfe05cd",
        "l1Timestamp": "0x63ef4ef6",
        "index": "0x4777968",
        "queueIndex": null,
        "rawTransaction": "0xf8674c830f424083073347944a16a42407aa491564643e1dfc1fd50af29794ef8084d294f09337a00f0d949424a51f2f1e2f61fd095588d42ad89f0b861cdb1d16f3d2471bb17a3ea0285287ca022d5a057cc3c498f7bab00340379544db9064f81c7933cab48cda79"
    }
}
```

* * *

## `eth_getTransactionByBlockHashAndIndex` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_gettransactionbyblockhashandindex/index.html)

> Returns information on a transaction specified by block hash and transaction index position.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-23/index.html)

1. `<string>` (data, 32 bytes): a block hash.
2. `<string>` (quantity): a transaction index position.

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-23/index.html)

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-23/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getTransactionByBlockHashAndIndex",
      "params": ["0x6326ed6707a6c28b52994295610963173655a1d127ea637f174ed733d66d4824", "0x0"],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-22/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "blockHash": "0x6326ed6707a6c28b52994295610963173655a1d127ea637f174ed733d66d4824",
        "blockNumber": "0x4777962",
        "from": "0x7e9c7856d6d5c676bc4e8ba916fb9e0d9f56c0e7",
        "gas": "0x1f2d4",
        "gasPrice": "0xf4240",
        "hash": "0x8fcf92cce7a7a7803a18737d5ead11ab3afffd8394e8ee1fb8ccfd7227d1cdbd",
        "input": "0x3a1b1d570000000000000000000000007e9c7856d6d5c676bc4e8ba916fb9e0d9f56c0e700000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000",
        "nonce": "0x11",
        "to": "0xf2d409bc24300f248fdd3b1e067de24be28abb85",
        "transactionIndex": "0x0",
        "value": "0x38d7ea4c68000",
        "v": "0x37",
        "r": "0xfc37422e663092cda2f59aeb848ec306d503c7a09a074f778014168bf718aeb2",
        "s": "0x7eeb40d7d0c95fba51d096560a4aa3a47d5803ab54d98bd39209ac298ecd3039",
        "queueOrigin": "sequencer",
        "l1TxOrigin": null,
        "l1BlockNumber": "0xfe05cd",
        "l1Timestamp": "0x63ef4ee7",
        "index": "0x4777961",
        "queueIndex": null,
        "rawTransaction": "0xf8cf11830f42408301f2d494f2d409bc24300f248fdd3b1e067de24be28abb8587038d7ea4c68000b8643a1b1d570000000000000000000000007e9c7856d6d5c676bc4e8ba916fb9e0d9f56c0e70000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000037a0fc37422e663092cda2f59aeb848ec306d503c7a09a074f778014168bf718aeb2a07eeb40d7d0c95fba51d096560a4aa3a47d5803ab54d98bd39209ac298ecd3039"
    }
}
```

* * *

## `eth_getTransactionByBlockNumberAndIndex` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_gettransactionbyblocknumberandindex/index.html)

> Returns information on a transaction by block number and transaction index position.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-24/index.html)

1. `<string>` (quantity\|tag): either the hex value of a _block number_ or one of the following _block tags_:

2. `<string>` (quantity): the transaction index position.

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-24/index.html)

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-24/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getTransactionByBlockNumberAndIndex",
      "params": ["0x4777962", "0x0"],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-23/index.html)

* * *

## `eth_getTransactionReceipt` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_gettransactionreceipt/index.html)

> Returns the receipt of a transaction by transaction hash.

The receipt is not available for pending transactions.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-25/index.html)

1. `<string>` (data, 32 bytes): a hash of the transaction.

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-25/index.html)

- `object`: a transaction receipt object, or null when no receipt was found:

- `transactionHash` (string; data, 32 bytes): a hash of the transaction.

- `transactionIndex` (string; quantity): the transactions index position in the block.

- `blockHash` (string; data, 32 bytes): a hash of the block containing the transaction.

- `blockNumber` (string; quantity): a number of the block containing the transaction.

- `from` (string; data, 20 bytes): an address of the sender.

- `to` (string; data, 20 bytes): an address of the receiver; null when it's a contract creation transaction.

- `cumulativeGasUsed` (string; quantity): the total amount of gas used when this transaction was executed in the block.

- `effectiveGasPrice` (string; quantity): the sum of the base fee and tip paid per unit of gas.

- `gasUsed` (string; quantity): the amount of gas used by this specific transaction alone.

- `contractAddress` (string; data, 20 bytes): the contract address created, if the transaction was a contract creation, otherwise null.

- `logs` (array): an array of log objects, which this transaction generated.

- `logsBloom` (string; data, 256 bytes): a bloom filter for light clients to quickly retrieve related logs.

- `type` (string; data): the transaction type, `0x00` for legacy transactions, `0x01` for access list types, `0x02` for dynamic fees. It also returns either of the following:

- `root` (string; data, 32 bytes): a post-transaction stateroot (pre Byzantium).

- `status` (string; quantity): either 1 (success) or 0 (failure).

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-25/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getTransactionReceipt",
      "params": ["0x33bf901ebb3e623a06069dbffd91eeb32e5355f88b500e18b7e35ae643ccaa85"],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-24/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "blockHash": "0xba3b252e1c01a6519c8e7e10889ef856daebae7be561cd209df5c9f371442b3d",
        "blockNumber": "0x4777963",
        "contractAddress": null,
        "cumulativeGasUsed": "0x196bc",
        "from": "0xb1a396af608a464344c6d61894260144419bcfb3",
        "gasUsed": "0x196bc",
        "l1Fee": "0x6422c2699180",
        "l1FeeScalar": "1",
        "l1GasPrice": "0x589ffb0e0",
        "l1GasUsed": "0x1214",
        "logs": [\
            {\
                "address": "0x4200000000000000000000000000000000000006",\
                "topics": [\
                    "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",\
                    "0x00000000000000000000000068f5c0a2de713a54991e01858fd27a3832401849",\
                    "0x000000000000000000000000ff8c6e782bdbceba8bd0ee7ea2556ea7df580b9b"\
                ],\
                "data": "0x000000000000000000000000000000000000000000000000190fc71d7d5ef813",\
                "blockNumber": "0x4777963",\
                "transactionHash": "0x33bf901ebb3e623a06069dbffd91eeb32e5355f88b500e18b7e35ae643ccaa85",\
                "transactionIndex": "0x0",\
                "blockHash": "0xba3b252e1c01a6519c8e7e10889ef856daebae7be561cd209df5c9f371442b3d",\
                "logIndex": "0x0",\
                "removed": false\
            },\
            {\
                "address": "0x4200000000000000000000000000000000000042",\
                "topics": [\
                    "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",\
                    "0x000000000000000000000000ff8c6e782bdbceba8bd0ee7ea2556ea7df580b9b",\
                    "0x00000000000000000000000068f5c0a2de713a54991e01858fd27a3832401849"\
                ],\
                "data": "0x00000000000000000000000000000000000000000000003bce4a60159782cc40",\
                "blockNumber": "0x4777963",\
                "transactionHash": "0x33bf901ebb3e623a06069dbffd91eeb32e5355f88b500e18b7e35ae643ccaa85",\
                "transactionIndex": "0x0",\
                "blockHash": "0xba3b252e1c01a6519c8e7e10889ef856daebae7be561cd209df5c9f371442b3d",\
                "logIndex": "0x1",\
                "removed": false\
            }\
\
        ],
        "logsBloom": "0x00000000000000000000000000000000000000000000000000040000000000000000000000000000000000100000000000000000000020000000000000000040000000000000000820000008080000000000000000000000000200000000000000000000100000000004000000000000000000000000000000000010000800000000000004000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000002000000000000000000000000008000000002000000000000000000000000000000000000000000401000000000000000000000000000000000000000",
        "status": "0x1",
        "to": "0xff8c6e782bdbceba8bd0ee7ea2556ea7df580b9b",
        "transactionHash": "0x33bf901ebb3e623a06069dbffd91eeb32e5355f88b500e18b7e35ae643ccaa85",
        "transactionIndex": "0x0"
    }
}
```

* * *

## `eth_getUncleByBlockHashAndIndex` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_getunclebyblockhashandindex/index.html)

> Returns information about an uncle of a block by hash and uncle index position.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-26/index.html)

1. `<string>` (data, 32 bytes): the hash of a block.
2. `<string>` (quantity): the uncle's index position.

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-26/index.html)

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-26/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getUncleByBlockHashAndIndex",
      "params": ["0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b", "0x0"],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-25/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "difficulty": "0x4ea3f27bc",
        "extraData": "0x476574682f4c5649562f76312e302e302f6c696e75782f676f312e342e32",
        "gasLimit": "0x1388",
        "gasUsed": "0x0",
        "hash": "0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae",
        "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "miner": "0xbb7b8287f3f0a933474a79eae42cbca977791171",
        "mixHash": "0x4fffe9ae21f1c9e15207b1f472d5bbdd68c9595d461666602f2be20daf5e7843",
        "nonce": "0x689056015818adbe",
        "number": "0x1b4",
        "parentHash": "0xe99e022112df268087ea7eafaf4790497fd21dbeeb6bd7a1721df161a6657a54",
        "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
        "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
        "size": "0x220",
        "stateRoot": "0xddc8b0234c2e0cad087c8b389aa7ef01f7d79b2570bccb77ce48648aa61c904d",
        "timestamp": "0x55ba467c",
        "totalDifficulty": "0x78ed983323d",
        "transactions": [],
        "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
        "uncles": []
    }
}
```

* * *

## `eth_getUncleByBlockNumberAndIndex` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_getunclebyblocknumberandindex/index.html)

> Returns information about an uncle of a block by number and uncle index position.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-27/index.html)

1. `<string>` (quantity\|tag): either the hex value of a _block number_ or one of the following _block tags_:

2. `<string>` (quantity): the uncle's index position.

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-27/index.html)

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-27/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getUncleByBlockNumberAndIndex",
      "params": ["0x2B901D", "0x0"],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-26/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "difficulty": "0x57f117f5c",
        "extraData": "0x476574682f76312e302e302f77696e646f77732f676f312e342e32",
        "gasLimit": "0x1388",
        "gasUsed": "0x0",
        "hash": "0x932bdf904546a2287a2c9b2ede37925f698a7657484b172d4e5184f80bdd464d",
        "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "miner": "0x5bf5e9cf9b456d6591073513de7fd69a9bef04bc",
        "mixHash": "0x4500aa4ee2b3044a155252e35273770edeb2ab6f8cb19ca8e732771484462169",
        "nonce": "0x24732773618192ac",
        "number": "0x299",
        "parentHash": "0xa779859b1ee558258b7008bbabff272280136c5dd3eb3ea3bfa8f6ae03bf91e5",
        "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
        "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
        "size": "0x21d",
        "stateRoot": "0x2604fbf5183f5360da249b51f1b9f1e0f315d2ff3ffa1a4143ff221ad9ca1fec",
        "timestamp": "0x55ba4827",
        "totalDifficulty": "0xc46826a2c6a",
        "transactions": [],
        "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
        "uncles": []
    }
}
```

* * *

## `eth_getLogs` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_getlogs/index.html)

> Returns an array of all logs matching a given filter object.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-28/index.html)

1. `object`: the filter options:

- `fromBlock` (string; quantity\|tag; optional; default: "latest"): either a hex of the _block number_ or one of the following _block tags_:
  - `latest`: for the last mined block.
  - `earliest`: for the lowest numbered block available on the client.
  - `pending`: for not yet mined transactions.
- `toBlock` (string; quantity\|tag; optional; default: "latest"): either the _block number_ or one of the following _block tags_:
  - `latest`: for the last mined block.
  - `earliest`: for the lowest numbered block available on the client.
  - `pending`: for not yet mined transactions.
- `address` (array of strings; data, 20 bytes; optional): a contract address or a list of addresses from which logs should originate.

- `topics` (array of strings; data; optional): an array of 32 bytes data topics. Topics are order-dependent. Each topic can also be an array of data with "or" options.

- `blockhash` (string; data, 32 bytes; optional; **future**): with the addition of EIP-234, `blockHash` will be a new filter option which restricts the logs returned to the single block with the 32-byte hash blockHash. Using blockHash is equivalent to `fromBlock = toBlock = the block` number with hash blockHash. If `blockHash` is present in the filter criteria, then neither `fromBlock` nor `toBlock` are allowed.

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-28/index.html)

- `removed` (string; tag): `true` when the log was removed, due to a chain reorganization; `false` if it's a valid log.
- `logIndex` (string; quantity): the log index position in the block; null when it's a pending log.
- `transactionIndex` (string; quantity): the transactions index position log was created from; null when it's a pending log.
- `transactionHash` (string; data, 32 bytes): a hash of the transactions this log was created from; null when it's a pending log.
- `blockHash` (string; data, 32 bytes): a hash of the block containing the log; null when it's pending; null when it's a pending log.
- `blockNumber` (string; quantity): the number of the block containing the log; null when it's pending; null when it's a pending log.
- `address` (string; data, 20 bytes): an address from which this log originated.
- `data` (string; data): contains one or more 32 bytes non-indexed arguments of the log.
- `topics` (array of strings; data): an array of 0 to 4 32 bytes data of indexed log arguments. (In solidity: The first topic is the hash of the signature of the event (e.g. Deposit(address,bytes32,uint256)), except you declared the event with the anonymous specifier.)

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-28/index.html)

```
curl -X POST https://rpc.ankr.com/optimism/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getLogs",
      "params": [{"address": "0x5Da70A90CaAf7015DE9754709400a97A988476DB"}],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-27/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": [\
        {\
            "address": "0xdac17f958d2ee523a2206206994597c13d831ec7",\
            "topics": [\
                "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",\
                "0x0000000000000000000000009acbb72cf67103a30333a32cd203459c6a9c3311",\
                "0x000000000000000000000000994871e1103c5da4be270365fa62771ea4525520"\
            ],\
            "data": "0x000000000000000000000000000000000000000000000000000000001ec39aa0",\
            "blockNumber": "0xf6289d",\
            "transactionHash": "0xc7ed73c9b219d4243872e5993ad2950c8ea87d15af28562d33b0c05d46a90cee",\
            "transactionIndex": "0x1e",\
            "blockHash": "0x1e12377f0357320c0e5cfcadc2dfbc9c75fc339be668e118c34e4333f835ef31",\
            "logIndex": "0x13",\
            "removed": false\
        },\
        {\
            "address": "0xdac17f958d2ee523a2206206994597c13d831ec7",\
            "topics": [\
                "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",\
                "0x0000000000000000000000005879975799597392c031f10b6eff282cb7974ac8",\
                "0x0000000000000000000000006d52ab66340f3f78d0c1007bec484268876b5948"\
            ],\
            "data": "0x0000000000000000000000000000000000000000000000000000000000000000",\
            "blockNumber": "0xf6289d",\
            "transactionHash": "0x0118499f7be4c3510bd60fe3a3aee5f5f316743b6cc13a8cb0528d784f962aec",\
            "transactionIndex": "0x20",\
            "blockHash": "0x1e12377f0357320c0e5cfcadc2dfbc9c75fc339be668e118c34e4333f835ef31",\
            "logIndex": "0x14",\
            "removed": false\
        }\
    ]
}
```

* * *

## Flashblocks methods [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#flashblocks-methods/index.html)

Flashblocks is a core Optimism feature that provides preconfirmation of the upcoming block's transaction ordering (~250 milliseconds) before the full block is sealed (~2 seconds).

This enables ultra-fast transaction feedback, allowing applications to deliver instant and interactive user experiences. Flashblocks are particularly valuable for high-frequency trading platforms, real-time games, live dashboards, and other latency-sensitive use cases where even a brief delay feels disruptive.

Flashblocks are integrated directly into Optimism’s block production process, therefore developers gain the advantages of low-latency feedback without compromising security or reliability. The result is a seamless foundation for applications that demand speed, responsiveness, and trust.

The following RPC methods can return Flashblocks specific data:

- [`eth_getBlockByNumber`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_getblockbynumber-1/index.html) — with `pending`, retrieves the latest Flashblock.
- [`eth_getTransactionReceipt`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_gettransactionreceipt-1/index.html) — retrieves receipts for preconfirmed transactions.
- [`eth_getBalance`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_getbalance-1/index.html) — with `pending`, retrieves the address balance in the latest Flashblock.
- [`eth_getTransactionCount`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_gettransactioncount-1/index.html) — with `pending`, retrieves the address nonce in the latest Flashblock.
- [`eth_getTransactionByHash`](/content/docs/rpc-service/chains/chains-api/optimism/#eth_gettransactionbyhash-1/index.html) — retrieves preconfirmed transactions by hash.

* * *

## `eth_getBlockByNumber` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_getblockbynumber-1/index.html)

> Use the `pending` tag to retrieve the latest Flashblock.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-29/index.html)

- `id` (integer; required): a request ID (example: 1).

- `jsonrpc` (string; required): a JSON RPC spec used (example: 2.0).

- `method` (string; required): a method used for the request.

- `params` (array; required):
1. `<string>` (tag; required): use the `pending` tag to retrieve the latest Flashblock.
2. `<boolean>` (required): if `true` — returns the full transaction objects, if `false` — only the hashes of the transactions.

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-29/index.html)

Retrieves the latest Flashblock object.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-29/index.html)

```
curl -X POST https://rpc.ankr.com/optimism_sepolia/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getBlockByNumber",
      "params": ["pending", false],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-28/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "hash": "0x6d2235b907f1b9bebc438295e8b463350d2136921b064b7b31d2ce42d4d99c27",
        "parentHash": "0x20ee9c451a2219c826dd3700174aff97555d4808ec87f8e47619de5166962529",
        "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
        "miner": "0x4200000000000000000000000000000000000011",
        "stateRoot": "0x93c4bac442017a87354b6ba55f498cd109681dab6b70d099a219123eb65b9543",
        "transactionsRoot": "0xd7c029100fe389472c79fdaeb96f7666ac908d65985f0186dc816ed065571212",
        "receiptsRoot": "0x1764372c2fc041df71a78317a4b079715f8f9e9ebe1020555713e172590ec9d3",
        "logsBloom": "0x00000000000020000000000100000000100010000000021000020000000000000000040000000000000200000200000000040008000000000000000000000000000000000000000000000058000000000000000000000000000000000000000000000000000000080000000000000000000000000010000000200010008000200000000000000000000002000000000800000000000001000000040000000000002002002010000000000000000000000000000040000000000800000000000000000002000000000000000000000000020010000020000000002000002000000000000000000000000000000010000800000000000000000000000100000002",
        "difficulty": "0x0",
        "number": "0x1ec2650",
        "gasLimit": "0x2625a00",
        "gasUsed": "0x5a59a",
        "timestamp": "0x68af284c",
        "extraData": "0x00000000fa00000002",
        "mixHash": "0x2bc4e5b75df9b6d0aea4e90ab0457163c75a42c4ac388e702a0c14abca08ef48",
        "nonce": "0x0000000000000000",
        "baseFeePerGas": "0xfa",
        "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
        "blobGasUsed": "0x0",
        "excessBlobGas": "0x0",
        "uncles": [],
        "transactions": [\
            "0x97efaef5b0d4e71d082de8fbf5632523c7135112997ce61f174a0884617e28e0",\
            "0xd04f7ee714c5e6211b294e8d936ebdcec2040b72281a3a82c22d22bec558af3c",\
            "0xe7f598a737d67d8a27ddcac0091ff5ca8a3bc1fcb5bee910f9b67e9f3540232d"\
        ]
    }
}
```

* * *

## `eth_getTransactionReceipt` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_gettransactionreceipt-1/index.html)

> Retrieves the receipts for preconfirmed transactions.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-30/index.html)

- `id` (integer; required): a request ID (example: 1).

- `jsonrpc` (string; required): a JSON RPC spec used (example: 2.0).

- `method` (string; required): a method used for the request.

- `params` (array; required):
  - `<hash>` (string; required): the transaction hash.

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-30/index.html)

Returns preconfirmation-aware receipt data if the transaction is already included in a Flashblock.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-30/index.html)

```
curl -X POST https://rpc.ankr.com/optimism_sepolia/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getTransactionReceipt",
      "params": ["0x5a361f07e90d1745dfdffc005a41d336fe10581473195b88466dcbb998c39444"],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-29/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "type": "0x2",
        "status": "0x1",
        "cumulativeGasUsed": "0xed5781",
        "logs": [\
            {\
                "address": "0x09526c5844f836f4ef326924d8aa484f8cb135a1",\
                "topics": [\
                    "0xf67870b75d64e9a5f00100af39eb94911d9399b05f9df6d6db0cafc61128d5a4",\
                    "0x8a11667d4177561b72e3ba6db5f102ffb49778c6e7d66910d295cf2ef7db711e"\
                ],\
                "data": "0x",\
                "blockHash": "0x874c8b5d774c45a4e276a96884a8e43128c27b7116954ef0357a95090fbbd724",\
                "blockNumber": "0x1ec2729",\
                "blockTimestamp": "0x68af29fe",\
                "transactionHash": "0x5a361f07e90d1745dfdffc005a41d336fe10581473195b88466dcbb998c39444",\
                "transactionIndex": "0x5",\
                "logIndex": "0x1d2",\
                "removed": false\
            }\
        ],
        "logsBloom": "0x00000000000020000000000100000000000010000000021000000000000000000000040000000000000200000000000000000008000000000000000000000000000000000000000000000058000000000000000000000000800000000000000000000000000000000000000000000000000000000010000000200010000000000000000000000000000002800000000800000000000001000000000000000000000002000000000000000000000000000000000040000000010000000000000000000002000000000000000000000000020010000020000000000000002000000000000000000000000000000000000800000000000000000000000100000002",
        "transactionHash": "0x5a361f07e90d1745dfdffc005a41d336fe10581473195b88466dcbb998c39444",
        "transactionIndex": "0x5",
        "blockHash": "0x874c8b5d774c45a4e276a96884a8e43128c27b7116954ef0357a95090fbbd724",
        "blockNumber": "0x1ec2729",
        "gasUsed": "0x2a7dd",
        "effectiveGasPrice": "0xf433a",
        "from": "0xeee38505c47acba0c866df7265bd3e25da596b27",
        "to": "0x09526c5844f836f4ef326924d8aa484f8cb135a1",
        "contractAddress": null,
        "l1GasPrice": "0x721c2b",
        "l1GasUsed": "0x319e",
        "l1Fee": "0x2b0adac9",
        "l1BaseFeeScalar": "0x1db0",
        "l1BlobBaseFee": "0x100",
        "l1BlobBaseFeeScalar": "0xd2730"
    }
}
```

* * *

## `eth_getBalance` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_getbalance-1/index.html)

> Use the `pending` tag to retrieve the address balance in the latest Flashblock.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-31/index.html)

- `id` (integer; required): a request ID (example: 1).

- `jsonrpc` (string; required): a JSON RPC spec used (example: 2.0).

- `method` (string; required): a method used for the request.

- `params` (array; required):
1. `<string>` (required): the address to check the balance for.
2. `<string>` (tag; required): use the `pending` tag to retrieve the address balance in the latest Flashblock.

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-31/index.html)

The account balance in wei (hex-encoded string).

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-31/index.html)

```
curl -X POST https://rpc.ankr.com/optimism_sepolia/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getBalance",
      "params": ["0xeeE38505C47acBa0C866df7265bd3E25DA596b27", "pending"],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-30/index.html)

```
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": "0x13ad6697d3b4efea"
}
```

* * *

## `eth_getTransactionCount` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_gettransactioncount-1/index.html)

> Use the `pending` tag to retrieve the address nonce in the latest Flashblock.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-32/index.html)

- `id` (integer; required): a request ID (example: 1).

- `jsonrpc` (string; required): a JSON RPC spec used (example: 2.0).

- `method` (string; required): a method used for the request.

- `params` (array; required):
1. `<string>` (required): the account address to query.
2. `<string>` (tag; required): use `pending` to retrieve the nonce including the latest Flashblock state.

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-32/index.html)

The transaction count (nonce) of the given address, returned as a hex-encoded integer.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-32/index.html)

```
curl -X POST https://rpc.ankr.com/optimism_sepolia/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getTransactionCount",
      "params": ["0xf0970f5bb0968746d77fb3dCeCF480Bd414E06ED", "pending"],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-31/index.html)

```
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": "0x352"
}
```

* * *

## `eth_getTransactionByHash` [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#eth_gettransactionbyhash-1/index.html)

> Retrieves preconfirmed transactions by hash.

### Parameters [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#parameters-33/index.html)

- `id` (integer; required): a request ID (example: 1).

- `jsonrpc` (string; required): a JSON RPC spec used (example: 2.0).

- `method` (string; required): a method used for the request.

- `params` (array; required):
  - `<string>` (required): the hash of the transaction to retrieve.

### Returns [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#returns-33/index.html)

The transaction object if found (including when present in a Flashblock preconfirmation); null if the transaction is unknown.

### Request example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#request-example-33/index.html)

```
curl -X POST https://rpc.ankr.com/optimism_sepolia/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getTransactionByHash",
      "params": ["0xd309dcddf89e471a710094cc28be86f66566ae5cd7162ce1f7a3c45df65772d4"],
      "id": 1
    }'
```

### Response example [Permalink for this section](/content/docs/rpc-service/chains/chains-api/optimism/\#response-example-32/index.html)

```
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "type": "0x2",
        "chainId": "0xaa37dc",
        "nonce": "0x34c",
        "gas": "0x28e07",
        "maxFeePerGas": "0x596830f4",
        "maxPriorityFeePerGas": "0x59682f00",
        "to": "0xa374602fdccb9807d834598f0b2e2fa9c14646f7",
        "value": "0x2386f26fc10000",
        "accessList": [],
        "input": "0xa28d34940000000000000000000000000000000000000000000000000000000000000140082cee98f9a18608826f76ecfbf227b79cd652eb44572300b9880260b9ed137e00000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000009d4b000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000ca000000000000000000000000b64db3a171752f235e7156ba6590771c4a9358fb29aabec29925d19149012125ce17d62a67fcac8d5950f9dd33cb615b3470d059000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000000510100000000000000ca00009d4b000000000000000000000000000000000000000000000000000000000000000100009d28000000000000000000000000b64db3a171752f235e7156ba6590771c4a9358fb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000412fb2113f9109b2fb642f4e25acab3f5b3faf03b291c24d3cc7901169eb8e198e67944d2f1e00932877505a9202b40a79f0cd175d30b3c670bf0adbef4a99294f1c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028000000000000000000000000f0970f5bb0968746d77fb3dcecf480bd414e06ed00000000000013880000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "r": "0x659374c64f58415582526fa3ad1d0ea977b3a7852c3d22a139a50b548db02230",
        "s": "0x7b64cfcfa0cc294f6ba90a0779f3c15bb0375acf73dfbaeec116e4915eddee1c",
        "yParity": "0x0",
        "v": "0x0",
        "hash": "0xd309dcddf89e471a710094cc28be86f66566ae5cd7162ce1f7a3c45df65772d4",
        "blockHash": "0xe6c8a925882b5e982909257ec838d202d14dba64489420a1db09a33966c134e2",
        "blockNumber": "0x1ec2753",
        "transactionIndex": "0x1",
        "from": "0xf0970f5bb0968746d77fb3dcecf480bd414e06ed",
        "gasPrice": "0x59682ffa"
    }
}
```

Last updated on June 10, 2026

[Neura](/content/docs/rpc-service/chains/chains-api/neura/ "Neura"/index.html) [Polkadot](/content/docs/rpc-service/chains/chains-api/polkadot/ "Polkadot"/index.html)
