random - XRPL

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

This method provides a random number to clients as a source of entropy for random number generation.

Parameters

  • None

Returns

Field
Type
Description

random

string

256-bit random hex string

Request Example

curl --location --request POST 'https://xrp.getblock.io/mainnet/' \
--header 'x-api-key: YOUR-API-KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "random",
    "params": [{}],
    "id": "getblock.io"
}'

Response Example

Response Parameters

Parameter
Type
Description

random

string

Random hex string

Use Cases

  • Entropy source

  • Random key generation

  • Cryptographic operations

Error Handling

Error Code
Description

internal

Internal error

SDK Integration

Last updated

Was this helpful?