TriportRPC

web3_sha3

Last updated:

`web3_sha3` computes the Keccak-256 hash of a single piece of input data and returns it as a `0x`-prefixed hex string. It is a pure utility method: it performs no chain lookups, so the result depends only on the bytes you pass in.

Despite the `sha3` name, this method returns a **Keccak-256** digest, not the finalized NIST SHA-3 standard. The two differ in their padding, so hashing the same input with a generic SHA-3 library produces a different result. This Keccak-256 variant is the one used throughout Ethereum — for function selectors, event topic signatures, storage-slot derivation, and address checksums — which is why this method exists on the JSON-RPC surface.

The input must be a `0x`-prefixed hex string. To hash a UTF-8 string, encode it to hex first — for example, `"hello world"` becomes `0x68656c6c6f20776f726c64`.

Parameters

This method takes no parameters.

Returns

web3_sha3 return value
FieldType
resultobject

Examples

curl https://<your-endpoint>/ \
  -X POST -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"web3_sha3","params":[]}'
const res = await fetch("https://<your-endpoint>/", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
  "id": 1,
  "method": "web3_sha3",
  "params": [],
  "jsonrpc": "2.0"
}),
});
const data = await res.json();
import requests
resp = requests.post("https://<your-endpoint>/", json={"id":1,"method":"web3_sha3","params":[],"jsonrpc":"2.0"})
print(resp.json())

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Networks: mainnet.
  3. Credit cost: 1 per call.

FAQ

What does web3_sha3 do?
Returns the Keccak-256 hash of the given data.
How many credits does web3_sha3 cost?
web3_sha3 costs 1 credit(s) per call on Triport by default.
Is web3_sha3 available over WebSocket?
web3_sha3 is an HTTP JSON-RPC method.