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