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

libbitcoinconsensus

v0.0.3

Published

Node binding for libbitcoinconsensus

Downloads

2

Readme

SYNOPSIS Build Status

This module provides native bindings to Bitcoin's libbitcoinconsensus functions.
This library is experimental, so use at your own risk.

INSTALL

from npm

npm install libbitcoinconsensus
Note: you will need to have g++/llvm installed first

from git
git clone [email protected]:bitpay/libbitcoinconsensus.js.git
cd libbitcoinconsensus.js
git submodule init
git submodule update
npm install

NOTE: if you get multiple deprecation warnings on Mac OS X, fear not, you are using Apple's built-in libraries, all should work fine ;)

USAGE


'use strict';

var bitcoinconsensus = require('libbitcoinconsensus');

// the transaction spending an output
var txTo = new Buffer('01000000015884e5db9de218238671572340b207ee85b628074e7e467096c267266baf77a4000000006a4730440220340f35055aceb14250e4954b23743332f671eb803263f363d1d7272f1d487209022037a0eaf7cb73897ba9069fc538e7275c5ae188e934ae47ca4a70453b64fc836401210234257444bd3aead2b851bda4288d60abe34095a2a8d49aff1d4d19773d22b32cffffffff01a0860100000000001976a9147821c0a3768aa9d1a37e16cf76002aef5373f1a888ac00000000', 'hex');

// the previous unspent output script
var scriptPubKey = new Buffer('76a9144621d47f08fcb1e6be0b91144202de7a186deade88ac', 'hex');

// the input index that is spending the scriptPubKey
var nIn = 0;

var valid = bitcoinconsensus.verifyScript(scriptPubKey, txTo, nIn);

// valid will equal 0 (false) or 1 (true)
console.log(valid);

// the version of libbitcoinconsensus
var version = bitcoinconsensus.version();
console.log(version);

API

bitconconsensus.version()

Get the version of the libbitcoinconsensus library

Parameters

none

Returns: String representing the version of the library.

bitcoinconsensus.verifyScript(scriptPubKey, txTo, nIn, flags)

Verify the script according to the buffers sent in (scriptPubKey)

Parameters

  • scriptPubKey - Buffer
  • txTo - Buffer
  • nInt - integer
  • flags - integer

Returns: integer representing whether the script was valid (1) or not valid (0).

Throws: String exception when an exception is handled by the native library.

TEST

run npm test

LICENSE

MIT