Comment on page
Mantle Node API
RPC API Reference
Applications need to connect to a node to fetch block data and send transactions to the Mantle network. Mantle Network shares the same JSON-RPC API implementation as Ethereum.
We've also introduced custom methods to simplify certain Mantle-specific interactions.
All methods can be accessed via https and websocket.
Name | Mainnet | Testnet |
---|---|---|
RPC URL | ||
Websocket URL | wss://wss.mantle.xyz |
The websocket supports an access method equivalent to the https interface, along with event subscription and cancellation. See here for reference.
Method | Description |
---|---|
Returns block info for multiple blocks, takes a block range as parameter | |
Returns L2 node info | |
Returns the block info in the form of an array of
block
objects for multiple blocks within a specified range. (See eth_getBlockByHash
for the structure of a block
object) No. | Parameter | Type | Description |
---|---|---|---|
1 | QUANTITY|TAG | Integer | String | Starting block no. of the range, or one of "earliest" , "latest" , or "pending" , as in the default block parameter |
2 | QUANTITY|TAG | Integer | String | Ending block no. of the range, or one of "earliest" , "latest" , or "pending" , as in the default block parameter |
3 | BOOLEAN | Boolean | If true , returns full transaction objects
If false , returns transaction hashes only |
1
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockRange","params":["0x1", "0x2", false],"id":1}' <node url>
1
{
2
"jsonrpc":"2.0",
3
"id":1,
4
"result":[
5
{
6
"difficulty":"0x2",
7
"extraData":"0xd97735082a846765746889676f312e31352e3133856c696e75780000000000009c3827892825f0825a7e329b6913b84c9e4f89168350aff0939e0e6609629f2e7f07f2aeb62acbf4b16a739cab68866f4880ea406583a4b28a59d4f55dc2314e00",
8
"gasLimit":"0xe4e1c0",
9
"gasUsed":"0x3183d",
10
"hash":"0xbee7192e575af30420cae0c7776304ac196077ee72b048970549e4f08e875453",
11
"logsBloom":"0x00000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000400000000000100000000000000200000000002000000000000001000000000000000000004000000000000000000000000000040000400000100400000000000000100000000000000000000000000000020000000000000000000000000000000000000000000000001000000000000000000000100000000000000000000000000000000000000000000000000000000000000088000000080000000000010000000000000000000000000000800008000120000000000000000000000000000000002000",
12
"miner":"0x0000000000000000000000000000000000000000",
13
"mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
14
"nonce":"0x0000000000000000",
15
"number":"0x1",
16
"parentHash":"0x7ca38a1916c42007829c55e69d3e9a73265554b586a499015373241b8a3fa48b",
17
"receiptsRoot":"0xf4c97b1186b690ad3318f907c0cdaf46f4598f27f711a5609064b2690a767287",
18
"sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
19
"size":"0x30c",
20
"stateRoot":"0xd3ac40854cd2ac17d8effeae6065cea990b04be714f7061544973feeb2f1c95f",
21
"timestamp":"0x618d4769",
22
"totalDifficulty":"0x3",
23
"transactions":["0x5e77a04531c7c107af1882d76cbff9486d0a9aa53701c30888509d4f5f2b003a"],
24
"transactionsRoot":"0x19f5efd0d94386e72fcb3f296f1cb2936d017c37487982f76f09c591129f561f",
25
"uncles":[]
26
},
27
{
28
"difficulty":"0x2",
29
"extraData":"0xd98301090a848932606889676f312e61742e3133856c696e757800000000000064a82cb66c7810b9619e7f14ab65c769a828b1616974987c530684eb3870b65e5b2400c1b61c6d340beef8c8e99127ac0de50e479d21f0833a5e2910fe64b41801",
30
"gasLimit":"0xe4e1c0",
31
"gasUsed":"0x1c60d",
32
"hash":"0x45fd6ce41bb8ebb2bccdaa92dd1619e367404cb07722039901a7eba63dea1d13",
33
"logsBloom":"0x00080000000200000000000000000008000000000000000000000100008000000000000000000000000000000000000000000000000000000000400000000000100000000000000000000000020000000000000000000000000000000000004000000000000000000000000000000000400000000400000000000000100000000000000000000000000000020000000000000000000000000000000000000000100000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000008400000000000000000010000000000000000020000000020000000000000000000000000000000000000000000002000",
34
"miner":"0x0000000000000000000000000000000000000000",
35
"mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
36
"nonce":"0x0000000000000000",
37
"number":"0x2",
38
"parentHash":"0xbee7192e575af30420cae0c7776304ac196077ee72b048970549e4f08e875453",
39
"receiptsRoot":"0x2057c8fb79c0f294062c1436aa56741134dc46d228a4f874929f8b791a7007a4",
40
"sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
41
"size":"0x30c",
42
"stateRoot":"0x87026f3a614318ae24bcef6bc8f7564479afbbbe2b1fb189bc133a5de5a2b0f8",
43
"timestamp":"0x618d8837",
44
"totalDifficulty":"0x5",
45
"transactions":["0xaf6ed8a6864d44989adc47c84f6fe0aeb1819817505c42cde6cbbcd5e14dd317"],
46
"transactionsRoot":"0xa39c4d0d2397f8fcb1683ba833d4ab935cd2f4c5ca6f56a7d9a45b9904ea1c69",
47
"uncles":[]
48
}
49
]
50
}
Returns various pieces of information in the form of an
Object
for a specified node. The response
Object
structure is as follows:Field | Type | Description |
---|---|---|
mode | String | Node's mode of operation - "sequencer" or "verifier" |
syncing | Boolean | true if the node is currently syncing
false otherwise |
ethContext | Object | Nested object. Contains blockNumber and timestamp |
blockNumber | Quantity | Block no. of the latest known L1 block |
timestamp | Quantity | Timestamp of the latest known L1 block |
rollupContext | Object | Nested object. Contains queueIndex , index , and verifiedIndex |
queueIndex | Quantity | Index within the CTC of the last L1 to L2 message ingested |
index | Quantity | Index of the last L2 transaction processed |
verifiedIndex | Quantity | Index of the last transaction that was ingested from a batch that was posted to L1 |
None
1
curl -X POST --data '{"jsonrpc":"2.0","method":"rollup_getInfo","params":[],"id":1}' <node url>
1
{
2
"jsonrpc":"2.0",
3
"id":1,
4
"result":{
5
"mode":"verifier",
6
"syncing":false,
7
"ethContext":{
8
"blockNumber":10743302,
9
"timestamp":1957082793
10
},
11
"rollupContext":{
12
"index":11287,
13
"queueIndex":14362,
14
"verifiedIndex":0
15
}
16
}
17
}
Returns an
Object
containing the L1 and L2 gas prices used by the Sequencer to calculate transaction gas fees.The response
Object
structure is as follows:Field | Type | Description |
---|---|---|
l1GasPrice | Quantity | L1 gas price in wei (used to estimate L1 calldata costs) |
l2GasPrice | Quantity | L2 gas price in wei (used to estimate L2 execution costs) |
None
1
curl -X POST --data '{"jsonrpc":"2.0","method":"rollup_gasPrices","params":[],"id":1}' <node url>
1
{
2
"jsonrpc":"2.0",
3
"id":1,
4
"result":{
5
"l1GasPrice":"0x254aa66732",
6
"l2GasPrice":"0xf3792"
7
}
8
}
Method | Description |
---|---|
eth_getAccounts | Used to fetch the list of addresses owned by a user. Mantle nodes do not expose internal wallets for security reasons, and thus block the eth_getAccounts method. You can use an external wallet service as an alternative. |
eth_sendTransaction | Mantle nodes block eth_sendTransaction for security reasons as well. This is different from eth_sendRawTransaction which takes a signed transaction as input, and is supported by Mantle nodes. |
Last modified 4mo ago