rpc_modules - Blast
Example code for the rpc_modules JSON-RPC method. Complete guide on how to use rpc_modules JSON-RPC in GetBlock Web3 documentation.
This method returns the RPC modules enabled on the endpoint and their version strings. It is used to discover which method namespaces (eth, net, web3, debug) are available.
Parameters
Request
curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "rpc_modules",
"params": [],
"id": "getblock.io"
}'const axios = require('axios');
const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
jsonrpc: '2.0',
method: 'rpc_modules',
params: [],
id: 'getblock.io'
}, {
headers: { 'Content-Type': 'application/json' }
});
console.log(response.data.result);import requests
response = requests.post(
'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
headers={'Content-Type': 'application/json'},
json={
'jsonrpc': '2.0',
'method': 'rpc_modules',
'params': [],
'id': 'getblock.io'
}
)
print(response.json())Response
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": {
"eth": "1.0",
"net": "1.0",
"web3": "1.0",
"debug": "1.0"
}
}Response Parameters
jsonrpc
string
JSON-RPC protocol version ("2.0")
id
string
Request identifier matching the request
result
object
Map of enabled module names to their version strings
Use Cases
Capability Discovery: Detect whether the debug namespace is enabled before tracing
Feature Gating: Enable optional features only when their module is present
Endpoint Profiling: Record enabled modules across a fleet
Compatibility Checks: Confirm required namespaces before a workload starts
Error Handling
-32603
Internal error
The node failed to enumerate its RPC modules
-32601
Method not found
The client build does not expose rpc_modules
Web3 Integration
Last updated
Was this helpful?