rpc_modules - Arbitrum
Example code for the rpc_modules JSON RPC method. Сomplete guide on how to use rpc_modules JSON RPC in GetBlock Web3 documentation.
This method returns the current network ID of the connected Ethereum-compatible chain. Each network has a unique numeric identifier, and this method helps applications determine which chain they are interacting with.
Parameters
None
Request
curl --location 'https://go.getblock.us/<ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "rpc_modules",
"params": []
"id": "getblock.io"
}'import axios from 'axios'
let data = JSON.stringify({
"jsonrpc": "2.0",
"method": "rpc_modules",
"params": [],
"id": "getblock.io"
};
let config = {
method: "post",
maxBodyLength: Infinity,
url: "https://go.getblock.us/<ACCESS_TOKEN>",
headers: {
"Content-Type": "application/json",
},
data: data,
};
axios
.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Response
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": {
"arb": "1.0",
"eth": "1.0",
"net": "1.0",
"rpc": "1.0",
"txpool": "1.0",
"web3": "1.0"
}
}Reponse Parameter Definition
jsonrpc
string
JSON-RPC version.
id
integer
Request identifier.
result
object
Key-value list of supported modules and versions.
Use case
The rpc_modules method helps developers to:
Helps tooling determine what RPC namespaces the node supports.
Blockchain tools use this to enable or disable features dynamically.
Confirms that an RPC node exposes required modules.
Ensures apps run only if the required modules are available.
Error handling
403
Forbidden
Missing or invalid ACCESS_TOKEN.
Integration with Web3
Using rpc_modules allows developers to:
Tools adapt automatically based on enabled modules.
Ensures required RPC namespaces exist before dApp initialization.
Helps compare feature sets across RPC providers.
Last updated
Was this helpful?