web3_clientVersion - Base

The web3_clientVersion method returns the current client version. This is useful for identifying the node software and version being used to serve RPC requests.

Parameters

  • None

Request

bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "web3_clientVersion",
    "params": [],
    "id": "getblock.io"
}'
javascriptconst axios = require('axios');

const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
    jsonrpc: '2.0',
    method: 'web3_clientVersion',
    params: [],
    id: 'getblock.io'
}, {
    headers: { 'Content-Type': 'application/json' }
});

console.log('Client Version:', response.data.result);
pythonimport requests

response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers={'Content-Type': 'application/json'},
    json={
        'jsonrpc': '2.0',
        'method': 'web3_clientVersion',
        'params': [],
        'id': 'getblock.io'
    }
)

result = response.json()
print(f'Client Version: {result["result"]}')
rustuse reqwest::Client;
use serde_json::{json, Value};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();
    
    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .header("Content-Type", "application/json")
        .json(&json!({
            "jsonrpc": "2.0",
            "method": "web3_clientVersion",
            "params": [],
            "id": "getblock.io"
        }))
        .send()
        .await?
        .json::<Value>()
        .await?;
    
    println!("Client Version: {}", response["result"]);
    Ok(())
}

Response

json{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": "op-geth/v1.101308.2/linux-amd64/go1.21"
}

Response Parameters

ParameterTypeDescription
jsonrpcstringJSON-RPC protocol version ("2.0")
idstringRequest identifier matching the request
resultstringClient version string

Use Cases

  • Node Identification: Identify the execution client being used
  • Compatibility Check: Verify client version supports required features
  • Debugging: Include client info in error reports
  • Monitoring: Track client versions across infrastructure

Error Handling

Error CodeMessageDescription
-32603Internal errorNode internal failure

Web3 Integration

javascriptconst { ethers } = require('ethers');

const provider = new ethers.JsonRpcProvider('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/');

async function getClientVersion() {
    const version = await provider.send('web3_clientVersion', []);
    console.log('Client Version:', version);
    return version;
}

getClientVersion();
javascriptimport { createPublicClient, http } from 'viem';
import { base } from 'viem/chains';

const client = createPublicClient({
    chain: base,
    transport: http('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/')
});

async function getClientVersion() {
    const version = await client.request({
        method: 'web3_clientVersion',
        params: []
    });
    console.log('Client Version:', version);
    return version;
}

getClientVersion();