JSON-RPC API

JSON-RPC API

Habtor Network shares the same JSON-RPC API (opens new window)as Ethereum. Some custom methods have been introduced to simplify certain Optimistic Ethereum specific interactions.

Custom JSON-RPC Methods

NOTICE

Custom JSON-RPC methods are currently highly subject to change. We strongly discourage relying on these JSON-RPC methods.


eth_getBlockRange

DEPRECATION NOTICE

We will likely remove this method in a future release in favor of simply using batched RPC requests. If your application relies on this method, please file an issue and we will provide a migration path. Otherwise, please use eth_getBlockByNumber instead.

Like eth_getBlockByNumber but accepts a range of block numbers instead of just a single block.

Parameters

  1. QUANTITY|TAG - integer of the starting block number for the range, or the string "earliest", "latest" or "pending", as in the default block parameter (opens new window).

  2. QUANTITY|TAG - integer of the ending block number for the range, or the string "earliest", "latest" or "pending", as in the default block parameter (opens new window).

  3. BOOLEAN - If true it returns the full transaction objects, if false only the hashes of the transactions.

Returns

An array of block objects. See eth_getBlockByHash (opens new window)for the structure of a block object.

Example


rollup_getInfo

Returns useful L2-specific information about the current node.

Parameters

None

Returns

Object

  • mode: STRING - "sequencer" or "verifier" depending on the node's mode of operation

  • syncing: BOOLEAN - true if the node is currently syncing, false otherwise

  • ethContext: OBJECT

    • blockNumber: QUANTITY - Block number of the latest known L1 block

    • timestamp: QUANTITY - Timestamp of the latest known L1 block

  • rollupContext: OBJECT

    • queueIndex: QUANTITY - Index within the CTC of the last L1 to L2 message ingested

    • index: QUANTITY - Index of the last L2 tx processed

    • verifiedIndex: QUANTITY - Index of the last tx that was ingested from a batch that was posted to L1

Example


rollup_gasPrices

Returns the L1 and L2 gas prices that are being used by the Sequencer to calculate fees.

Parameters

None

Returns

Object

  • l1GasPrice: QUANTITY - L1 gas price in wei that the Sequencer will use to estimate the L1 portion of fees (calldata costs).

  • l2GasPrice: QUANTITY - L2 gas price in wei that the Sequencer will use to estimate the L2 portion of fees (execution costs).

Example


Unsupported JSON-RPC methods

eth_getAccounts

This method is used to retrieve a list of addresses owned by a user. Habtor Network nodes do not expose internal wallets for security reasons and therefore block the eth_getAccounts method by default. You should use external wallet software as an alternative.

eth_sendTransaction

Habtor Network nodes also block the eth_sendTransaction method for the same reasons as eth_getAccounts. You should use external wallet software as an alternative. Please note that this is not the same as the eth_sendRawTransaction method, which accepts a signed transaction as an input. eth_sendRawTransaction is supported by Habtor Network.

Last updated