Skip to content

Instantly share code, notes, and snippets.

@justmoon
Created August 29, 2013 09:36
Show Gist options
  • Select an option

  • Save justmoon/6376099 to your computer and use it in GitHub Desktop.

Select an option

Save justmoon/6376099 to your computer and use it in GitHub Desktop.
Watching for transactions with ripple-lib
var ripple = require('ripple-lib');
var remote = ripple.Remote.from_config({
// "trace" : true,
"websocket_ip" : "122.70.133.11",
"websocket_port" : 5006,
"websocket_ssl" : false
});
remote.connect();
// This would watch all transactions on the whole network
//
//remote.on('transaction_all', function (e) {
// console.log("TRANSACTION", e.transaction.TransactionType, e.transaction.hash);
//});
// This watches for new ledgers
remote.on('ledger_closed', function (e) {
console.log("LEDGER", e.ledger_hash);
});
// This watches for any transactions that relate to Bitstamp (rvYAf...)
//
var account = remote.account('rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B');
account.on('transaction', function (e) {
console.log("BITSTAMP TRANSACTION", e.transaction.TransactionType, e.transaction.hash);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment