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 = var bitcoin =
Connect to the Bitcoin P2P network:
bitcoin.connect()
Get a notification when successfully connected to the Bitcoin P2P network.
bitcoinevents
Check an address
Check uBTC balance for a given bitcoin address:
bitcoin
Will output:
balance: "address": "1BkJgdopq35eaZGRrau4wdnZFZ3qfM4DUb" "in": 301802 "out": 301802 "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:
bitcoinevents
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:
bitcoinevents
Will trigger the event in real time if a payment is done to that address:
>> Transaction detected: txid: '82d1ce35c4b755f8365bcfab9c485cf798cfcfe6e62a222995ca28335ada5374' valueOut: 001068895 vout: '1P4BHe6R9Wa5cRWAPPT7FCzCDoBEqC6VK6': 1047784 '1Jp1tW7FFS3kS3jXgWbppiYn6oR9d4ckec': 21111 isRBF: false >> Transaction detected: txid: '6ed5f489e080dbc07ed7a6cc18c70271443708aa57a032deb1b1bf3ed38a06cd' valueOut: 022005829 vout: '1LxJtK99ryA1yRjekQeU1ChZdsBoNeWQgp': 8810932 '1Q63dyZEwQAtn8dsxyvK1dduG4axxjBgm9': 13194897 isRBF: false ...