acquireLedgerState - Cardano
Example code for the acquireLedgerState WebSocket method. Complete guide on how to use acquireLedgerState WebSocket in GetBlock Web3 documentation.
Parameters
Parameter
Type
Required
Description
Request
import WebSocket from 'ws';
const client = new WebSocket('wss://go.getblock.io/<ACCESS-TOKEN>/');
client.once('open', () => {
client.send(JSON.stringify({"jsonrpc": "2.0", "method": "acquireLedgerState", "params": {"point": {"slot": 123456789, "id": "3e6f2d8c9a1b4e7f0c2d5a8b1e4f7a0c3d6b9e2f5a8c1d4e7b0f3a6c9d2e5b8f"}}, "id": "getblock.io"}));
});
client.on('message', (msg) => {
console.log(JSON.parse(msg.toString()));
client.close();
});import asyncio
import json
import websockets
async def main():
async with websockets.connect('wss://go.getblock.io/<ACCESS-TOKEN>/') as ws:
await ws.send(json.dumps({"jsonrpc": "2.0", "method": "acquireLedgerState", "params": {"point": {"slot": 123456789, "id": "3e6f2d8c9a1b4e7f0c2d5a8b1e4f7a0c3d6b9e2f5a8c1d4e7b0f3a6c9d2e5b8f"}}, "id": "getblock.io"}))
print(json.loads(await ws.recv()))
asyncio.run(main())Response
Response Parameters
Field
Type
Description
Use Cases
Error Handling
Error Code
Message
Description
Last updated
Was this helpful?