> ## 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_sha3 | Arc

> Arc API method that returns the Keccak-256 hash of the given data. This is the same hashing algorithm used by Ethereum for various purposes.

Arc API method that returns the Keccak-256 hash of the given data. This is the same hashing algorithm used by Ethereum for various purposes.

## Parameters

* `data` — the data to hash (hex encoded)

## Response

* `result` — the Keccak-256 hash of the input data

## Use case

The `web3_sha3` method is useful for:

* Computing function selectors (first 4 bytes of keccak256 of function signature)
* Computing event topics
* General-purpose hashing

## `web3_sha3` code examples

<CodeGroup>
  ```javascript ethers.js theme={"system"}
  const ethers = require('ethers');
  const NODE_URL = "CHAINSTACK_NODE_URL";
  const provider = new ethers.JsonRpcProvider(NODE_URL);

  const sha3Example = async () => {
      // Hash hex-encoded data via RPC
      const hash = await provider.send("web3_sha3", ["0x68656c6c6f"]); // "hello" in hex
      console.log(`Hash of 'hello': ${hash}`);

      // Compare with ethers.js local computation
      const localHash = ethers.keccak256("0x68656c6c6f");
      console.log(`Local hash: ${localHash}`);
      console.log(`Hashes match: ${hash === localHash}`);

      // Compute a function selector
      const transferSelector = await provider.send("web3_sha3", [
        ethers.toUtf8Bytes("transfer(address,uint256)").reduce(
          (hex, byte) => hex + byte.toString(16).padStart(2, '0'),
          '0x'
        )
      ]);
      console.log(`\nTransfer function selector: ${transferSelector.slice(0, 10)}`);
    };

  sha3Example();
  ```

  ```python web3.py theme={"system"}
  from web3 import Web3

  node_url = "CHAINSTACK_NODE_URL"
  web3 = Web3(Web3.HTTPProvider(node_url))

  # Hash hex-encoded data
  data = "0x68656c6c6f"  # "hello" in hex
  result = web3.provider.make_request("web3_sha3", [data])
  print(f"Hash of 'hello': {result['result']}")

  # Compare with local computation
  local_hash = web3.keccak(hexstr=data).hex()
  print(f"Local hash: {local_hash}")

  # Compute a function selector
  transfer_sig = "transfer(address,uint256)"
  selector = web3.keccak(text=transfer_sig).hex()[:10]
  print(f"\nTransfer function selector: {selector}")
  ```

  ```bash cURL theme={"system"}
  # Hash "hello" (0x68656c6c6f in hex)
  curl -X POST "CHAINSTACK_NODE_URL" \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc": "2.0", "method": "web3_sha3", "params": ["0x68656c6c6f"], "id": 1}'
  ```
</CodeGroup>


## OpenAPI

````yaml openapi/arc_node_api/client_info/web3_sha3.json POST /
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://arc-testnet.core.chainstack.com/6caa7fd90475ac9214f7521dd460fa7c
security: []
paths:
  /:
    post:
      tags:
        - upload
      summary: web3_sha3
      operationId: web3_sha3
      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_sha3
                params:
                  type: array
                  default:
                    - '0x68656c6c6f'
      responses:
        '200':
          description: Returns the result of web3_sha3.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                  id:
                    type: integer
                  result:
                    type: string
              example:
                jsonrpc: '2.0'
                id: 1
                result: >-
                  0x1c8aff950685c2ed4bc3174f3472287b56d9517b9c948127319a09a7a36deac8

````