ledger_data - XRPL

Example code for the ledger_data JSON RPC method. Complete guide to using ledger_data JSON-RPC in the GetBlock Web3 documentation.

This method retrieves contents of the specified ledger. You can iterate through several calls to retrieve the entire contents of a single ledger version.

Parameters

Parameter
Type
Required
Description

ledger_hash

string

No

Ledger hash

ledger_index

string/number

No

Ledger index or shortcut

binary

boolean

No

Return binary format

limit

number

No

Maximum results (10-400)

marker

object

No

Pagination marker

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": "ledger_data",
    "params": [{
        "ledger_index": "validated",
        "limit": 10
    }],
    "id": "getblock.io"
}'

Response Example

Response Parameters

Parameter
Type
Description

state

array

Ledger entries

marker

object

Continue pagination

Field
Type
Description

ledger_index

number

Ledger index

ledger_hash

string

Ledger hash

state

array

Ledger entries

marker

object

Pagination marker

Use Cases

  • Iterate ledger contents

  • Full ledger analysis

  • State snapshots

Error Handling

Error Code
Description

lgrNotFound

Ledger not found

invalidParams

Invalid parameters

SDK Integration

Last updated

Was this helpful?