web3_sha3 — Polygon JSON-RPC
Computes the keccak256 (SHA3) hash of the given data on the server and returns it as a hex string.
https://triport.io/polygon- Network
- Polygon (mainnet, chainId 0x89 / 137)
- Scope
- polygon_read_rpc
- Auth
- x-token: $TRIPORT_API_KEY (or Authorization: Bearer)
- Rate limit
- free — free 15 rps · basic 20 rps · pro 100 rps · business 250 rps
Endpoint and plans: Polygon RPC endpoint.
web3_sha3 takes a single 0x-prefixed hex byte string, computes its keccak256
digest server-side, and returns the 32-byte result as a 0x-prefixed hex string.
This is the same keccak256 used throughout the EVM (function selectors, event
topics, storage slots), not the NIST SHA3-256 variant — despite the method name.
In practice you rarely need this method in production. Every major client
library (ethers, web3.js, web3.py) computes keccak256 locally without a network
round-trip, which is faster and avoids spending your rate-limit budget. Reach
for web3_sha3 only when you have no local hashing primitive available, or when
you want to confirm a hash against the node's own implementation.
The method is read-only and available on the Free trial under the
polygon_read_rpc category.
Parameters
Positional params array with exactly one element.
datastring (0x-prefixed hex)required0x prefix; an empty payload is encoded as 0x.Response
(0x68656c6c6f20776f726c64 is the ASCII bytes for hello world; its keccak256
digest is the value shown above.)
resultstring (0x-prefixed hex)0x prefix).Errors
Errors follow the standard JSON-RPC error envelope. See errors.md for the full structure.
| Code | Meaning | When it happens |
|---|---|---|
401 | trial_expired | The trial period for the API key has ended. |
403 | tier_insufficient | The key's tier is below the required tier for this method. |
429 | rate_limited | The per-tier RPS limit (15/20/100/250) was exceeded. |
401 | subscription_expired | The subscription tied to the key has lapsed. |
401 | unauthorized | Missing, malformed, or invalid API key. |
HTTP 403 | method_unknown | The method name is not recognized or not enabled for this key. |
Examples
JavaScript (fetch)
const res = await fetch("https://triport.io/polygon", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "web3_sha3",
params: ["0x68656c6c6f20776f726c64"],
}),
});
const { result } = await res.json();
console.log(result);
// 0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fadNotes
- Prefer local hashing. Libraries such as
ethers.keccak256,web3.utils.sha3, andeth_utils.keccakproduce the identical result without a request. Use them in hot paths to avoid consuming your RPS budget. - keccak256, not SHA3-256. The output matches the EVM's keccak256 (used for selectors, event topics, and storage layout), not the finalized NIST SHA3.
- Input must be hex.
datahas to be a0x-prefixed hex string. Pass0xfor the empty input; the result is the keccak256 of zero bytes. - Related:
web3_clientVersionis the other method in theweb3namespace. For network identity seenet_versionandeth_chainId.