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

ledger_closed - XRPL

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

This method returns the unique identifiers of the most recently closed ledger. Note that the ledger returned is not necessarily validated and immutable yet.

Parameters

  • None

Request Example

curl --location --request POST 'https://go.getblock.io/<ACCESS_TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "ledger_closed",
    "params": [{}],
    "id": "getblock.io"
}'
const axios = require('axios');

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

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

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

Response Example

{
    "result": {
        "ledger_hash": "A58833C1AE54D01EFFFD453DDAA33B72DF99BAE2D0F508C762A8F5F2A9353B09",
        "ledger_index": 102053796,
        "status": "success"
    }
}

Response Parameters

Parameter
Type
Description

ledger_hash

string

Ledger identifier

ledger_index

number

Ledger sequence

Use Cases

  • Get latest closed ledger

  • Monitor network progress

  • Sync applications

Error Handling

Error Code
Description

noNetwork

Not connected

SDK Integration

Last updated

Was this helpful?