Skip to content

Instantly share code, notes, and snippets.

@hammertoe
Last active September 23, 2018 17:47
Show Gist options
  • Save hammertoe/a5a793b0c00b7a6f40d1e7ecb196b35a to your computer and use it in GitHub Desktop.
Save hammertoe/a5a793b0c00b7a6f40d1e7ecb196b35a to your computer and use it in GitHub Desktop.
A script to view the validation message stream on the XRP Ledger
// npm i ripple-lib
// node valstream.js
const RippleAPI = require("ripple-lib").RippleAPI;
var api = new RippleAPI({ server: "wss://s1.ripple.com" });
api.connect().then(() => {
api.connection.on('validationReceived', (event) => {
console.log(JSON.stringify(event, null, 2))
})
api.request('subscribe', {
streams: [ 'validations' ]
}).catch(error => {
console.log("Error subscribing")
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment