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

ledger_current - XRPL

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

This method returns the unique identifiers of the current in-progress ledger. This command is mostly useful for testing, because the ledger returned is still in flux.

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_current",
    "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_current',
    params: [{}],
    id: 'getblock.io'
};

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

Response Example

{
    "result": {
        "ledger_current_index": 102024660,
        "status": "success"
    }
}

Response Parameters

Parameter
Type
Description

ledger_current_index

number

Current ledger sequence

Use Cases

  • Get current ledger

  • Testing purposes

  • Monitor network state

Error Handling

Error Code
Description

noNetwork

Not connected

SDK Integration

Last updated

Was this helpful?