web3_sha3 - Optimism
Example code for the web3_sha3 json-rpc method. Сomplete guide on how to use web3_sha3 json-rpc in GetBlock.io Web3 documentation.
Parameters
Parameter
Type
Description
Required
Request Sample
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "web3_sha3",
"params": ["0x68656c6c6f"],
"id": "getblock.io"
}'const axios = require('axios');
const url = 'https://go.getblock.io/<ACCESS-TOKEN>/';
// "hello world" in hex
const payload = {
jsonrpc: '2.0',
method: 'web3_sha3',
params: ['0x68656c6c6f'],
id: 'getblock.io'
};
axios.post(url, payload, {
headers: { 'Content-Type': 'application/json' }
})
.then(response => console.log('Hash:', response.data.result))
.catch(error => console.error(error));Response
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": "0x1c8aff950685c2ed4bc3174f3472287b56d9517b9c948127319a09a7a36deac8"
}Response Parameters
Use Case
Error Handling
Error Code
Description
Web3 Integration
Last updated
Was this helpful?