node package manager


CoinJar NPM

Build Status Dependency Status NPM version

Coinjar API (business and personal) client for Node.js

Getting Started

Install the module with: npm install coinjar

Or add the module to your package file, replacing the version number with the latest version:

"dependencies": {
  "coinjar": ">= 0.0.1"


To use, in your code, require the library and initialize it's export:

  var coinjar = require('coinjar'),
  cj = new coinjar({
    auth_token: 'YOUR_USER_TOKEN',
    merchant_uuid: YOUR_MERCHANT_UUID, 
    merchant_secret: YOUR_MERCHANT_SECRET,
    sandbox: true

API tokens/keys

Make sure you get an API key from First create an account - best to use the sandbox environment where you can send and receive fake bitcoins when starting out. To do this sign up for a Coinjar Sandbox account.

In your CoinJar sandbox account you can create a "bitcoin address" and send test bitcoin to this address from a Faucet. You can return to them some test bitcoin as well. You can create addresses under your account and send/receive bitcoin, this way you have some test transactional data to work with.

Finally you need to turn on your user API access by going to account settings -> API access -> Enable API. This will ask you for your credentials and display an API key.

If you're building a merchant application you will also need to retrieve your merchant id and key from your Sandbox account or from the live/production Coinjar website

The CoinJar NPM library also lets you use the following environment variables in lieu of declaring them in the index.js file:


And your declaration in code:

  var coinjar = require('coinjar'),
  cj = new coinjar({
    sandbox: true


In typical Node.js fashion, all the API's take callback that take (error, response) parameters, such as:

cj.personal.transactions(function (error, response) {
  // do something with the response

The easiest way to get started is to take a look at the integration test suite included in this NPM library.

Quick Start - You can also download a test Node.js application that is already using this CoinJar NPM library, to get you started quickly.


In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests to the existing integration test suite, for any new/changes to the code. Also lint and test your code using Grunt.

For debugging, you should install node inspector. Open a new terminal window/tab and run:

$ npm install -g node-inspector

Next, run node-inspector:

$ node-inspector &

You should get the output:

Visit to start debugging.

Open another terminal into the working directory and execute Node with the debug flag

$ node --debug-brk `which nodeunit` test/** 

You should get the output:

debugger listening on port 5858

You can open Chrome browser at to use it's development tools to debug your application.


Copyright (c) 2013 Jim Lyndon. Licensed under the MIT license.