GithubHelp home page GithubHelp logo

bitcoinjs-server's Introduction

BitcoinJS Server

Build Status

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.

WebsiteMailing ListTwitter

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.

Documentation

Please visit the BitcoinJS Server Wiki on Github for documentation.

There is also a built-in documentation system which you can access by running bitcoinjs help.

Installation

Prerequisites

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

LevelDB

LevelDB is the default database back end in BitcoinJS 0.2+. It is bundled with the node-leveldb NPM module and is therefore installed automatically. No manual steps should be necessary.

MongoDB (deprecated)

If you wish to use a MongoDB database, you need to setup a MongoDB server. This can be done using any method.

You also need to install the MongoDB Node.js module:

cd /path/to/bitcoinjs-server
npm install mongodb

Note that we don't recommend using MongoDB. We see BitcoinJS as a special purpose database server, so having a general purpose database server behind introduces tremendous overhead. For more information on how to query BitcoinJS in LevelDB mode, please refer to the wiki.

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 bitcoinjs -g

Logging

BitcoinJS 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

BitcoinJS 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 BitcoinJS as a library, take a look at the Developer Guide on the wiki.

Upgrading

When upgrading BitcoinJS it is a good idea to reset its database:

bitcoinjs db-drop

This won't be necessary once BitcoinJS 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/*.js --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 BitcoinJS are not compiled yet.

Go to the bitcoinjs folder and run:

node-waf configure build

License

This product is free and open-source software released under the MIT license.

Credits

BitcoinJS Server - Node.js Bitcoin client
Copyright (c) 2011-2012 Stefan Thomas [email protected].

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

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

bitcoinjs-server's People

Contributors

alkavan avatar andrewschaaf avatar bgoris avatar booo avatar dazoe avatar defunctzombie avatar freewil avatar jb55 avatar jdnavarro avatar justmoon avatar katuma avatar killerstorm avatar midnightlightning avatar peterbraden avatar sandeep-haemoon avatar vorandrew avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.