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

@psf/bitcoincash-zmq-decoder

v0.1.5

Published

decode transaction and block hex strings returned from zmq

Downloads

15

Readme

bitcoincash-zmq-decoder

install

npm i bitcoincash-zmq-decoder --save

usage

First require the lib and pass in the network to the constructor. Options are "mainnet" and "testnet".

let BitcoinCashZMQDecoder = require('bitcoincash-zmq-decoder');
let bitcoincashZmqDecoder =  new BitcoinCashZMQDecoder("mainnet");

Transactions

Pass the hex of a transaction returned from bitcoind via zeromq

bitcoincashZmqDecoder.decodeTransaction(message);

// returns
{
  "format": {
    "txid": "6dd25f39f324c085a013a2f55fb55392c280ca82c17e602249ddb2c7b6f6aede",
    "version": 1,
    "locktime": 0,
    "size": 226,
    "vsize": 226
  },
  "inputs": [
    {
      "txid": "91dff995f6d5d64a106d6bcbbd8304fcba0c557871cba814779dde889a1a1ad6",
      "n": 0,
      "script": "3045022100963b819d81006f04e2650524b10ec9ee9ed0ab305e707f54704d23cc25191f420220560dd8f0c32104b34aa3ac3af888867506a1c623100d1ff298e462e40041e6b941 0350b30d68fc3a1cec60f295928426bb12d10e98da9bcc92f8d98ac327265c9d8c",
      "sequence": 4294967295
    }
  ],
  "outputs": [
    {
      "satoshi": 7631108298,
      "value": "76.31108298",
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 c83de633455d60f7618bea613ebe596952c57f1e OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914c83de633455d60f7618bea613ebe596952c57f1e88ac",
        "type": "pubkeyhash",
        "addresses": [
          "1KFnJCZNFZ863BmWSsyWRJ4ESwJViiZnoa"
        ]
      }
    },
    {
      "satoshi": 19011700,
      "value": "0.19011700",
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 463b57510fda4a831cae313150088c67f5893479 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914463b57510fda4a831cae313150088c67f589347988ac",
        "type": "pubkeyhash",
        "addresses": [
          "17QMPX5tphADbxTdSiu4BakYgZwehN3iPZ"
        ]
      }
    }
  ]
}

Blocks

Pass the hex of a block returned from bitcoind via zeromq

let block = bitcoincashZmqDecoder.decodeBlock(hex);

// returns

{
  "transactions": 162,
  "totalBCHSent": 39478786896,
  "reward": 1250000000,
  "prevHash": "8e31a5d886ddf478924504eb93e0e9d4e9540080ffc434010000000000000000",
  "id": "eeb1c8194c5487a4d78e9bea4c755a7abe526feab59589010000000000000000",
  "hash": "0000000000000000018995b5ea6f52be7a5a754cea9b8ed7a487544c19c8b1ee",
  "merkleRoot": "9d859cf70f76fbeedf1537c1d4b5dcc6ceab02ff637b232711b31e1dd78feea2",
  "version": 536870912,
  "time": 1532932006,
  "bits": 402773255,
  "nonce": 1127365190
}