⚠️Blast API (blastapi.io) ends Oct 31. Migrate to Dwellir and skip Alchemy's expensive compute units.
Switch Today →
Skip to main content

web3_sha3

Overview

Computes the Keccak-256 hash of the provided data.

Parameters

NameTypeRequiredDescription
data0x-hexYesData to hash

Returns

0x-hex 32-byte hash.

Code Examples

cURL

curl -X POST https://api-movement-mainnet.n.dwellir.com/YOUR_API_KEY/v1 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"web3_sha3","params":["0x68656c6c6f"],"id":1}'

Ethers.js v6

import { keccak256, toUtf8Bytes } from 'ethers';
console.log(keccak256(toUtf8Bytes('hello')));

Web3.js

import Web3 from 'web3';
console.log(Web3.utils.sha3('hello'));

viem

import { keccak256, stringToHex } from 'viem';
console.log(keccak256(stringToHex('hello')));