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
eth_getBlockRangeDEPRECATION 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
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).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).BOOLEAN- Iftrueit returns the full transaction objects, iffalseonly 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
rollup_getInfoReturns useful L2-specific information about the current node.
Parameters
None
Returns
Object
mode:STRING-"sequencer"or"verifier"depending on the node's mode of operationsyncing:BOOLEAN-trueif the node is currently syncing,falseotherwiseethContext:OBJECTblockNumber:QUANTITY- Block number of the latest known L1 blocktimestamp:QUANTITY- Timestamp of the latest known L1 block
rollupContext:OBJECTqueueIndex:QUANTITY- Index within the CTC of the last L1 to L2 message ingestedindex:QUANTITY- Index of the last L2 tx processedverifiedIndex:QUANTITY- Index of the last tx that was ingested from a batch that was posted to L1
Example
rollup_gasPrices
rollup_gasPricesReturns 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
eth_getAccountsThis 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
eth_sendTransactionHabtor 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