releaseLedgerState - Cardano

This method releases a previously acquired ledger state, freeing the node to serve queries against the moving tip again. This protocol requires a WebSocket connection.

Parameters

This method does not require parameters.

Request

example.js

javascriptimport WebSocket from 'ws';

const client = new WebSocket('wss://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/');

client.once('open', () => {
    client.send(JSON.stringify({"jsonrpc": "2.0", "method": "releaseLedgerState", "id": "getblock.io"}));
});

client.on('message', (msg) => {
    console.log(JSON.parse(msg.toString()));
    client.close();
});

example.py

pythonimport asyncio
import json
import websockets

async def main():
    async with websockets.connect('wss://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/') as ws:
        await ws.send(json.dumps({"jsonrpc": "2.0", "method": "releaseLedgerState", "id": "getblock.io"}))
        print(json.loads(await ws.recv()))

asyncio.run(main())

Response

json{
    "jsonrpc": "2.0",
    "method": "releaseLedgerState",
    "result": {
        "released": "ledgerState"
    },
    "id": "getblock.io"
}

Response Parameters

FieldTypeDescription
releasedstringConfirmation that the ledger state was released

Use Cases

  • Resource Cleanup: Release a snapshot when a query batch completes
  • Connection Hygiene: Free held state before acquiring a new point
  • Long Sessions: Cycle acquisitions over a persistent connection
  • Error Recovery: Reset state after a failed query sequence

Error Handling

Error CodeMessageDescription
-32602Invalid paramsThe requested point is missing or malformed
2000Acquire failureThe requested point is no longer on the chain and cannot be acquired
-32603Internal errorThe node failed to acquire the requested state