Last active
September 23, 2018 17:47
-
-
Save hammertoe/a5a793b0c00b7a6f40d1e7ecb196b35a to your computer and use it in GitHub Desktop.
A script to view the validation message stream on the XRP Ledger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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