web3_sha3
Returns Keccak-256 (not standard SHA3-256) of the given data on Moonriver.
Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
data | DATA | Yes | Data to hash |
Request#
{
"jsonrpc": "2.0",
"method": "web3_sha3",
"params": ["0x68656c6c6f"],
"id": 1
}
Returns#
| Type | Description |
|---|---|
DATA | Keccak-256 hash of the data |
Code Examples#
- cURL
- JavaScript
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "web3_sha3",
"params": ["0x68656c6c6f"],
"id": 1
}'
import { JsonRpcProvider, keccak256, toUtf8Bytes } from 'ethers';
const provider = new JsonRpcProvider('');
// Using RPC
const hash = await provider.send('web3_sha3', ['0x68656c6c6f']);
console.log('Hash:', hash);
// Using ethers directly (faster)
const localHash = keccak256(toUtf8Bytes('hello'));
console.log('Local hash:', localHash);