For the complete documentation index, see llms.txt. This page is also available as Markdown.

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://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "random",
    "params": [{}],
    "id": "getblock.io"
}'
const axios = require('axios');

const url = 'https://shared.eu-central-1.getblock.io/<ACCESS_TOKEN>/' 
const headers = {
    'Content-Type': 'application/json'
};

const payload = {
    jsonrpc: '2.0',
    method: 'random',
    params: [{}],
    id: 'getblock.io'
};

axios.post(url, payload, { headers })
    .then(response => console.log(response.data))
    .catch(error => console.error(error));

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?