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

bitcoinjs

v0.2.8

Published

Implementation of Bitcoin's peer-to-peer layer for Node.js

Downloads

75

Readme

node-bitcoin-p2p

This is an implementation of a Bitcoin node in Node.js. It is intended as a powerful alternative to the standard bitcoind that ships with the original client.

Differences to original client

The original client contains the node, wallet, GUI and miner. This library contains a highly optimized version of the node, i.e. the P2P part of Bitcoin. Its main intended use is as a server component to give lighter clients access to the data in the block chain (in real-time.)

But it can also be used for writing other software that requires real-time data from the block chain or wants to run queries against it.

Installation

Prerequisites

Node.js should be compiled manually based on the latest stable release.

MongoDB

If you wish to use a MongoDB database (most users will want to just use the built-in database), you need to setup a MongoDB server. This can be done using any method.

Installation

Once you have all prerequisites, this one-liner will install the latest version straight from NPM:

# Install BitcoinJS Server globally
sudo npm install bitcoinjs -g

Please refer to the wiki for detailed installation instructions.

If you run into problems, please take a look at the "Troubleshooting" section below or go to Issues to open a new ticket.

Usage

For your first experience with the BitcoinJS daemon, try running it right from the terminal.

bitcoinjs run --testnet --bchdbg

You can find out more about the various functions of the command line utility via the help feature:

bitcoinjs help

Uninstall

# Remove the database
bitcoinjs db-drop

# Uninstall the software
sudo npm uninstall bitcoin-p2p -g

Logging

node-bitcoin-p2p logs using the winston library. Currently, it defaults to logging anything on the debug log level and higher. Here are the available log levels:

  • netdbg - Networking events (sending/receiving messages)
  • bchdbg - Block chain events (adding blocks)
  • rpcdbg - JSON-RPC API events (requests/responses)
  • scrdbg - Script interpreter events (custom scripts, errors)
  • debug - Other verbose logging
  • info - General information and status messages
  • warn - Something rare happened (e.g. strange pubKeyScript)
  • error - Something bad happened

The XXXdbg levels can be enabled individually by editing lib/logger.js or via the command line, e.g. bitcoinjs run --bchdbg.

Advanced usage

node-bitcoin-p2p is not only a daemon, but also a Node.js module/library. In most cases it's best to use the daemon via RPC. But sometimes you need the extra control that comes with directly linking to the code.

For details on developing with node-bitcoin-p2p as a library, take a look at the Developer Guide on the wiki.

Upgrading

When upgrading node-bitcoin-p2p it is a good idea to reset its database:

bitcoinjs db-drop

This won't be necessary once node-bitcoin-p2p is more stable, but for now new versions often break database compatibility, so it's easiest to just reset it.

Tests

To run the test suite, please install Vows and run the following command:

vows test/* --spec

Status

The library is currently alpha quality. Here are some things it currently lacks:

  • Respond to getblocks requests
  • Manage knowledge about other peers
  • DoS protections from Bitcoin 0.4+

On top of that, it could use a lot more documentation, test cases and general bug fixing across the board.

You can find more information on the Issues tab on Github.

Troubleshooting

Native module missing

If you see this error:

Error: Cannot find module '../build-cc/default/native'

This happens when the native components of node-bitcoin-p2p are not compiled yet.

Go to the node-bitcoin-p2p folder and run:

node-waf configure build

Credits

node-bitcoin-p2p - Node.js Bitcoin client Copyright (c) 2011 Stefan Thomas [email protected].

Some native extensions are Copyright (c) 2011 Andrew Schaaf [email protected]

Parts of this software are based on BitcoinJ Copyright (c) 2011 Google Inc.