POST
/
efb0a5eccd2caa5135eb54eba6f7f300
curl --request POST \
  --url https://optimism-mainnet.core.chainstack.com/efb0a5eccd2caa5135eb54eba6f7f300 \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "web3_sha3",
  "id": 1,
  "params": [
    "0x436861696E737461636B"
  ]
}'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": "<string>"
}

Optimism API method web3_sha3 computes the Keccak-256 hash of the given data. This method is a utility function often used in Optimism for generating hashes of arbitrary data, which is a common requirement for various cryptographic operations.

This example computes Keccak-256 for the value Chainstack.

Chainstack in hex: 0x436861696E737461636B.

Get you own node endpoint today

Start for free and get your app to production levels immediately. No credit card required.

You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

  • data — the data to hash, typically provided as a hexadecimal string.

Response

  • result — the Keccak-256 hash of the input data, returned as a hexadecimal string.

Use case

The web3_sha3 method is essential for:

  • Generating identifiers or hashes for on-chain data storage or referencing.
  • Creating cryptographic proofs that require a hash of data.
  • Developers needing to perform off-chain hash calculations that match the Optimism network’s hashing algorithm.

Body

application/json
jsonrpc
string
default:2.0
required
method
string
default:web3_sha3
required
id
integer
default:1
required
params
string[]
required

Response

200 - application/json
The SHA3 result of the given data
jsonrpc
string
id
integer
result
string

The Keccak-256 hash of the input data.