Ethereum
Pronto para usar isso em produção?
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
Ethereum
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
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.| # | Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|---|
| 1 | data | string | Sim | Arbitrary data to hash, provided as a 0x-prefixed hex string. Empty input (`"0x"`) is valid. |
| Tipo | Descrição |
|---|---|
| string | 0x-prefixed 32-byte (64-character) Keccak-256 hash of the input. |
Try it live in the Ethereum playground.
| Código | Mensagem | Causa |
|---|---|---|
-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.Parâmetros
0x-prefixed hex string