op-geth is the execution client for the OP Stack, based on Go Ethereum (Geth). It provides the execution layer with Ethereum-equivalent functionality plus OP Stack-specific enhancements for L2 gas accounting and receipts.
Overview
Theop-geth execution client implements the standard Ethereum JSON-RPC API with minimal modifications. This means you can use familiar Ethereum tools and libraries with OP Stack chains.
The execution engine’s RPC interface is identical to the upstream Geth RPC interface. The key difference is that transaction receipts include additional L1 gas usage and pricing information specific to L2 operations.
Key Differences from Ethereum
Whileop-geth maintains compatibility with Ethereum’s JSON-RPC API, there are important differences:
Transaction Receipts
Transaction receipts inop-geth include additional L1 data fee information:
l1GasUsed: Amount of L1 gas used for L1 data availabilityl1GasPrice: L1 gas price at the time of transaction executionl1Fee: Total L1 data fee charged (in wei)l1FeeScalar: Scalar value used in L1 fee calculation
Gas Price Calculation
For L2 gas prices, use the standardeth_gasPrice method.
For L1 gas prices and fee estimation, use the GasPriceOracle predeployed contract or the Optimism SDK.
Standard JSON-RPC Methods
op-geth supports all standard Ethereum JSON-RPC methods. Below are commonly used methods with examples.
eth_blockNumber
Returns the number of the most recent block.- curl
- cast
eth_getBalance
Returns the balance of the account at the given address.- curl
- cast
eth_getTransactionByHash
Returns information about a transaction by transaction hash.- curl
- cast
eth_getTransactionReceipt
Returns the receipt of a transaction by transaction hash. This method includes OP Stack-specific L1 fee fields.- curl
- cast
Notice the additional fields at the end of the receipt:
l1GasUsed, l1GasPrice, l1Fee, and l1FeeScalar. These fields are specific to OP Stack chains and provide information about L1 data availability costs.eth_call
Executes a new message call immediately without creating a transaction on the blockchain.- curl
- cast
eth_estimateGas
Generates and returns an estimate of gas needed for a transaction to complete.- curl
- cast
eth_sendRawTransaction
Submits a signed transaction to the network.- curl
- cast
eth_getBlockByNumber
Returns information about a block by block number.- curl
- cast
eth_getLogs
Returns an array of all logs matching a given filter object.- curl
- cast
eth_chainId
Returns the currently configured chain ID, used for signing replay-protected transactions.- curl
- cast
Gas Price Methods
eth_gasPrice
Returns the current gas price in wei for L2 execution.- curl
- cast
This only returns the L2 gas price. For comprehensive transaction cost estimation including L1 data fees, use the
GasPriceOracle predeployed contract or the Optimism SDK.eth_maxPriorityFeePerGas
Returns the current maximum priority fee per gas (EIP-1559).- curl
- cast
Account and State Methods
eth_getCode
Returns code at a given address.- curl
- cast
eth_getStorageAt
Returns the value from a storage position at a given address.- curl
- cast
eth_getTransactionCount
Returns the number of transactions sent from an address (the nonce).- curl
- cast
Debug and Trace Methods
op-geth supports the same debug and trace methods as upstream Geth, allowing detailed transaction analysis and debugging.
debug_traceTransaction
Returns the trace of a transaction, showing all internal calls and state changes.- curl
- cast
debug_traceCall
Traces a call without executing it on-chain.- curl
WebSocket Support
op-geth supports WebSocket connections for real-time event subscriptions using the eth_subscribe method.
eth_subscribe
Creates a subscription for specific events.eth_unsubscribe
Cancels an active subscription.Additional Resources
For a complete list of all supported JSON-RPC methods, refer to:Running a Node with RPC Access
To run your ownop-geth node with full RPC access: