JSON-RPC API

JSON-RPC API

Boba 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. 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. 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. 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
1
// Request
2
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockRange","params":["0x1", "0x2", false],"id":1}' <node url>
3
4
// Result
5
{
6
"jsonrpc":"2.0",
7
"id":1,
8
"result":[
9
{
10
"difficulty":"0x2",
11
"extraData":"0xd98301090a846765746889676f312e31352e3133856c696e75780000000000009c3827892825f0825a7e329b6913b84c9e4f89168350aff0939e0e6609629f2e7f07f2aeb62acbf4b16a739cab68866f4880ea406583a4b28a59d4f55dc2314e00",
12
"gasLimit":"0xe4e1c0",
13
"gasUsed":"0x3183d",
14
"hash":"0xbee7192e575af30420cae0c7776304ac196077ee72b048970549e4f08e875453",
15
"logsBloom":"0x00000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000400000000000100000000000000200000000002000000000000001000000000000000000004000000000000000000000000000040000400000100400000000000000100000000000000000000000000000020000000000000000000000000000000000000000000000001000000000000000000000100000000000000000000000000000000000000000000000000000000000000088000000080000000000010000000000000000000000000000800008000120000000000000000000000000000000002000",
16
"miner":"0x0000000000000000000000000000000000000000",
17
"mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
18
"nonce":"0x0000000000000000",
19
"number":"0x1",
20
"parentHash":"0x7ca38a1916c42007829c55e69d3e9a73265554b586a499015373241b8a3fa48b",
21
"receiptsRoot":"0xf4c97b1186b690ad3318f907c0cdaf46f4598f27f711a5609064b2690a767287",
22
"sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
23
"size":"0x30c",
24
"stateRoot":"0xd3ac40854cd2ac17d8effeae6065cea990b04be714f7061544973feeb2f1c95f",
25
"timestamp":"0x618d8837",
26
"totalDifficulty":"0x3",
27
"transactions":["0x5e77a04531c7c107af1882d76cbff9486d0a9aa53701c30888509d4f5f2b003a"],
28
"transactionsRoot":"0x19f5efd0d94386e72fcb3f296f1cb2936d017c37487982f76f09c591129f561f",
29
"uncles":[]
30
},
31
{
32
"difficulty":"0x2",
33
"extraData":"0xd98301090a846765746889676f312e31352e3133856c696e757800000000000064a82cb66c7810b9619e7f14ab65c769a828b1616974987c530684eb3870b65e5b2400c1b61c6d340beef8c8e99127ac0de50e479d21f0833a5e2910fe64b41801",
34
"gasLimit":"0xe4e1c0",
35
"gasUsed":"0x1c60d",
36
"hash":"0x45fd6ce41bb8ebb2bccdaa92dd1619e287704cb07722039901a7eba63dea1d13",
37
"logsBloom":"0x00080000000200000000000000000008000000000000000000000100008000000000000000000000000000000000000000000000000000000000400000000000100000000000000000000000020000000000000000000000000000000000004000000000000000000000000000000000400000000400000000000000100000000000000000000000000000020000000000000000000000000000000000000000100000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000008400000000000000000010000000000000000020000000020000000000000000000000000000000000000000000002000",
38
"miner":"0x0000000000000000000000000000000000000000",
39
"mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
40
"nonce":"0x0000000000000000","number":"0x2",
41
"parentHash":"0xbee7192e575af30420cae0c7776304ac196077ee72b048970549e4f08e875453",
42
"receiptsRoot":"0x2057c8fb79c0f294062c1436aa56741134dc46d228a4f874929f8b791a7007a4",
43
"sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
44
"size":"0x30c",
45
"stateRoot":"0x87026f3a614318ae24bcef6bc8f7564479afbbbe2b1fb189bc133a5de5a2b0f8",
46
"timestamp":"0x618d8837",
47
"totalDifficulty":"0x5",
48
"transactions":["0xaf6ed8a6864d44989adc47c84f6fe0aeb1819817505c42cde6cbbcd5e14dd317"],
49
"transactionsRoot":"0xa39c4d0d2397f8fcb1683ba833d4ab935cd2f4c5ca6f56a7d9a45b9904ea1c69",
50
"uncles":[]
51
}
52
]
53
}
Copied!

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
1
// Request
2
curl -X POST --data '{"jsonrpc":"2.0","method":"rollup_getInfo","params":[],"id":1}' <node url>
3
4
// Result
5
{
6
"jsonrpc":"2.0",
7
"id":1,
8
"result":{
9
"mode":"verifier",
10
"syncing":false,
11
"ethContext":{
12
"blockNumber":13679735,
13
"timestamp":1637791660
14
},
15
"rollupContext":{
16
"index":430948,
17
"queueIndex":12481,
18
"verifiedIndex":0
19
}
20
}
21
}
Copied!

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
1
// Request
2
curl -X POST --data '{"jsonrpc":"2.0","method":"rollup_gasPrices","params":[],"id":1}' <node url>
3
4
// Result
5
{
6
"jsonrpc":"2.0",
7
"id":1,
8
"result":{
9
"l1GasPrice":"0x237aa50984",
10
"l2GasPrice":"0xf4240"
11
}
12
}
Copied!

Unsupported JSON-RPC methods

eth_getAccounts

This method is used to retrieve a list of addresses owned by a user. Boba 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

Boba 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 Boba Network.
Last modified 1mo ago