Ethereum
准备好在生产环境中调用了吗?
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
Ethereum
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
web3_sha3 hashes a chunk of hex-encoded data with Keccak-256 and hands back the 32-byte digest. The name is a historical trap: despite "sha3", this is the original Keccak-256, not the NIST SHA3-256 that FIPS-202 later standardised with different padding. Ethereum settled on the pre-standard Keccak everywhere — it is the function behind address derivation, event topics, function selectors, and Merkle-Patricia trie keys — which is exactly why the node exposes it here. Send the data to https://ethereum.therpc.io/YOUR_API_KEY on mainnet (chain ID 1) and you get the canonical ETH-flavoured hash without needing a local crypto library. The input must be a 0x-prefixed hex string, and the output is a 0x-prefixed 64-character hex digest.
Transfer(address,address,uint256), then drop the result into an eth_getLogs query against an ERC-20 contract.transfer(address,uint256) and taking the first four bytes of the Keccak-256 digest — the same value an EVM call places at the start of its calldata.| # | 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|---|
| 1 | data | string | 是 | Arbitrary data to hash, provided as a 0x-prefixed hex string. Empty input (`"0x"`) is valid. |
| 类型 | 描述 |
|---|---|
| string | 0x-prefixed 32-byte (64-character) Keccak-256 hash of the input. |
Try it live in the Ethereum playground.
| 错误码 | 错误信息 | 原因 |
|---|---|---|
-32602 | invalid argument | Input is not a valid 0x-prefixed hex string. |
sha3_256 will give a different digest because of the padding change introduced when Keccak became FIPS-202. Reach for a library that explicitly offers the Ethereum Keccak variant (for example keccak256 in viem or ethers), or just let this method compute it for you.参数
0x-prefixed hex string