The XRP Ledger sends every validated transaction to anyone who subscribes over WebSocket. This guide subscribes to a public server, keeps the XRP payments above a size you choose, and names the exchanges and other large accounts behind them. You need Node.js 22 or later, which has WebSocket built in, and no API key.
1. Subscribe to new ledgers
Connect to wss://s1.xrpl.stream, a public XRP Ledger server, and send a subscribe command.
Request
{
"id": 1,
"command": "subscribe",
"streams": [
"ledger"
]
}
Response
{
"result": {
"fee_base": 10,
"ledger_hash": "D6F736AD58F880B07A9E43A0F3BB9DBD9BA5080BE24AFFA34B4CEFEA850D2426",
"ledger_index": 108488925,
"ledger_time": 848634060,
"network_id": 0,
"reserve_base": 1000000,
"reserve_inc": 200000,
"validated_ledgers": "107936549-108488925"
},
"id": 1,
"status": "success",
"type": "response"
}
From then on, a ledgerClosed message arrives every 3 to 4 seconds:
{
Discussion
Leave the first comment
Be the first to leave a mark on this discussion.