> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# web3_clientVersion | Arbitrum

> Arbitrum API method that returns the client type and version running on the Arbitrum node. web3_clientVersion on Arbitrum via Chainstack.

Arbitrum API method that returns the client type and version running on the Arbitrum node. This information can be useful to developers to verify that a node they are connecting to is compatible with their needs.

<Check>
  **Get your own node endpoint today**

  [Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required.

  You can sign up with your GitHub, X, Google, or Microsoft account.
</Check>

## Parameters

* `none`

## Response

* `string` — a string identifying the type of client, version, operating system, and language version running on the node

## `web3_clientVersion` code examples

<CodeGroup>
  ```javascript web3.js theme={"system"}
  const Web3 = require("web3");
  const NODE_URL = "CHAINSTACK_NODE_URL";
  const web3 = new Web3(NODE_URL);

  async function getClient() {
    const client = await web3.eth.getNodeInfo();
    console.log(client);
  }

  getClient();
  ```

  ```javascript ethers.js theme={"system"}
  const ethers = require('ethers');
  const NODE_URL = "CHAINSTACK_NODE_URL";
  const provider = new ethers.JsonRpcProvider(NODE_URL);

  const clientVersion = async () => {
    const version = await provider.send("web3_clientVersion");
    console.log(`Client version: ${version}`);
  };

  clientVersion();
  ```

  ```python web3.py theme={"system"}
  from web3 import Web3  
  node_url = "CHAINSTACK_NODE_URL"
  web3 = Web3.HTTPProvider(node_url)

  client_version = web3.provider.make_request('web3_clientVersion', [])
  print(client_version)
  ```
</CodeGroup>

## Use case

A use case for the `web3_clientVersion` method can be to verify which client version is running to then decide which function to call.

Let's say you have a DApp that needs to call a different function based on the client's version. You can use `web3_clientVersion` to build this logic.

Here is an implementation of this use case using web3.js:

```javascript index.js theme={"system"}
const Web3 = require("web3");
const NODE_URL = "CHAINSTACK_NODE_URL";
const web3 = new Web3(NODE_URL);

// Get client version
async function getClientVersion() {
  web3.extend({
      property: 'eth',
      methods: [{
          name: 'getClientVersion',
          call: 'web3_clientVersion',
          params: 0,
          inputFormatter: [],
          outputFormatter: null
      }]
  });

  const clientVersion = await web3.eth.getClientVersion();
  const clientName = clientVersion.split('/')[1];
  return clientName
}

// define a function to be run if the client version is 'vv2.0.10'
function runFunction1() {
  console.log('Running function 1...');
}

// define a function to be run if the client version is 'vv2.0.11'
function runFunction2() {
  console.log('Running function 2...');
}

// define an async function to retrieve the client version and run the appropriate function
async function runBasedOnClientVersion() {
  try {
    const clientVersion = await getClientVersion();
    console.log(`Client version: ${clientVersion}`);

    if (clientVersion === 'vv2.0.10-73224e3') {
      runFunction1();
    }

    else if (clientVersion === 'vv2.0.11-73224e3') {
      runFunction2();
    }
    // log an error if the client version is not recognized
    else {
      console.error('Unrecognized client version.');
    }
  } catch (error) {
    console.error(error);
  }
}

// call the async function to retrieve the client version and run the appropriate function
runBasedOnClientVersion();
```

This code uses the web3.js library to connect to a blockchain node specified by the `NODE_URL` variable and retrieves the client version using the `web3_clientVersion` method. It then runs different functions based on the client version by defining two functions `runFunction1` and `runFunction2`, and using an if statement to check the client version and call the appropriate function.

The `getClientVersion` function extends the Web3 library with a custom method `getClientVersion`, which calls the `web3_clientVersion` method and returns the result. This function is called within the `runBasedOnClientVersion` function to retrieve the client version.

Overall, this code demonstrates how to retrieve the client version on a blockchain node using the web3.js library and how to use the client version to run different functions based on the version. The code can be modified to add additional functions and version checks or to perform other actions based on the client version.


## OpenAPI

````yaml /openapi/arbitrum_node_api/client_info/web3_clientVersion.json POST /5b8d22690a57f293b3a1ed8758014e35
openapi: 3.0.0
info:
  title: Chainstack Node API
  version: 1.0.0
  description: This is an API for interacting with a Chainstack node.
servers:
  - url: https://nd-000-364-211.p2pify.com
security: []
paths:
  /5b8d22690a57f293b3a1ed8758014e35:
    post:
      tags:
        - Update
      summary: web3_clientVersion
      operationId: clientVersion
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: integer
                  default: 1
                jsonrpc:
                  type: string
                  default: '2.0'
                method:
                  type: string
                  default: web3_clientVersion
                params:
                  type: array
                  default: []
      responses:
        '200':
          description: The client running on this node.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                  id:
                    type: integer
                  result:
                    type: string

````