web3_sha3
Returns Keccak-256 (not the standardized SHA3-256) of the given data.
Parameters
- Data - The data to convert into a SHA3 hash
{
"jsonrpc": "2.0",
"method": "web3_sha3",
"params": ["0x68656c6c6f20776f726c64"],
"id": 1
}
Returns
DATA - The SHA3 result of the given string.
Implementation Examples
JSON-RPC endpoint format
Use https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/jsonrpc for all TRON JSON-RPC methods (eth_*, net_*, web3_*). Send POST requests with a JSON-RPC body and remember to replace YOUR_API_KEY.
- cURL
- JavaScript
curl -X POST https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/jsonrpc \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "web3_sha3",
"params": ["0x68656c6c6f20776f726c64"],
"id": 1
}'
// Using ethers.js
const hash = ethers.keccak256('0x68656c6c6f20776f726c64');
console.log('Keccak256 hash:', hash);
// Using web3.js
const hash = await web3.utils.sha3('hello world');
console.log('Hash:', hash);