npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bitlive

v0.0.13

Published

Get all bitcoin transactions real time over socket.io from insight servers online

Downloads

2

Readme

bitcoin-live-transactions

This module uses running insight-api instances to get live bitcoin transaction as they happen in the Bitcoin P2P network.

How to use it

Create a BLT (Bitcoin Live Transactions) instance:

var BLT = require("bitcoin-live-transactions")
var bitcoin = new BLT()

Connect to the Bitcoin P2P network:

bitcoin.connect()

Get a notification when successfully connected to the Bitcoin P2P network.

bitcoin.events.on('connected', function() {
   // start listening to addresses
})

Check an address

Check uBTC balance for a given bitcoin address:

bitcoin.getBalance('1CZGSZPGsyeeLYyoXdmJtanEmaKKpwYM7g').then(function(balance) {
  console.log('balance:', balance);
})

Will output:

balance: {
  "address": "1BkJgdopq35eaZGRrau4wdnZFZ3qfM4DUb",
  "in": 3018.02,
  "out": 3018.02,
  "curr": "bits(uBTC)",
  "balance": 0,
  "txs": 2
}

That can be checked here: https://insight.bitpay.com/address/1CZGSZPGsyeeLYyoXdmJtanEmaKKpwYM7g

To get all the detailed information about an address, use bitcoin.getTxs instead of bitcoin.getBalance

Live stream

To Listen to live transaction events on the Bitcoin P2P network for a given address, the event is called as the address itself:

bitcoin.events.on('138WJKb1mXbkRGNpyMVEZ9EsoXjMEvJfT4',function(tx){
  console.log('Transaction detected!', tx);
})

Will trigger the event in real time if a payment is done to that address:

Transaction detected! { address: '138WJKb1mXbkRGNpyMVEZ9EsoXjMEvJfT4',
  amount: 381000 }

Show everything live

If you want to see ALL transactions happening live, use the tx event:

bitcoin.events.on('tx',function(tx){
  console.log('>> Transaction detected:', tx);
})

Will trigger the event in real time if a payment is done to that address:

>> Transaction detected: { txid: '82d1ce35c4b755f8365bcfab9c485cf798cfcfe6e62a222995ca28335ada5374',
  valueOut: 0.01068895,
  vout:
   [ { '1P4BHe6R9Wa5cRWAPPT7FCzCDoBEqC6VK6': 1047784 },
     { '1Jp1tW7FFS3kS3jXgWbppiYn6oR9d4ckec': 21111 } ],
  isRBF: false }
>> Transaction detected: { txid: '6ed5f489e080dbc07ed7a6cc18c70271443708aa57a032deb1b1bf3ed38a06cd',
  valueOut: 0.22005829,
  vout:
   [ { '1LxJtK99ryA1yRjekQeU1ChZdsBoNeWQgp': 8810932 },
     { '1Q63dyZEwQAtn8dsxyvK1dduG4axxjBgm9': 13194897 } ],
  isRBF: false }
...

Testnet

To use test-net add {testnet:true} when instantiating the module, as follows:

var BLT = require("bitcoin-live-transactions")
var bitcoin = new BLT({testnet: true})