detecthash - TON

Example code for the detecthash JSON-RPC method. Сomplete guide on how to use detecthash JSON-RPC in GetBlock.io Web3 documentation.

This method returns all possible representations of a 256-bit hash: hex, base64, and URL-safe base64.

Parameters

Parameter
Type
Required
Description

hash

string

Yes

256-bit hash in any form (hex, base64, or URL-safe base64)

Request Example

REST (GET):

curl --location --request GET 'https://go.getblock.io/<ACCESS-TOKEN>/detectHash?hash=0E5F84CDDFCC0A3B23F18EDC6E70C45F40DDFCB6C8E97D43F8A1023AA873F2D7' \
--header 'Content-Type: application/json'

JSON-RPC (POST):

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/jsonRPC' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "detectHash",
    "params": {
        "hash": "0E5F84CDDFCC0A3B23F18EDC6E70C45F40DDFCB6C8E97D43F8A1023AA873F2D7"
    },
    "id": "getblock.io"
}'

Response Example

Response Parameters

Field
Type
Description

result.hex

string

Hex representation of the hash

result.b64

string

Standard base64 representation

result.b64url

string

URL-safe base64 representation

Use Cases

  • Normalising hashes received from different sources

  • Converting between hex and base64 for SDK compatibility

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid <ACCESS-TOKEN>

422

Validation Error

Request parameters are missing or malformed

429

Too Many Requests

Rate limit exceeded for your plan

504

Lite Server Timeout

Upstream TON liteserver timed out

SDK Integration

Was this helpful?