For the complete documentation index, see llms.txt. This page is also available as Markdown.

Optimism (OP)

Optimism Network API Reference for efficient interaction with OP nodes, enabling scalable, low-cost transactions and fast finality through Layer 2 solutions on the Ethereum blockchain.

Optimism is a Layer 2 scaling solution for Ethereum that uses Optimistic Rollup technology to achieve high throughput and low transaction costs while inheriting Ethereum's security. Developed by the Optimism Collective, it enables near-instant transactions by executing them off-chain and posting compressed transaction data to Ethereum mainnet. The network is EVM-equivalent, meaning existing Ethereum smart contracts and tools work seamlessly without modification.

Key Features

  • EVM Equivalence: Full compatibility with Ethereum Virtual Machine, allowing direct deployment of existing Solidity contracts

  • Optimistic Rollups: Transactions are assumed valid by default, with a 7-day challenge period for fraud proofs

  • Low Transaction Fees: Fees typically 10-100x lower than Ethereum mainnet

  • Fast Transactions: Near-instant transaction confirmations (~2 second block time)

  • Ethereum Security: Inherits security from Ethereum L1 through data availability and fraud proofs

  • OP Token: Native governance token for the Optimism Collective

  • Superchain Vision: Part of the broader Superchain ecosystem with shared security and interoperability

  • Bedrock Upgrade: Latest architecture providing improved performance and EVM equivalence

  • Developer-Friendly: Compatible with MetaMask, Hardhat, Foundry, and all standard Ethereum tools

TECHNICAL DISCLAIMER: AUTHORITATIVE JSON-RPC API SPECIFICATION.

GetBlock's RPC API reference documentation is provided exclusively for informational purposes and to optimize the developer experience. The canonical and normative specification for Ethereum Virtual Machine (EVM) JSON-RPC methods is solely maintained and published through the official Ethereum Foundation documentation portal at ethereum.org. For Optimism-specific methods, refer to the official Optimism documentation at docs.optimism.io.

Network Information

Property
Value

Network Name

Optimism Mainnet

Chain ID

10

Native Currency

ETH

Decimals

18

Block Time

~2 seconds

Consensus

Optimistic Rollup

EVM Compatible

Yes (EVM Equivalent)

L1 Settlement

Ethereum Mainnet

Base URL

Supported Networks

Network
Chain ID
JSON-RPC
WSS
Frankfurt, Germany
GraphQL

Mainnet

10

✅

✅

✅

✅

Sepolia Testnet

11155420

✅

✅

✅

❌

Quickstart

1

Setup project

Create and initialize a new project:

2

Install Axios

3

Create file

Create a new file named index.js. This is where you will make your first call.

4

Set ES module type

Set the ES module "type": "module" in your package.json.

5

Add code

Add the following code to index.js:

Replace <ACCESS-TOKEN> with your actual access token from GetBlock.

6

Run the script

Expected output (example):

1

Set up the project directory

2

Create and activate a virtual environment

3

Install requests

4

Create script

Create a file called main.py with the following content:

Replace <ACCESS-TOKEN> with your actual access token from GetBlock.

5

Run the script

Available API Methods

Account/State Methods

Method
Description

eth_accounts

Returns addresses owned by client

eth_getBalance

Returns the ETH balance of an address

eth_getStorageAt

Returns the value at a storage position

eth_getCode

Returns the bytecode at an address

eth_getProof

Returns account and storage Merkle proofs

eth_call

Executes a call without creating a transaction

Block Methods

Method
Description

eth_blockNumber

Returns the current block number

eth_getBlockByHash

Returns block information by hash

eth_getBlockByNumber

Returns block information by number

eth_getBlockTransactionCountByHash

Returns transaction count in a block by hash

eth_getBlockTransactionCountByNumber

Returns transaction count in a block by number

Transaction Methods

Method
Description

eth_sendRawTransaction

Submits a signed transaction to the network

eth_getTransactionByHash

Returns transaction details by hash

eth_getTransactionByBlockHashAndIndex

Returns transaction by block hash and index

eth_getTransactionByBlockNumberAndIndex

Returns transaction by block number and index

eth_getTransactionCount

Returns the nonce (transaction count) for an address

eth_getTransactionReceipt

Returns the receipt of a mined transaction

Gas Methods

Method
Description

eth_gasPrice

Returns the current L2 gas price in wei

eth_estimateGas

Estimates gas needed for a transaction

Filter Methods

Method
Description

eth_getLogs

Returns logs matching filter criteria

eth_newFilter

Creates a new log filter

eth_newBlockFilter

Creates a filter for new blocks

eth_newPendingTransactionFilter

Creates a filter for pending transactions

eth_getFilterChanges

Returns filter changes since last poll

eth_getFilterLogs

Returns all logs matching filter

eth_uninstallFilter

Removes an existing filter

Subscription Methods (WebSocket)

Method
Description

eth_subscribe

Creates a subscription for events

eth_unsubscribe

Cancels an existing subscription

Uncle Methods

Method
Description

eth_getUncleByBlockHashAndIndex

Returns uncle block by hash and index

eth_getUncleByBlockNumberAndIndex

Returns uncle block by number and index

eth_getUncleCountByBlockHash

Returns uncle count in a block by hash

eth_getUncleCountByBlockNumber

Returns uncle count in a block by number

Network/Chain Methods

Method
Description

eth_chainId

Returns the chain ID (10)

eth_syncing

Returns sync status of the node

net_version

Returns the network ID

net_listening

Returns listening status

net_peerCount

Returns number of connected peers

web3_clientVersion

Returns the client version

web3_sha3

Returns Keccak-256 hash of data

rpc_modules

Returns enabled RPC modules

Support

For technical support and questions:

See Also

Last updated

Was this helpful?